From 86b01d29a7d6f4b56d461037154bc95edd26dd73 Mon Sep 17 00:00:00 2001 From: Kamal Curi Date: Tue, 14 Jan 2025 11:01:39 -0300 Subject: [PATCH] FIX: Auto-reconnect after connection lost on '--rq' --- motd | 2 +- utils/commands.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/motd b/motd index 4763ad5..a974ffd 100644 --- a/motd +++ b/motd @@ -5,7 +5,7 @@ █ ▄ █ ▄▄▄█ ▄▄▄█ ▄ ██ █▄▄▄█ ▄▄▄█ █ █ █ █ █▄▄▄█ █▄▄▄█ █▄█ █ █ █▄▄▄ █▄█ █▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█ -Neeble version: 2024.01.25 +Neeble version: 2025.01.14 Help with the development of neeble-bot in https://brejela.club/gitea/neeble-club/neeble Thank you! diff --git a/utils/commands.py b/utils/commands.py index 6bbdf0d..db847f5 100644 --- a/utils/commands.py +++ b/utils/commands.py @@ -144,7 +144,13 @@ async def random_quote(bot: object) -> str: global last_rq global last_rqer global rq_abusers - chosen_one = get_quotes(quote_id_stack) + try: + chosen_one = get_quotes(quote_id_stack) + except Exception as ex: + if ex.args[0].find("Lost") != -1: + await bot.send("SQL did an oopsie! Trying again...") + sleep(2) + chosen_one = get_quotes(quote_id_stack) stack_len = len(quote_id_stack) # The next two IF statements are meant to deal with `--rq` abuse @@ -430,6 +436,8 @@ async def weather(bot: object, *location: str) -> str: value=f'{msg.wind_speed} m/s' if msg.wind_speed else default_msg, ) + embed.set_footer(text="Provided by Openweather.org") + return await bot.send('**`Weather`**', embed=embed)