Skip to content

Commit

Permalink
Merge pull request #217 from SylteA/feature/app-commands/submit-fix
Browse files Browse the repository at this point in the history
Fix submit command
  • Loading branch information
SylteA authored Jul 17, 2023
2 parents f5c9cfd + 62b7def commit d6ecfa8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bot/extensions/challenges/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ async def submit(self, interaction: core.InteractionType, attachment: discord.At
"File extension must be between 1 and 4 characters.", ephemeral=True
)

await interaction.response.defer(ephemeral=True, thinking=True)

code = (await attachment.read()).decode("u8")
log.info(len(code) == attachment.size)

Expand All @@ -222,7 +224,7 @@ async def submit(self, interaction: core.InteractionType, attachment: discord.At
max_user_length = 4096 - len(filetype) - 7
msg = f"Your submission can't be __more than {max_user_length} characters__."

return await interaction.response.send_message(msg, ephemeral=True)
return await interaction.followup.send(msg, ephemeral=True)

await interaction.user.add_roles(self.submitted_role)

Expand All @@ -233,4 +235,4 @@ async def submit(self, interaction: core.InteractionType, attachment: discord.At

embed.set_author(name="Your submission", icon_url=interaction.user.display_avatar.url)
embed.set_footer(text=f"{len(code)} chars • Language: {filetype}")
return await interaction.response.send_message(embed=embed, ephemeral=True)
return await interaction.followup.send(embed=embed, ephemeral=True)

0 comments on commit d6ecfa8

Please sign in to comment.