oh, f*ck, what have I done

This commit is contained in:
piair
2023-03-18 19:12:27 +01:00
parent 27237354b2
commit 66de4dbbd2
4 changed files with 96 additions and 83 deletions

View File

@ -7,7 +7,9 @@ import argparse
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
RequestsWebhookAdapter,
Webhook,
Colour,
)
from time import time
from random import shuffle

View File

@ -2,10 +2,6 @@ from time import sleep
from datetime import timedelta, datetime
from random import uniform
import discord
from discord import ( # Importing discord.Webhook and discord.RequestsWebhookAdapter
Colour,
Webhook,
)
from selenium.webdriver.common.by import By
from modules.config import *
@ -23,35 +19,6 @@ def send_keys_wait(element, keys):
sleep(uniform(0.1, 0.3))
def log_error(error, driver, mail, log=FULL_LOG):
if type(error) != str :
error = format_error(error)
print(f"\n\n\033[93m Erreur : {str(error)} \033[0m\n\n")
if DISCORD_ENABLED_ERROR:
with open("page.html", "w") as f:
f.write(driver.page_source)
driver.save_screenshot("screenshot.png")
if not log:
embed = discord.Embed(
title="An Error has occured",
description=str(error),
colour=Colour.red(),
)
else:
embed = discord.Embed(
title="Full log is enabled",
description=str(error),
colour=Colour.blue(),
)
file = discord.File("screenshot.png")
embed.set_image(url="attachment://screenshot.png")
embed.set_footer(text=mail)
webhookFailure.send(embed=embed, file=file)
webhookFailure.send(file=discord.File("page.html"))
# add the time arround the text given in [text]&
def Timer(text: str, mail: str) -> str: