Check escaped message length before mocking it

pull/156/head
stijndcl 2022-11-21 22:49:23 +01:00
parent accda93461
commit 6c8ab9a2a0
1 changed files with 3 additions and 3 deletions

View File

@ -150,13 +150,13 @@ class Fun(commands.Cog):
if len(message) > constants.Limits.MESSAGE_LENGTH:
return await interaction.followup.send("That message is too long.")
mocked_message = mock(discord.utils.escape_markdown(message))
message = discord.utils.escape_markdown(message)
# Escaping md syntax can make the message longer than the limit
if len(mocked_message) > constants.Limits.MESSAGE_LENGTH:
if len(message) > constants.Limits.MESSAGE_LENGTH:
return await interaction.followup.send("Because of Markdown syntax escaping, that message is too long.")
return await interaction.followup.send(mocked_message)
return await interaction.followup.send(mock(message))
@commands.hybrid_command(name="xkcd")
@app_commands.rename(comic_id="id")