From 7d1d5398d568fa9bfffbf6a7c15c5434e405b99f Mon Sep 17 00:00:00 2001 From: Kamal Curi Date: Tue, 23 Jan 2024 23:48:39 -0300 Subject: [PATCH] ADD: In case teh SQL server drops the connection with the client, the bot tries again, now on a reopened connection --- utils/commands.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utils/commands.py b/utils/commands.py index d716387..fa54e46 100644 --- a/utils/commands.py +++ b/utils/commands.py @@ -6,6 +6,8 @@ import os import json from datetime import datetime, timedelta +from time import sleep + from random import randrange from discord import Embed, Intents @@ -89,7 +91,11 @@ async def quote(bot: object, *quote: str) -> str: if ex.args[0].find("Duplicate") != -1: return await bot.send("There's already a quote from that same person, with that "\ "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: global stack_limit stack_limit = int((count_quotes() * .25))