improved log
This commit is contained in:
parent
9ff97a3611
commit
382ff72cf5
28
V4.py
28
V4.py
@ -138,13 +138,14 @@ def LogError(message,log = Log):
|
|||||||
channel = client.get_channel(861181899987484692)
|
channel = client.get_channel(861181899987484692)
|
||||||
if log :
|
if log :
|
||||||
channel = client.get_channel(833275838837030912) #channel de log
|
channel = client.get_channel(833275838837030912) #channel de log
|
||||||
await channel.send(_mail)
|
await channel.send("------------------------------------\n" + _mail)
|
||||||
|
|
||||||
await channel.send(ListTabs())
|
await channel.send(ListTabs())
|
||||||
await channel.send(str(message))
|
await channel.send(str(message))
|
||||||
CustomSleep(1)
|
CustomSleep(1)
|
||||||
await channel.send(file=discord.File('screenshot.png'))
|
await channel.send(file=discord.File('screenshot.png'))
|
||||||
await channel.send(file=discord.File('page.html'))
|
await channel.send(file=discord.File('page.html'))
|
||||||
|
await channel.send("------------------------------------")
|
||||||
await client.close()
|
await client.close()
|
||||||
|
|
||||||
|
|
||||||
@ -292,16 +293,17 @@ def PlayPoll():
|
|||||||
|
|
||||||
def AllCard(): #fonction qui repere le type de contenue et redireige sur la bonne fonction
|
def AllCard(): #fonction qui repere le type de contenue et redireige sur la bonne fonction
|
||||||
|
|
||||||
def reset(touch=False): #retourne sur la page de depart apres avoir finis
|
def reset(Partie2=False): #retourne sur la page de depart apres avoir finis
|
||||||
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 touch :
|
if Partie2 :
|
||||||
driver.find_element_by_xpath('/html/body/div/div/div[3]/div[2]/div[2]/div[2]/div[1]').click()
|
driver.find_element_by_xpath('/html/body/div/div/div[3]/div[2]/div[2]/div[2]/div[1]').click()
|
||||||
else :
|
else :
|
||||||
driver.switch_to.window(driver.window_handles[1])
|
driver.switch_to.window(driver.window_handles[1])
|
||||||
print(f"on ferme la fenetre {driver.current_url}")
|
print(f"on ferme la fenetre {driver.current_url}")
|
||||||
driver.close()
|
driver.close()
|
||||||
driver.switch_to.window(driver.window_handles[0])
|
driver.switch_to.window(driver.window_handles[0])
|
||||||
|
reset(Partie2)
|
||||||
|
|
||||||
def dailyCards():
|
def dailyCards():
|
||||||
try :
|
try :
|
||||||
@ -312,12 +314,14 @@ def AllCard(): #fonction qui repere le type de contenue et redireige sur la bonn
|
|||||||
TryPlay(driver.title)
|
TryPlay(driver.title)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
reset()
|
reset()
|
||||||
|
printf("carte {i} ok ")
|
||||||
except Exception as e :
|
except Exception as e :
|
||||||
LogError(f'erreur dans la premiere partie de AllCard (les daily card). cela arrive si on relance le proramme uen deuxieme fois sur le meme compte \n {e}')
|
LogError(f'erreur dans la premiere partie de AllCard (les daily card). cela arrive si on relance le proramme uen deuxieme fois sur le meme compte \n {e}')
|
||||||
|
|
||||||
dailyCards()
|
dailyCards()
|
||||||
|
|
||||||
try :
|
try :
|
||||||
|
|
||||||
try :
|
try :
|
||||||
driver.find_element_by_xpath('/html/body/div/div/div[3]/div[2]/div[2]/div[2]/div[1]').click() #declenche la premiere partie ?
|
driver.find_element_by_xpath('/html/body/div/div/div[3]/div[2]/div[2]/div[2]/div[1]').click() #declenche la premiere partie ?
|
||||||
except :
|
except :
|
||||||
@ -328,11 +332,18 @@ def AllCard(): #fonction qui repere le type de contenue et redireige sur la bonn
|
|||||||
pass
|
pass
|
||||||
c = 0
|
c = 0
|
||||||
while True:
|
while True:
|
||||||
|
printf("debut de l'une des cartes")
|
||||||
driver.find_element_by_xpath('/html/body/div/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/a/div/div[2]').click()
|
driver.find_element_by_xpath('/html/body/div/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/a/div/div[2]').click()
|
||||||
|
printf("carte cliqué")
|
||||||
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)
|
||||||
TryPlay(driver.title)
|
try :
|
||||||
|
titre = driver.title
|
||||||
|
except Exception as e :
|
||||||
|
titre = "inconnu"
|
||||||
|
LogError(f"impossible de recuperer le titre. {e}")
|
||||||
|
|
||||||
|
TryPlay(titre)
|
||||||
reset(True)
|
reset(True)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
c += 1
|
c += 1
|
||||||
@ -531,6 +542,7 @@ def BingMobileSearch(override = randint(20,25)):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
LogError(f"can't close mobile driveerr . {e}")
|
LogError(f"can't close mobile driveerr . {e}")
|
||||||
|
|
||||||
|
|
||||||
def TryPlay(nom ="inconnu"):
|
def TryPlay(nom ="inconnu"):
|
||||||
|
|
||||||
RGPD()
|
RGPD()
|
||||||
@ -588,7 +600,7 @@ def TryPlay(nom ="inconnu"):
|
|||||||
CustomSleep(uniform(3,5))
|
CustomSleep(uniform(3,5))
|
||||||
|
|
||||||
|
|
||||||
def LogPoint(account="unknown", log = False): #log des points sur discord
|
def LogPoint(account="unknown"): #log des points sur discord
|
||||||
driver.get('https://www.bing.com/rewardsapp/flyout')
|
driver.get('https://www.bing.com/rewardsapp/flyout')
|
||||||
if not IsLinux :
|
if not IsLinux :
|
||||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||||
@ -688,8 +700,8 @@ def DailyRoutine():
|
|||||||
|
|
||||||
try :
|
try :
|
||||||
LogPoint(_mail)
|
LogPoint(_mail)
|
||||||
except :
|
except Exception as e:
|
||||||
LogError('LogPoint')
|
LogError(f'LogPoint : {e}')
|
||||||
|
|
||||||
def close():
|
def close():
|
||||||
driver.quit()
|
driver.quit()
|
||||||
|
Loading…
Reference in New Issue
Block a user