Don't crash if message > 2000 characters
This commit is contained in:
parent
5d62e3ade2
commit
f29684c091
1 changed files with 7 additions and 4 deletions
9
main.py
9
main.py
|
@ -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():
|
||||
|
|
Loading…
Reference in a new issue