mirror of
https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
synced 2025-06-25 19:03:56 +02:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
c9a838d368 | |||
808916ddd3 | |||
c51c463338 | |||
a22d1e6ddb | |||
93bb634f7c | |||
31426a1dfd | |||
f862af8699 | |||
78e7342acf | |||
4d8157ba1e | |||
661566aade | |||
eb2b9dc2d3 | |||
3385540350 | |||
0588180dda | |||
9995bc8e25 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,3 +11,5 @@ data
|
|||||||
/user_data
|
/user_data
|
||||||
install.sh
|
install.sh
|
||||||
nohup.out
|
nohup.out
|
||||||
|
test.py
|
||||||
|
points.csv
|
||||||
|
77
V5.py
77
V5.py
@ -85,9 +85,8 @@ def log_error(error, ldriver=driver, log=FULL_LOG):
|
|||||||
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=_mail)
|
embed.set_footer(text=_mail)
|
||||||
webhookFailure.send(embed=embed, file=file)
|
webhookFailure.send(embed=embed, username="error", file=file, avatar_url = AVATAR_URL)
|
||||||
webhookFailure.send(file=File("page.html"))
|
webhookFailure.send(username="error", file=File("page.html"), avatar_url = AVATAR_URL)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# close the tab currently on and go back to the one first, or the one specified
|
# close the tab currently on and go back to the one first, or the one specified
|
||||||
@ -103,7 +102,7 @@ def play_quiz2(override=10) -> None:
|
|||||||
printf("starting play_quiz2")
|
printf("starting play_quiz2")
|
||||||
for j in range(override):
|
for j in range(override):
|
||||||
try:
|
try:
|
||||||
rgpd_popup(driver)
|
# rgpd_popup(driver)
|
||||||
custom_sleep(uniform(3, 5))
|
custom_sleep(uniform(3, 5))
|
||||||
page_html = driver.page_source
|
page_html = driver.page_source
|
||||||
secret_answer = search('IG:"([^"]+)"', page_html)[1] # variable used to calculate offset
|
secret_answer = search('IG:"([^"]+)"', page_html)[1] # variable used to calculate offset
|
||||||
@ -137,7 +136,7 @@ def play_quiz8():
|
|||||||
printf(f"play_quiz8 : start, override : {override}")
|
printf(f"play_quiz8 : start, override : {override}")
|
||||||
try:
|
try:
|
||||||
counter = 0
|
counter = 0
|
||||||
rgpd_popup(driver)
|
# rgpd_popup(driver)
|
||||||
for _ in range(override):
|
for _ in range(override):
|
||||||
custom_sleep(uniform(3, 5))
|
custom_sleep(uniform(3, 5))
|
||||||
correct_answers = []
|
correct_answers = []
|
||||||
@ -184,7 +183,7 @@ def play_quiz4(override=None):
|
|||||||
for i in range(override):
|
for i in range(override):
|
||||||
custom_sleep(uniform(3, 5))
|
custom_sleep(uniform(3, 5))
|
||||||
txt = driver.page_source
|
txt = driver.page_source
|
||||||
rgpd_popup(driver)
|
# rgpd_popup(driver)
|
||||||
answer_option = search('correctAnswer":"([^"]+)', txt)[1]
|
answer_option = search('correctAnswer":"([^"]+)', txt)[1]
|
||||||
answer_option = answer_option.replace("\\u0027", "'") # replace Unicode weird symbols
|
answer_option = answer_option.replace("\\u0027", "'") # replace Unicode weird symbols
|
||||||
try:
|
try:
|
||||||
@ -221,9 +220,10 @@ def all_cards(): # return to the main page and closes all other tabs
|
|||||||
if len(driver.window_handles) == 1:
|
if len(driver.window_handles) == 1:
|
||||||
driver.get("https://www.bing.com/rewardsapp/flyout")
|
driver.get("https://www.bing.com/rewardsapp/flyout")
|
||||||
if part2:
|
if part2:
|
||||||
driver.find_element(
|
row_element = driver.find_elements(By.CSS_SELECTOR, f'[class="i-h rw-sh fp_row"]')[1]
|
||||||
By.XPATH, "/html/body/div/div/div[3]/div[2]/div[2]/div[2]/div[1]"
|
expanded = row_element.get_attribute("aria-expanded")
|
||||||
).click()
|
if expanded != "true":
|
||||||
|
row_element.click()
|
||||||
else:
|
else:
|
||||||
driver.switch_to.window(driver.window_handles[1])
|
driver.switch_to.window(driver.window_handles[1])
|
||||||
printf(f"fermeture : {driver.current_url}")
|
printf(f"fermeture : {driver.current_url}")
|
||||||
@ -236,7 +236,7 @@ def all_cards(): # return to the main page and closes all other tabs
|
|||||||
def daily_cards(): # cartes de la premiere partie (renouvelées chaque jours).
|
def daily_cards(): # cartes de la premiere partie (renouvelées chaque jours).
|
||||||
try:
|
try:
|
||||||
# make sure that the daily area is expanded
|
# make sure that the daily area is expanded
|
||||||
row_element = driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[2]/div[1]/div[1]")
|
row_element = driver.find_elements(By.CSS_SELECTOR, f'[class="i-h rw-sh fp_row"]')[0]
|
||||||
expanded = row_element.get_attribute("aria-expanded")
|
expanded = row_element.get_attribute("aria-expanded")
|
||||||
if expanded != "true":
|
if expanded != "true":
|
||||||
row_element.click()
|
row_element.click()
|
||||||
@ -244,9 +244,8 @@ def all_cards(): # return to the main page and closes all other tabs
|
|||||||
custom_sleep(uniform(3, 5))
|
custom_sleep(uniform(3, 5))
|
||||||
try:
|
try:
|
||||||
titre = "Placeholder"
|
titre = "Placeholder"
|
||||||
driver.find_element(
|
elm = driver.find_elements(By.CLASS_NAME, 'promo_cont')
|
||||||
By.XPATH,f"/html/body/div/div/div[3]/div[2]/div[1]/div[2]/div/div[{i+1}]/a",
|
elm[i].click()
|
||||||
).click()
|
|
||||||
sleep(1)
|
sleep(1)
|
||||||
titre = driver.title
|
titre = driver.title
|
||||||
try_play(titre)
|
try_play(titre)
|
||||||
@ -255,7 +254,7 @@ def all_cards(): # return to the main page and closes all other tabs
|
|||||||
printf(f"DailyCard {titre} ok")
|
printf(f"DailyCard {titre} ok")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(f"all_cards card {titre} error ({format_error(e)})")
|
log_error(f"all_cards card {titre} error ({format_error(e)})")
|
||||||
|
"""
|
||||||
try : # devrait renvoyer vrai si la carte i est faite ou pas, a l'aide su symbole en haut a droite de la carte
|
try : # devrait renvoyer vrai si la carte i est faite ou pas, a l'aide su symbole en haut a droite de la carte
|
||||||
elm = driver.find_element(By.XPATH, f"/html/body/div/div/div[3]/div[2]/div[1]/div[2]/div/div[{i+1}]/a/div/div[2]/div[1]/div[2]/div")
|
elm = driver.find_element(By.XPATH, f"/html/body/div/div/div[3]/div[2]/div[1]/div[2]/div/div[{i+1}]/a/div/div[2]/div[1]/div[2]/div")
|
||||||
if not ("correctCircle" in elm.get_attribute("innerHTML")):
|
if not ("correctCircle" in elm.get_attribute("innerHTML")):
|
||||||
@ -266,23 +265,25 @@ def all_cards(): # return to the main page and closes all other tabs
|
|||||||
except Exception as e :
|
except Exception as e :
|
||||||
printf(format_error(e) + "probablement ok - check card")
|
printf(format_error(e) + "probablement ok - check card")
|
||||||
# if it fail, it's probably okay -> when all three card are done, the pannel fold
|
# if it fail, it's probably okay -> when all three card are done, the pannel fold
|
||||||
|
"""
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(e)
|
log_error(e)
|
||||||
|
|
||||||
def weekly_cards():
|
def weekly_cards():
|
||||||
# make sure that the weekly area is expanded
|
# make sure that the weekly area is expanded
|
||||||
row_element = driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[2]/div[2]/div[2]")
|
row_element = driver.find_elements(By.CSS_SELECTOR, f'[class="i-h rw-sh fp_row"]')[1]
|
||||||
expanded = row_element.get_attribute("aria-expanded")
|
expanded = row_element.get_attribute("aria-expanded")
|
||||||
if expanded != "true":
|
if expanded != "true":
|
||||||
row_element.click()
|
row_element.click()
|
||||||
|
|
||||||
for i in range(20): # Should raise an error whene there is no card left
|
for i in range(20): # Should raise an error whene there is no card left
|
||||||
printf("début de l'une des cartes")
|
printf("début de l'une des cartes")
|
||||||
driver.find_element(
|
elm = driver.find_elements(By.CLASS_NAME, 'promo_cont')
|
||||||
By.XPATH,
|
try :
|
||||||
"/html/body/div/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/a/div/div[2]",
|
elm[0].click()
|
||||||
).click()
|
except Exception as e :
|
||||||
|
print(f"{e} + {driver.current_url}")
|
||||||
|
break
|
||||||
driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
|
driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
|
||||||
sleep(1)
|
sleep(1)
|
||||||
titre = driver.title
|
titre = driver.title
|
||||||
@ -290,13 +291,13 @@ def all_cards(): # return to the main page and closes all other tabs
|
|||||||
try_play(titre)
|
try_play(titre)
|
||||||
reset(True)
|
reset(True)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
try:
|
#try:
|
||||||
findall('href="([^<]+)" title=""', driver.page_source)[3] # return error if there is no cards left to do
|
# findall('href="([^<]+)" title=""', driver.page_source)[3] # return error if there is no cards left to do
|
||||||
except:
|
#except:
|
||||||
break
|
# break
|
||||||
|
|
||||||
def top_cards():
|
def top_cards():
|
||||||
for _ in range(10):
|
for _ in range(2):
|
||||||
try :
|
try :
|
||||||
driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div/div[1]/div[2]").click()
|
driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div/div[1]/div[2]").click()
|
||||||
reset()
|
reset()
|
||||||
@ -305,17 +306,20 @@ def all_cards(): # return to the main page and closes all other tabs
|
|||||||
break
|
break
|
||||||
|
|
||||||
try :
|
try :
|
||||||
top_cards()
|
#top_cards()
|
||||||
|
print("top card not working really well right now. Disableing them")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(e)
|
log_error(e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
daily_cards()
|
daily_cards()
|
||||||
|
print("daily card")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(e)
|
log_error(e)
|
||||||
|
|
||||||
try :
|
try :
|
||||||
weekly_cards()
|
weekly_cards()
|
||||||
|
print("weekly card")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log_error(e)
|
log_error(e)
|
||||||
|
|
||||||
@ -363,7 +367,7 @@ def try_play(nom="inconnu"):
|
|||||||
if "bt_PollRadio" in driver.page_source:
|
if "bt_PollRadio" in driver.page_source:
|
||||||
try:
|
try:
|
||||||
printf("Poll detected")
|
printf("Poll detected")
|
||||||
rgpd_popup(driver)
|
#rgpd_popup(driver)
|
||||||
do_poll()
|
do_poll()
|
||||||
printf("Poll succeeded")
|
printf("Poll succeeded")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -379,12 +383,12 @@ def try_play(nom="inconnu"):
|
|||||||
|
|
||||||
elif search("([0-9]) de ([0-9]) finalisée", driver.page_source):
|
elif search("([0-9]) de ([0-9]) finalisée", driver.page_source):
|
||||||
printf("fidélité")
|
printf("fidélité")
|
||||||
rgpd_popup(driver)
|
#rgpd_popup(driver)
|
||||||
fidelity()
|
fidelity()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
printf(f"rien à faire sur la page {nom}")
|
printf(f"rien à faire sur la page {nom}")
|
||||||
rgpd_popup(driver)
|
# rgpd_popup(driver)
|
||||||
custom_sleep(uniform(3, 5))
|
custom_sleep(uniform(3, 5))
|
||||||
|
|
||||||
|
|
||||||
@ -463,13 +467,13 @@ def login(ldriver):
|
|||||||
printf("Timeout error occurred. \"normal\"....., maybe because of mismatch date ? ")
|
printf("Timeout error occurred. \"normal\"....., maybe because of mismatch date ? ")
|
||||||
log_error("Timeout error occurred. \"normal\"....., maybe because of mismatch date ?", ldriver, True) # TODO check this hypothesis
|
log_error("Timeout error occurred. \"normal\"....., maybe because of mismatch date ?", ldriver, True) # TODO check this hypothesis
|
||||||
else:
|
else:
|
||||||
log_error(e)
|
log_error(e, ldriver)
|
||||||
custom_sleep(20) # TODO : remplacer par un wait_element
|
wait_until_visible(By.CSS_SELECTOR, '[data-bi-id="sh-sharedshell-rewards"]', 20, ldriver)
|
||||||
if ("account.microsoft.com" in ldriver.current_url) :
|
if ("account.microsoft.com" in ldriver.current_url) :
|
||||||
ldriver.get("https://bing.com")
|
ldriver.get("https://bing.com")
|
||||||
custom_sleep(5)
|
custom_sleep(5)
|
||||||
ldriver.refresh()
|
ldriver.refresh()
|
||||||
rgpd_popup(ldriver)
|
rgpd_popup(ldriver) # Ultra important
|
||||||
ldriver.get("https://www.bing.com/rewardsapp/flyout")
|
ldriver.get("https://www.bing.com/rewardsapp/flyout")
|
||||||
if not('>Tableau de bord' in ldriver.page_source):
|
if not('>Tableau de bord' in ldriver.page_source):
|
||||||
try :
|
try :
|
||||||
@ -665,7 +669,6 @@ def fidelity():
|
|||||||
fidelity_link = fidelity_link_page.content.decode("UTF-8")
|
fidelity_link = fidelity_link_page.content.decode("UTF-8")
|
||||||
|
|
||||||
if (fidelity_link.split(":")[0] == "https") or (fidelity_link.split(":")[0] == "http") :
|
if (fidelity_link.split(":")[0] == "https") or (fidelity_link.split(":")[0] == "http") :
|
||||||
|
|
||||||
driver.get(fidelity_link)
|
driver.get(fidelity_link)
|
||||||
wait_until_visible(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]', browser=driver)
|
wait_until_visible(By.CSS_SELECTOR, 'div[class="pull-left spacer-48-bottom punchcard-row"]', browser=driver)
|
||||||
try :
|
try :
|
||||||
@ -678,9 +681,10 @@ def fidelity():
|
|||||||
answer_number = search("([0-9]) de ([0-9]) finalisé", driver.page_source)
|
answer_number = search("([0-9]) de ([0-9]) finalisé", driver.page_source)
|
||||||
if answer_number is None :
|
if answer_number is None :
|
||||||
answer_number = search("([0-9]) licence\(s\) sur ([0-9]) disponible\(s\)", driver.page_source)
|
answer_number = search("([0-9]) licence\(s\) sur ([0-9]) disponible\(s\)", driver.page_source)
|
||||||
|
if answer_number is None :
|
||||||
|
answer_number = search("([0-9]) défi\(s\) terminé\(s\) sur ([0-9])", driver.page_source)
|
||||||
if answer_number is None :
|
if answer_number is None :
|
||||||
answer_number = [0,0,0]
|
answer_number = [0,0,0]
|
||||||
|
|
||||||
for _ in range(int(answer_number[2]) - int(answer_number[1])):
|
for _ in range(int(answer_number[2]) - int(answer_number[1])):
|
||||||
driver.refresh()
|
driver.refresh()
|
||||||
custom_sleep(2)
|
custom_sleep(2)
|
||||||
@ -842,7 +846,7 @@ def daily_routine(custom = False):
|
|||||||
|
|
||||||
|
|
||||||
def dev():
|
def dev():
|
||||||
pass
|
log_error("test")
|
||||||
|
|
||||||
|
|
||||||
def CustomStart(Credentials):
|
def CustomStart(Credentials):
|
||||||
@ -925,6 +929,9 @@ elif UNBAN:
|
|||||||
elif POINTS_FILE != "":
|
elif POINTS_FILE != "":
|
||||||
save_points_from_file(POINTS_FILE)
|
save_points_from_file(POINTS_FILE)
|
||||||
else:
|
else:
|
||||||
|
if UPDATE_VERSION != "None":
|
||||||
|
if DISCORD_ENABLED_ERROR:
|
||||||
|
webhookFailure.send(f"Updated to {UPDATE_VERSION}")
|
||||||
for cred in Credentials:
|
for cred in Credentials:
|
||||||
_mail = cred[0]
|
_mail = cred[0]
|
||||||
_password = cred[1]
|
_password = cred[1]
|
||||||
|
24
database.py
24
database.py
@ -10,9 +10,16 @@ parser.add_argument(
|
|||||||
help="Choose a file",
|
help="Choose a file",
|
||||||
type=argparse.FileType('r')
|
type=argparse.FileType('r')
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-m",
|
||||||
|
"--manual",
|
||||||
|
help="add point manually do database",
|
||||||
|
dest="manual",
|
||||||
|
action="store_true"
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
MANUAL = args.manual
|
||||||
|
|
||||||
config_path = "./user_data/config.cfg"
|
config_path = "./user_data/config.cfg"
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
@ -47,7 +54,7 @@ def ban_account(name: str, pts = 0):
|
|||||||
def update_pts(name: str, pts = 0):
|
def update_pts(name: str, pts = 0):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if not MANUAL :
|
||||||
print("ajouter un compte : 1\nban un compte : 2")
|
print("ajouter un compte : 1\nban un compte : 2")
|
||||||
i = input()
|
i = input()
|
||||||
if i == "1":
|
if i == "1":
|
||||||
@ -70,3 +77,16 @@ elif i == '2':
|
|||||||
mydb.commit()
|
mydb.commit()
|
||||||
mycursor.close()
|
mycursor.close()
|
||||||
mydb.close()
|
mydb.close()
|
||||||
|
else :
|
||||||
|
import modules.db as datab
|
||||||
|
config_path = f"{path.abspath(path.dirname(path.dirname( __file__ )))}/MsRewards/user_data/config.cfg"
|
||||||
|
print(config_path)
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read(config_path)
|
||||||
|
sql_usr = config["SQL"]["usr"]
|
||||||
|
sql_pwd = config["SQL"]["pwd"]
|
||||||
|
sql_host = config["SQL"]["host"]
|
||||||
|
sql_database = config["SQL"]["database"]
|
||||||
|
account_name = input("compte ? ")
|
||||||
|
points = int(input("points ? "))
|
||||||
|
datab.add_to_database(account_name, points, sql_host, sql_usr, sql_pwd, sql_database)
|
44
main.py
44
main.py
@ -1,8 +1,11 @@
|
|||||||
#/usr/bin/python3.10
|
#/usr/bin/python3.10
|
||||||
|
from packaging.version import parse as parse_version
|
||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import requests
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
|
|
||||||
@ -16,8 +19,6 @@ except :
|
|||||||
config.read(config_path)
|
config.read(config_path)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def confirm(texte, default = False):
|
def confirm(texte, default = False):
|
||||||
if default :
|
if default :
|
||||||
txt = '[Y/n]'
|
txt = '[Y/n]'
|
||||||
@ -41,12 +42,12 @@ text = {"fr" : {
|
|||||||
"next" : "voulez vous ajouter un compte ? ",
|
"next" : "voulez vous ajouter un compte ? ",
|
||||||
"finc" : "comptes en cours d'ajout ",
|
"finc" : "comptes en cours d'ajout ",
|
||||||
"ajout" : "comptes ajouté ",
|
"ajout" : "comptes ajouté ",
|
||||||
"fidelity" : "avez vous un lien sur lequel le lien vers la page fidelité du mois est le seul contenu de la page ? ",
|
"fidelity" : "avez vous un lien sur lequel le lien vers la page fidélité du mois est le seul contenu de la page ? ",
|
||||||
"lien" : "entrez le lien ",
|
"lien" : "entrez le lien ",
|
||||||
"discorde" : "voulez vous envoyer les erreurs sur discord ? ",
|
"discorde" : "voulez vous envoyer les erreurs sur discord ? ",
|
||||||
"w1" : "entrez le lien du WebHook pour envoyer les points ",
|
"w1" : "entrez le lien du WebHook pour envoyer les points ",
|
||||||
"w2" : "entrez le lien du WebHook pour envoyer les erreurs ",
|
"w2" : "entrez le lien du WebHook pour envoyer les erreurs ",
|
||||||
"msqle" : "voulez vous untiliser une base de donnée ",
|
"msqle" : "voulez vous utiliser une base de donnée ",
|
||||||
"msqll" : "entrez le lien de la base de donnée ",
|
"msqll" : "entrez le lien de la base de donnée ",
|
||||||
"msqlu" : "entrez l'utilisateur de la base de donnée ",
|
"msqlu" : "entrez l'utilisateur de la base de donnée ",
|
||||||
"msqlp" : "entrez le mot de passe de la base de donnée ",
|
"msqlp" : "entrez le mot de passe de la base de donnée ",
|
||||||
@ -83,8 +84,6 @@ def setup_comptes():
|
|||||||
f.write("\n")
|
f.write("\n")
|
||||||
f.close()
|
f.close()
|
||||||
print(t["ajout"])
|
print(t["ajout"])
|
||||||
|
|
||||||
#modifie le fichier de configuration
|
|
||||||
edit_config_txt("logpath",f'{os.getcwd()}/user_data/login.csv')
|
edit_config_txt("logpath",f'{os.getcwd()}/user_data/login.csv')
|
||||||
|
|
||||||
|
|
||||||
@ -111,7 +110,7 @@ def setup_settings():
|
|||||||
discord()
|
discord()
|
||||||
proxy()
|
proxy()
|
||||||
sql()
|
sql()
|
||||||
amazon()
|
|
||||||
|
|
||||||
def general():
|
def general():
|
||||||
if confirm(t["fidelity"]):
|
if confirm(t["fidelity"]):
|
||||||
@ -144,6 +143,7 @@ def sql() :
|
|||||||
pwd = input(t["msqlp"])
|
pwd = input(t["msqlp"])
|
||||||
edit_config_txt("pwd",pwd)
|
edit_config_txt("pwd",pwd)
|
||||||
|
|
||||||
|
|
||||||
def proxy() :
|
def proxy() :
|
||||||
enabled = confirm(t["proxye"], default = False)
|
enabled = confirm(t["proxye"], default = False)
|
||||||
if enabled :
|
if enabled :
|
||||||
@ -153,13 +153,33 @@ def proxy() :
|
|||||||
port = input(t["proxyp"])
|
port = input(t["proxyp"])
|
||||||
edit_config_txt("port",port)
|
edit_config_txt("port",port)
|
||||||
|
|
||||||
def amazon():
|
|
||||||
enabled = confirm("claim les recompenses automatiquement sur amazon ?", default = False)
|
|
||||||
edit_config_txt("claim_amazon",enabled)
|
|
||||||
|
|
||||||
|
def check_update(args):
|
||||||
|
try :
|
||||||
|
latest = requests.get("https://api.github.com/repos/piair338/MsRewards/releases").json()[0]["tag_name"]
|
||||||
|
latest = parse_version(latest)
|
||||||
|
except Exception as e :
|
||||||
|
print(e)
|
||||||
|
return (args)
|
||||||
|
f = open("./version", 'r')
|
||||||
|
txt = f.readlines()[0].replace("\n","")
|
||||||
|
f.close()
|
||||||
|
cur = parse_version(txt)
|
||||||
|
if not (cur < latest) :
|
||||||
|
print("Already up to date.")
|
||||||
|
return(args)
|
||||||
|
else :
|
||||||
|
print(f"updating to {latest}")
|
||||||
|
os.system("git reset --hard")
|
||||||
|
os.system("git pull")
|
||||||
|
os.system("python3 -m pip install -r requirements.txt > update.result")
|
||||||
|
print(f"updated to {latest}")
|
||||||
|
return(args + f" --version {latest}")
|
||||||
|
|
||||||
LogPath = config["PATH"]["logpath"]
|
LogPath = config["PATH"]["logpath"]
|
||||||
if LogPath == "/your/path/to/loginandpass.csv" :
|
if LogPath == "/your/path/to/loginandpass.csv" :
|
||||||
setup()
|
setup()
|
||||||
else :
|
else :
|
||||||
os.system("python3 V5.py")
|
args = " ".join(sys.argv[1::])
|
||||||
|
args = check_update(args)
|
||||||
|
os.system("python3 V5.py " + args)
|
||||||
|
@ -81,6 +81,12 @@ parser.add_argument(
|
|||||||
default="None"
|
default="None"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--updated",
|
||||||
|
help="display a message on discord to tell that the bot have been updated",
|
||||||
|
dest="update_version",
|
||||||
|
default="None"
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
CUSTOM_START = args.override
|
CUSTOM_START = args.override
|
||||||
@ -93,7 +99,7 @@ if CUSTOM_START :
|
|||||||
VNC_ENABLED = args.vnc != "None"
|
VNC_ENABLED = args.vnc != "None"
|
||||||
VNC_PORT = args.vnc
|
VNC_PORT = args.vnc
|
||||||
POINTS_FILE = args.points_file
|
POINTS_FILE = args.points_file
|
||||||
|
UPDATE_VERSION = args.update_version
|
||||||
# global variables used later in the code
|
# global variables used later in the code
|
||||||
LINUX_HOST = platform == "linux" # if the computer running this program is Linux, it allow more things
|
LINUX_HOST = platform == "linux" # if the computer running this program is Linux, it allow more things
|
||||||
START_TIME = time()
|
START_TIME = time()
|
||||||
@ -125,6 +131,10 @@ DISCORD_SUCCESS_LINK = config["DISCORD"]["successlink"]
|
|||||||
DISCORD_ERROR_LINK = config["DISCORD"]["errorlink"]
|
DISCORD_ERROR_LINK = config["DISCORD"]["errorlink"]
|
||||||
DISCORD_ENABLED_ERROR = config["DISCORD"]["DiscordErrorEnabled"] == "True"
|
DISCORD_ENABLED_ERROR = config["DISCORD"]["DiscordErrorEnabled"] == "True"
|
||||||
DISCORD_ENABLED_SUCCESS = config["DISCORD"]["DiscordSuccessEnabled"]== "True"
|
DISCORD_ENABLED_SUCCESS = config["DISCORD"]["DiscordSuccessEnabled"]== "True"
|
||||||
|
try :
|
||||||
|
AVATAR_URL = config["OTHER"]["avatar"]== "True"
|
||||||
|
except :
|
||||||
|
AVATAR_URL = "https://cdn.discordapp.com/icons/793934298977009674/d8055bccef6eca4855c349e808d0d788.webp"
|
||||||
|
|
||||||
if DISCORD_ENABLED_ERROR:
|
if DISCORD_ENABLED_ERROR:
|
||||||
webhookFailure = Webhook.from_url(DISCORD_ERROR_LINK, adapter=RequestsWebhookAdapter())
|
webhookFailure = Webhook.from_url(DISCORD_ERROR_LINK, adapter=RequestsWebhookAdapter())
|
||||||
|
@ -9,3 +9,4 @@ pyvirtualdisplay
|
|||||||
pillow
|
pillow
|
||||||
EasyProcess
|
EasyProcess
|
||||||
pyotp
|
pyotp
|
||||||
|
packaging
|
||||||
|
@ -31,5 +31,5 @@ usr = root
|
|||||||
pwd = password
|
pwd = password
|
||||||
|
|
||||||
[OTHER]
|
[OTHER]
|
||||||
|
avatar = https://cdn.discordapp.com/icons/793934298977009674/d8055bccef6eca4855c349e808d0d788.webp
|
||||||
ipv6 = False
|
ipv6 = False
|
Reference in New Issue
Block a user