From a7ce5bdb404ba44d490204eaf7001db1c58ae69c Mon Sep 17 00:00:00 2001 From: Tristan Gosselin-Hane Date: Sun, 18 Nov 2018 13:47:02 -0500 Subject: [PATCH 1/2] Clear the list of webhooks when the bot reconnects to discord --- webhook-bridge.py | 1 + 1 file changed, 1 insertion(+) diff --git a/webhook-bridge.py b/webhook-bridge.py index 4d6f334..fad5662 100755 --- a/webhook-bridge.py +++ b/webhook-bridge.py @@ -397,6 +397,7 @@ def main(): for webhook in channel_webhooks: if webhook.name == "_minecraft": global WEBHOOKS + WEBHOOKS = [] WEBHOOKS.append(webhook.url) found = True logging.debug("Found webhook {} in channel {}".format(webhook.name, discord_channel.name)) From 1b41821bdeeb049419cefeb163cc0097d2605e1f Mon Sep 17 00:00:00 2001 From: Tristan Gosselin-Hane Date: Sun, 18 Nov 2018 13:57:26 -0500 Subject: [PATCH 2/2] Clear the list at the beginning of the reconnection --- webhook-bridge.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webhook-bridge.py b/webhook-bridge.py index fad5662..a007b0c 100755 --- a/webhook-bridge.py +++ b/webhook-bridge.py @@ -386,6 +386,8 @@ def main(): @discord_bot.event async def on_ready(): logging.info("Discord bot logged in as {} ({})".format(discord_bot.user.name, discord_bot.user.id)) + global WEBHOOKS + WEBHOOKS = [] session = database_session.get_session() channels = session.query(DiscordChannel).all() session.close() @@ -396,8 +398,6 @@ def main(): found = False for webhook in channel_webhooks: if webhook.name == "_minecraft": - global WEBHOOKS - WEBHOOKS = [] WEBHOOKS.append(webhook.url) found = True logging.debug("Found webhook {} in channel {}".format(webhook.name, discord_channel.name))