why im getting this error Task exception was never retrieved future: <Task finished…
- User
why im getting this error Task exception was never retrieved future: <Task finished name='discord-ui-view-timeout-d4d17bb8dae65154cdd23582ec57e38b' coro=<Button2.on_timeout() done, defined at /home/container/src/discord/bypass_button.py:42> exception=InteractionResponded('This interaction has already been responded to before')> Traceback (most recent call last): File "/home/container/src/discord/bypass_button.py", line 43, in on_timeout await self.interaction.response.defer() File "/home/container/.local/lib/python3.11/site-packages/discord/interactions.py", line 639, in defer raise InteractionResponded(self._parent) discord.errors.InteractionResponded: This interaction has already been responded to before
in this code
class Button2(View): def init(self, bot, interaction, link, user_id, *args, **kwargs): super().init(*args, **kwargs, timeout=60) self.bot = bot self.interaction = interaction self.link_url = link self.user_id = user_id
@discord.ui.button(label="Bypass link", emoji="<:check:1157813295324069908>", style=discord.ButtonStyle.success, custom_id="prev") async def prev_button2(self, interaction: discord.Interaction, button: discord.ui.Button): if interaction.user.id != self.user_id: await interaction.response.send_message("You cannot use this button.", ephemeral=True) return try: await interaction.response.defer() embed = discord.Embed(title="<a:loading:1155221326420779042> Bypassing your link...", color=discord.Color.blurple()) await interaction.edit_original_response(embed=embed) await bypasser.bypass(self.bot, interaction, self.link_url) except Exception as e: traceback.print_exc() async def on_timeout(self): await self.interaction.response.defer() for child in self.children: if isinstance(child, Button): child.disabled = True child.style = discord.ButtonStyle.secondary await self.interaction.edit_original_response(view=self) - Assistant
- User
this is not working anymore, the on timeout is not doing anything anymore
class Button2(View): def init(self, bot, interaction, link, user_id, *args, **kwargs): super().init(*args, **kwargs, timeout=60) self.bot = bot self.interaction = interaction self.link_url = link self.user_id = user_id
@discord.ui.button(label="Bypass link", emoji="<:check:1157813295324069908>", style=discord.ButtonStyle.success, custom_id="prev") async def prev_button2(self, interaction: discord.Interaction, button: discord.ui.Button): if interaction.user.id != self.user_id: await interaction.response.send_message("You cannot use this button.", ephemeral=True) return try: await interaction.response.defer() embed = discord.Embed(title="<a:loading:1155221326420779042> Bypassing your link...", color=discord.Color.blurple()) await interaction.edit_original_response(embed=embed) await bypasser.bypass(self.bot, interaction, self.link_url) except Exception as e: traceback.print_exc() async def on_timeout(self): try: for child in self.children: if isinstance(child, Button): child.disabled = True child.style = discord.ButtonStyle.secondary await self.interaction.edit_original_response(view=self) except Exception: traceback.print_exec() - Assistant