mirror of
				https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
				synced 2025-11-04 15:43:53 +01:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			dev
			...
			200b0d8a86
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					200b0d8a86 | ||
| 
						 | 
					4a5af6455d | ||
| 
						 | 
					49b691d736 | ||
| 
						 | 
					9549a6dea3 | 
							
								
								
									
										16
									
								
								V6.py
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								V6.py
									
									
									
									
									
								
							@@ -152,7 +152,7 @@ def play_quiz4(override: int = None):
 | 
				
			|||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        log_error(e)
 | 
					        log_error(e)
 | 
				
			||||||
        raise ValueError(e)
 | 
					        raise ValueError(e)
 | 
				
			||||||
    info("Quiz 8 done.")
 | 
					    info("Quiz 4 done.")
 | 
				
			||||||
    custom_sleep(3)
 | 
					    custom_sleep(3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -165,6 +165,8 @@ def do_poll():
 | 
				
			|||||||
        try:
 | 
					        try:
 | 
				
			||||||
            answer_elem.click()
 | 
					            answer_elem.click()
 | 
				
			||||||
        except exceptions.ElementNotInteractableException:
 | 
					        except exceptions.ElementNotInteractableException:
 | 
				
			||||||
 | 
					            warning("element not clickable. Waiting a bit and retrying.")
 | 
				
			||||||
 | 
					            custom_sleep(uniform(2, 2.5))
 | 
				
			||||||
            driver.execute_script("arguments[0].click();", answer_elem)
 | 
					            driver.execute_script("arguments[0].click();", answer_elem)
 | 
				
			||||||
        custom_sleep(uniform(2, 2.5))
 | 
					        custom_sleep(uniform(2, 2.5))
 | 
				
			||||||
    except Exception as err:
 | 
					    except Exception as err:
 | 
				
			||||||
@@ -610,9 +612,11 @@ def daily_routine(cred: UserCredentials, custom=False):
 | 
				
			|||||||
    try:
 | 
					    try:
 | 
				
			||||||
        if not custom:  # custom already is logged in
 | 
					        if not custom:  # custom already is logged in
 | 
				
			||||||
            login()
 | 
					            login()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    except Banned:
 | 
					    except Banned:
 | 
				
			||||||
        log_error("This account is locked.")
 | 
					        log_error("This account is locked.")
 | 
				
			||||||
        return
 | 
					        raise Banned()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    except Identity:
 | 
					    except Identity:
 | 
				
			||||||
        log_error("This account has an issue.")
 | 
					        log_error("This account has an issue.")
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
@@ -680,7 +684,7 @@ def json_start(json_entry, cred: UserCredentials):
 | 
				
			|||||||
                login()
 | 
					                login()
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                if str(account_id) in json_entry["tout"]:
 | 
					                if str(account_id) in json_entry["tout"]:
 | 
				
			||||||
                    daily_routine(cred)
 | 
					                    daily_routine(cred, True)
 | 
				
			||||||
            except KeyError:
 | 
					            except KeyError:
 | 
				
			||||||
                pass
 | 
					                pass
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
@@ -744,12 +748,16 @@ def default_start():
 | 
				
			|||||||
            config.WebDriver.pc_driver.quit()
 | 
					            config.WebDriver.pc_driver.quit()
 | 
				
			||||||
            config.display.stop()
 | 
					            config.display.stop()
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
 | 
					        except Banned:
 | 
				
			||||||
 | 
					            warning("this account is banned. Switching to next account")
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            log_error(f"Error not caught. Skipping this account. " + format_error(e))
 | 
					            log_error(f"Error not caught. Skipping this account. " + format_error(e))
 | 
				
			||||||
            critical(f"Error not caught. Skipping this account. {e}")
 | 
					            critical(f"Error not caught. Skipping this account. {e}")
 | 
				
			||||||
            config.WebDriver.pc_driver.quit()
 | 
					            config.WebDriver.pc_driver.quit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        config.UserCredentials.next_account()
 | 
					        finally:
 | 
				
			||||||
 | 
					            config.UserCredentials.next_account()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    config.display.stop()
 | 
					    config.display.stop()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,7 +30,7 @@ class DiscordLogger:
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
        file = File("screenshot.png")
 | 
					        file = File("screenshot.png")
 | 
				
			||||||
        embed.set_image(url="attachment://screenshot.png")
 | 
					        embed.set_image(url="attachment://screenshot.png")
 | 
				
			||||||
        embed.set_footer(text=self.config.UserCredentials.creds.get_mail())
 | 
					        embed.set_footer(text=self.config.UserCredentials.get_mail() + " - " + self.config.WebDriver.current_driver())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.config.discord.wh.send(embed=embed, username="error", file=file, avatar_url=self.config.discord.avatar_url)
 | 
					        self.config.discord.wh.send(embed=embed, username="error", file=file, avatar_url=self.config.discord.avatar_url)
 | 
				
			||||||
        self.config.discord.wh.send(username="error", file=File("page.html"), avatar_url=self.config.discord.avatar_url)
 | 
					        self.config.discord.wh.send(username="error", file=File("page.html"), avatar_url=self.config.discord.avatar_url)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,3 +20,6 @@ class Driver:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            case _:
 | 
					            case _:
 | 
				
			||||||
                raise ValueError("The driver must be either pc or mobile")
 | 
					                raise ValueError("The driver must be either pc or mobile")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def current_driver(self):
 | 
				
			||||||
 | 
					        return "PC" if self.pc_driver == self.driver else "Mobile"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ class UserCredentials:
 | 
				
			|||||||
    def get_tfa(self):
 | 
					    def get_tfa(self):
 | 
				
			||||||
        if not self.tfa_enable():
 | 
					        if not self.tfa_enable():
 | 
				
			||||||
            warning("Warning: TFA is not enabled. Calling get_tfa is an expected behaviour.")
 | 
					            warning("Warning: TFA is not enabled. Calling get_tfa is an expected behaviour.")
 | 
				
			||||||
        return TOTP(self.data[self.current]["tfa"])
 | 
					        return TOTP(self.data[self.current]["2fa"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def next_account(self):
 | 
					    def next_account(self):
 | 
				
			||||||
        self.current += 1
 | 
					        self.current += 1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,7 +30,7 @@ class ColoredFormatter(logging.Formatter):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Set up the root logger
 | 
					# Set up the root logger
 | 
				
			||||||
root_logger = logging.getLogger(__name__)
 | 
					root_logger = logging.getLogger(__name__)
 | 
				
			||||||
root_logger.setLevel(logging.DEBUG)
 | 
					root_logger.setLevel(logging.INFO)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a console handler and set the formatter
 | 
					# Create a console handler and set the formatter
 | 
				
			||||||
ch = logging.StreamHandler()
 | 
					ch = logging.StreamHandler()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ def get_domain(driver):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def custom_sleep(temps):
 | 
					def custom_sleep(temps):
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        if True:  # todo: change this awful condition
 | 
					        if False:  # todo: change this awful condition
 | 
				
			||||||
            points = ["⢿", "⣻", "⣽", "⣾", "⣷", "⣯", "⣟", "⡿"]
 | 
					            points = ["⢿", "⣻", "⣽", "⣾", "⣷", "⣯", "⣟", "⡿"]
 | 
				
			||||||
            passe = 0
 | 
					            passe = 0
 | 
				
			||||||
            for _ in range(int(temps)):
 | 
					            for _ in range(int(temps)):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user