ADD: In case teh SQL server drops the connection with the client, the bot tries again, now on a reopened connection

develop
Kamal Curi 1 year ago
parent f43520e51d
commit 7d1d5398d5

@ -6,6 +6,8 @@ import os
import json import json
from datetime import datetime, timedelta from datetime import datetime, timedelta
from time import sleep
from random import randrange from random import randrange
from discord import Embed, Intents from discord import Embed, Intents
@ -89,7 +91,11 @@ async def quote(bot: object, *quote: str) -> str:
if ex.args[0].find("Duplicate") != -1: if ex.args[0].find("Duplicate") != -1:
return await bot.send("There's already a quote from that same person, with that "\ return await bot.send("There's already a quote from that same person, with that "\
"exact match!") "exact match!")
return await bot.send(f'{ex.args}\n_What the fuck are you doing?_') elif ex.args[0].find("Lost") != -1:
await bot.send("SQL did an oopsie! Trying again...")
sleep(2)
qtid = set_quote(user, quote, date, "#nograb")
return await bot.send(f'{ex.args}\n_What the fuck are you doing?_')
else: else:
global stack_limit global stack_limit
stack_limit = int((count_quotes() * .25)) stack_limit = int((count_quotes() * .25))

Loading…
Cancel
Save