Correction sur la gestion du paste pour que le bot ne plante pas.
This commit is contained in:
parent
59a1a79c82
commit
25f5c9ecb7
@ -62,12 +62,24 @@ class FinishReview:
|
||||
# On copie ce texte sur un pad
|
||||
pastebin_url = ""
|
||||
if bot.settings.PASTEBIN_URL != "":
|
||||
result = privatebinapi.send(
|
||||
bot.settings.PASTEBIN_URL,
|
||||
text=report,
|
||||
expiration=bot.settings.PASTEBIN_EXPIRATION,
|
||||
)
|
||||
pastebin_url = result["full_url"]
|
||||
try:
|
||||
result = privatebinapi.send(
|
||||
bot.settings.PASTEBIN_URL,
|
||||
text=report,
|
||||
expiration=bot.settings.PASTEBIN_EXPIRATION,
|
||||
)
|
||||
except:
|
||||
# En cas d'erreur, on re-essaye une fois après un temps d'attente
|
||||
time.sleep(int(bot.settings.PASTEBIN_WAIT))
|
||||
result = privatebinapi.send(
|
||||
bot.settings.PASTEBIN_URL,
|
||||
text=report,
|
||||
expiration=bot.settings.PASTEBIN_EXPIRATION,
|
||||
)
|
||||
try:
|
||||
pastebin_url = result["full_url"]
|
||||
except:
|
||||
bot.send(channel, "Erreur sur le pastebin.")
|
||||
|
||||
# On sauve le texte dans un fichier
|
||||
review_file = (
|
||||
|
@ -27,9 +27,10 @@ REVIEW_DIRECTORY = os.environ.get("REVIEW_DIRECTORY", os.path.join(BASE_DIR, "re
|
||||
REVIEW_STATS = os.environ.get("REVIEW_STATS", os.path.join(REVIEW_DIRECTORY, "reviewstats.csv"))
|
||||
|
||||
# Pastebin
|
||||
PASTEBIN_URL = "https://paste.chapril.org/"
|
||||
PASTEBIN_URL = os.environ.get("PASTEBIN_URL", "https://paste.chapril.org/")
|
||||
PASTEBIN_WAIT = int(os.environ.get("PASTEBIN_WAIT", 5))
|
||||
# Values : 5min, 10min, 1hour, 1day, 1week, 1month, 1year, never
|
||||
PASTEBIN_EXPIRATION = "1week"
|
||||
PASTEBIN_EXPIRATION = os.environ.get("PASTEBIN_EXPIRATION", "1week")
|
||||
|
||||
# Scheduler
|
||||
REVIEW_REMINDERS = [(11, 30), (11, 45), (11, 55)]
|
||||
|
Loading…
Reference in New Issue
Block a user