check if discord works
This commit is contained in:
parent
ced633dd68
commit
8d332f1c3c
34
V6.py
34
V6.py
|
@ -54,8 +54,12 @@ def play_quiz2(override=10) -> None:
|
|||
custom_sleep(uniform(3, 5))
|
||||
js_function = """
|
||||
function get_correct_answer(){
|
||||
function br(n) { for (var r, t = 0, i = 0; i < n.length; i++)t += n.charCodeAt(i); return r = parseInt(_G.IG.substr(_G.IG.length - 2), 16), t += r, t.toString() } // Ms check function
|
||||
function namedRAValue() { //allow calls to getRAvalue
|
||||
function br(n) {
|
||||
for (var r, t = 0, i = 0; i < n.length; i++)
|
||||
t += n.charCodeAt(i);
|
||||
return r = parseInt(_G.IG.substr(_G.IG.length - 2), 16), t += r, t.toString()
|
||||
} // Ms check function
|
||||
function namedRAValue() { //allow calls to getRAValue
|
||||
return _w.getRAValue()
|
||||
};
|
||||
if (br(document.getElementById("rqAnswerOption0").attributes["data-option"].value) == namedRAValue()){
|
||||
|
@ -259,7 +263,7 @@ def promo():
|
|||
if not elm:
|
||||
break
|
||||
if i > 3:
|
||||
log_error("plus de 3 promo cards, probablement une pa skipable")
|
||||
log_error("There is more than 3 promo cards, most likely an unskippable one.")
|
||||
try:
|
||||
driver.find_element(By.CSS_SELECTOR,
|
||||
'i[class="mee-icon pull-left icon mee-icon-Cancel ng-scope"]').click()
|
||||
|
@ -270,7 +274,7 @@ def promo():
|
|||
elm.click()
|
||||
except Exception as e:
|
||||
driver.execute_script("arguments[0].click();", elm)
|
||||
warning(f"that should't be there (promo), but the workarround seemed to work {e}")
|
||||
warning(f"that shouldn't be there (promo), but the workaround seemed to work {e}")
|
||||
custom_sleep(3)
|
||||
if len(driver.window_handles) > 1:
|
||||
driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
|
||||
|
@ -279,15 +283,15 @@ def promo():
|
|||
else:
|
||||
try:
|
||||
spotify(driver)
|
||||
except:
|
||||
warning("no new windows")
|
||||
except Exception as e:
|
||||
warning(f"no new windows {format_error(e)}")
|
||||
driver.get("https://rewards.bing.com")
|
||||
driver.refresh()
|
||||
custom_sleep(3)
|
||||
|
||||
|
||||
# Find out which type of action to do
|
||||
def try_play(nom="inconnu"):
|
||||
def try_play(nom="unknown"):
|
||||
driver = config.WebDriver.driver
|
||||
rgpd_popup(config)
|
||||
|
||||
|
@ -341,7 +345,7 @@ def try_play(nom="inconnu"):
|
|||
|
||||
elif "rqQuestionState" in driver.page_source:
|
||||
number = driver.page_source.count("rqAnswerOption")
|
||||
warning(f"recovery détecté. quiz : {number}")
|
||||
warning(f"recovery detected. quiz : {number}")
|
||||
play(number - 1)
|
||||
|
||||
else:
|
||||
|
@ -505,15 +509,15 @@ def fidelity():
|
|||
try:
|
||||
button_text = search('<span class="pull-left margin-right-15">([^<^>]+)</span>',
|
||||
card_elem.get_attribute("innerHTML"))[1]
|
||||
bouton_card = driver.find_element(By.XPATH, f'//span[text()="{button_text}"]')
|
||||
bouton_card.click()
|
||||
button_card = driver.find_element(By.XPATH, f'//span[text()="{button_text}"]')
|
||||
button_card.click()
|
||||
except Exception as e1:
|
||||
try:
|
||||
recover_elem = driver.find_element(By.XPATH,
|
||||
'/html/body/div[1]/div[2]/main/div[2]/div[2]/div[7]/div[3]/div[1]/a')
|
||||
recover_elem.click()
|
||||
except Exception as e2:
|
||||
log_error(f"fidélité - double erreur - e1 : {format_error(e1)} - e2 {format_error(e2)}")
|
||||
log_error(f"Fidelity: Multiples error - e1 : {format_error(e1)} - e2 {format_error(e2)}")
|
||||
break
|
||||
custom_sleep(uniform(3, 5))
|
||||
driver.switch_to.window(driver.window_handles[2])
|
||||
|
@ -530,17 +534,16 @@ def fidelity():
|
|||
if driver.current_url != "https://rewards.bing.com":
|
||||
driver.get("https://rewards.bing.com")
|
||||
try:
|
||||
pause = driver.find_element(By.CSS_SELECTOR,
|
||||
f'[class="c-action-toggle c-glyph f-toggle glyph-pause"]') # mettre le truc en pause
|
||||
pause = driver.find_element(By.CSS_SELECTOR, f'[class="c-action-toggle c-glyph f-toggle glyph-pause"]')
|
||||
pause.click()
|
||||
except Exception as e:
|
||||
error(f"erreur lors du click de pause: probablement pas de cartes {e}")
|
||||
error(f"Error while clicking pause. Probably no cards. {e}")
|
||||
return "no cards"
|
||||
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
|
||||
nb_cartes = len(cartes)
|
||||
checked_list_all = driver.find_elements(By.CSS_SELECTOR, f'[ng-if="$ctrl.complete"]')
|
||||
for i in range(nb_cartes):
|
||||
cartes[i].click() # affiche la bonne carte
|
||||
cartes[i].click()
|
||||
checked_txt = checked_list_all[i].get_attribute("innerHTML")
|
||||
ok = checked_txt.count("StatusCircleOuter checkmark")
|
||||
total = checked_txt.count("StatusCircleOuter")
|
||||
|
@ -753,6 +756,7 @@ def log_error(msg):
|
|||
|
||||
|
||||
def check_updated():
|
||||
debug(f"updated: {config.has_been_updated()}")
|
||||
if config.has_been_updated():
|
||||
config.discord.wh.send(f"Updated to {config.version}", username="update",
|
||||
avatar_url="https://cdn-icons-png.flaticon.com/512/1688/1688988.png")
|
||||
|
|
Loading…
Reference in New Issue