diff --git a/src/heihachi/bot.py b/src/heihachi/bot.py index eeab210..05a6e6e 100644 --- a/src/heihachi/bot.py +++ b/src/heihachi/bot.py @@ -1,3 +1,4 @@ +import asyncio import datetime import logging import traceback @@ -58,7 +59,10 @@ async def command(interaction: discord.Interaction, move: str) -> None: if not (self._is_user_blacklisted(str(interaction.user.id)) or self._is_author_newly_created(interaction)): logger.info(f"Received character command from {interaction.user.name} in {interaction.guild}: /fd {name} {move}") embed = get_frame_data_embed(self.framedb, self.frame_service, name, move) - await interaction.response.send_message(embed=embed, ephemeral=False) + + await interaction.response.defer() + await asyncio.sleep(0) + await interaction.followup.send(embed=embed, ephemeral=False) return command @@ -121,7 +125,11 @@ async def _frame_data_cmd(interaction: discord.Interaction, character: str, move move_query = move if not (self._is_user_blacklisted(str(interaction.user.id)) or self._is_author_newly_created(interaction)): embed = get_frame_data_embed(self.framedb, self.frame_service, character_name_query, move_query) - await interaction.response.send_message(embed=embed, ephemeral=False) + + await interaction.response.defer() + await asyncio.sleep(0) + await interaction.followup.send(embed=embed, ephemeral=False) + if self.config.feedback_channel_id and self.config.action_channel_id: @@ -152,7 +160,9 @@ async def _feedback_cmd(interaction: discord.Interaction, message: str) -> None: except Exception as e: result = embed.get_error_embed(f"Feedback couldn't be sent, caused by: {traceback.format_exc()}") - await interaction.response.send_message(embed=result, ephemeral=False) + await interaction.response.defer() + await asyncio.sleep(0) + await interaction.followup.send(embed=result, ephemeral=False) else: logger.warning("Feedback or Action channel ID is not set. Disabling feedback command.") @@ -161,4 +171,6 @@ async def _help_command(interaction: discord.Interaction) -> None: logger.info(f"Received command from {interaction.user.name} in {interaction.guild}: /help") if not (self._is_user_blacklisted(str(interaction.user.id)) or self._is_author_newly_created(interaction)): help_embed = embed.get_help_embed(self.frame_service) - await interaction.response.send_message(embed=help_embed, ephemeral=True) + await interaction.response.defer() + await asyncio.sleep(0) + await interaction.followup.send(embed=help_embed, ephemeral=False)