Check for an existing webhook made by the bot first.

Otherwise, it'd create a new one and in case of failures or database corruptions,
you'd hit the webhook limit quickly.

This was a feature pre-rewrite but got lost in translation.
This commit is contained in:
Ske 2018-11-30 20:39:10 +01:00
parent 10746ae807
commit 4337430823
2 changed files with 18 additions and 6 deletions

View file

@ -79,7 +79,7 @@ def run():
return
# Second pass: do proxy matching
await proxy.try_proxy_message(conn, message, logger)
await proxy.try_proxy_message(conn, message, logger, client.user)
@client.event
async def on_raw_message_delete(payload: discord.RawMessageDeleteEvent):
@ -127,6 +127,9 @@ def run():
traceback_str = "```python\n...{}```".format(traceback.format_exc()[- (2000 - len("```python\n...```")):])
await log_channel.send(content=traceback_str, embed=embed)
# Print it to stderr anyway, though
logging.getLogger("pluralkit").exception("Exception while handling event {}".format(event_name))
bot_token = os.environ["TOKEN"]
if not bot_token:
print("No token specified. Please pass a valid Discord bot token in the TOKEN environment variable.",