Don't crash if message > 2000 characters

This commit is contained in:
git-bruh 2020-11-29 15:30:20 +05:30
parent 5d62e3ade2
commit f29684c091
No known key found for this signature in database
GPG key ID: E1475C50075ADCE6

View file

@ -141,10 +141,13 @@ async def webhook_send(author, avatar, message, event_id):
hook = await channel.create_webhook(name=hook_name)
# 'wait=True' allows us to store the sent message
hook = await hook.send(username=author, avatar_url=avatar, content=message,
wait=True)
try:
hook = await hook.send(username=author, avatar_url=avatar,
content=message, wait=True)
message_cache[event_id] = hook
except discord.errors.HTTPException:
logging.info(f"Failed to send message {event_id} "
"longer than 2000 characters.")
async def create_matrix_client():