commit
72e42f5991
15
README.md
15
README.md
@ -2,8 +2,19 @@
|
||||
|
||||
|
||||
A Microsoft reward automator, designed to work headless on a raspberry pi. Tested with a pi 3b+ and a pi 4 2Gb .
|
||||
Using a discord bot to log eveything.
|
||||
Using a discord webhook to log everything.
|
||||
Using Selenium and geckodriver.
|
||||
You have to create a file named config, containing the following :
|
||||
```
|
||||
[DEFAULT]
|
||||
motpath = # Path to liste.txt file
|
||||
logpath = # Path to login.csv file
|
||||
successlink = # Link of the webhook to log success
|
||||
errorlink = # Link of the webhook to log errors
|
||||
|
||||
embeds = True # Send embeds instead of text
|
||||
Headless = True # Run Headless
|
||||
Log = False # Show Logs
|
||||
```
|
||||
you have to put your credentials in the same folder as the script, in a file named `login.csv`. You have to put info this way : `email,password`
|
||||
you have to put two discord webhook links, the first one for success and the second one for failure, separated with a coma, in the same folder as the script, in a file named `webhook.txt`
|
||||
you have to put a list with a dictionnary in the same folder as the script, in a file named `liste.txt` .It should have a lot of words, used to make random search on bing, as shown in the example file.
|
||||
|
43
V4.py
43
V4.py
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
import asyncio
|
||||
import configparser
|
||||
import os
|
||||
from csv import reader
|
||||
from os import path, sys, system
|
||||
@ -20,34 +21,28 @@ from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
|
||||
main = True
|
||||
Headless = True
|
||||
Log = False
|
||||
SucessEmbed = False
|
||||
|
||||
|
||||
IsLinux = platform == "linux"
|
||||
print("Linux : "+ str(IsLinux))
|
||||
|
||||
config_path = "./config"
|
||||
config = configparser.ConfigParser()
|
||||
config.read(config_path)
|
||||
|
||||
MotPath = config["DEFAULT"]["motpath"]
|
||||
LogPath = config["DEFAULT"]["logpath"]
|
||||
SuccessLink = config["DEFAULT"]["successlink"]
|
||||
ErrorLink = config["DEFAULT"]["errorlink"]
|
||||
|
||||
|
||||
if IsLinux :
|
||||
MotPath = "/home/pi/MsReward/liste.txt"
|
||||
LogPath= "/home/pi/MsReward/login.csv"
|
||||
WebHookPath = "/home/pi/MsReward/webhook.txt"
|
||||
else :
|
||||
MotPath = resource_path('D:\Documents\Dev\MsReward\liste/liste.txt')
|
||||
LogPath = resource_path('D:\Documents\Dev\MsReward\login/login.csv')
|
||||
WebHookPath = resource_path('D:\Documents\Dev\MsReward/token/webhook.txt')
|
||||
system("")
|
||||
embeds = config["DEFAULT"]["embeds"] == "True"
|
||||
Headless = config["DEFAULT"]["headless"] == "True"
|
||||
Log = config["DEFAULT"]["log"] == "True"
|
||||
|
||||
|
||||
g = open(MotPath, "r" , encoding="utf-8")
|
||||
Liste_de_mot=(list(g.readline().split(',')))
|
||||
g.close()
|
||||
g = open(WebHookPath,"r")
|
||||
SuccessLink, ErrorLink = g.readline().split(',')
|
||||
g.close
|
||||
|
||||
webhookSuccess = Webhook.from_url(SuccessLink, adapter=RequestsWebhookAdapter())
|
||||
webhookFailure = Webhook.from_url(ErrorLink, adapter=RequestsWebhookAdapter())
|
||||
@ -142,6 +137,7 @@ def LogError(message,log = Log, Mobdriver = None):
|
||||
|
||||
gdriver.save_screenshot("screenshot.png")
|
||||
|
||||
if embeds :
|
||||
embed = discord.Embed(
|
||||
title="An Error has occured",
|
||||
description=str(message),
|
||||
@ -153,6 +149,14 @@ def LogError(message,log = Log, Mobdriver = None):
|
||||
embed.set_footer(text=_mail)
|
||||
webhookFailure.send(embed=embed, file=file)
|
||||
webhookFailure.send(file=discord.File('page.html'))
|
||||
else :
|
||||
webhookFailure.send(content="------------------------------------\n" + _mail)
|
||||
webhookFailure.send(ListTabs(Mdriver=Mobdriver))
|
||||
webhookFailure.send(str(message))
|
||||
CustomSleep(1)
|
||||
webhookFailure.send(file=discord.File('screenshot.png'))
|
||||
webhookFailure.send(file=discord.File('page.html'))
|
||||
webhookFailure.send("------------------------------------")
|
||||
|
||||
|
||||
def progressBar(current, total=30, barLength = 20, name ="Progress"):
|
||||
@ -660,15 +664,16 @@ def LogPoint(account="unknown"): #log des points sur discord
|
||||
CustomSleep(uniform(3,20))
|
||||
|
||||
account = account.split('@')[0]
|
||||
if SucessEmbed :
|
||||
|
||||
if embeds:
|
||||
embed = discord.Embed(
|
||||
title=f"{account} actuellement à {str(point)} points",
|
||||
colour = Colour.green()
|
||||
)
|
||||
embed.set_footer(text=_mail)
|
||||
embed.set_footer(text=account)
|
||||
webhookSuccess.send(embed=embed)
|
||||
else :
|
||||
webhookSuccess.send(_mail + "actuellement à" +str(point) + "points")
|
||||
webhookSuccess.send(f'{account} actuellement à {str(point)} points')
|
||||
|
||||
|
||||
def Fidelité():
|
||||
|
Loading…
Reference in New Issue
Block a user