Yoruio / Membarr

Discord Bot to invite a user to a Plex or Jellyfin server
GNU General Public License v3.0
70 stars 15 forks source link

HTTPException: 400 Bad Request (error code: 40060): Interaction has already been acknowledged. #34

Open fitur opened 1 year ago

fitur commented 1 year ago

I get this error message each time the bot runs a requests towards the Discord server. I've kicked the bot after migrating from Invitarr, set OAuth URL generator settings to use the bot and application.commands options and set the bot permissions to Administrator.

[2022-11-21 14:52:51] [ERROR ] discord.app_commands.tree: Ignoring exception in command 'remove' Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 850, in _do_call return await self._callback(self.binding, interaction, **params) # type: ignore File "/app/app/bot/cogs/app.py", line 374, in plexremove await self.removefromplex(email, interaction.response) File "/app/app/bot/cogs/app.py", line 223, in removefromplex await embederror(response, 'There was an error removing this email address. Check logs.') File "/app/app/bot/helper/message.py", line 6, in embederror await send_embed(recipient, embed, ephemeral) File "/app/app/bot/helper/message.py", line 28, in send_embed await recipient.send_message(embed=embed, ephemeral = ephemeral) File "/usr/local/lib/python3.9/site-packages/discord/interactions.py", line 718, in send_message await adapter.create_interactionresponse( File "/usr/local/lib/python3.9/site-packages/discord/webhook/async.py", line 221, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 40060): Interaction has already been acknowledged.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 1240, in _call await command._invoke_with_namespace(interaction, namespace) File "/usr/local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 876, in _invoke_with_namespace return await self._do_call(interaction, transformed_values) File "/usr/local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 869, in _do_call raise CommandInvokeError(self, e) from e discord.app_commands.errors.CommandInvokeError: Command 'remove' raised an exception: HTTPException: 400 Bad Request (error code: 40060): Interaction has already been acknowledged.

fitur commented 1 year ago

Sorry, just to clarify, I'm running the yoruio/membarr Docker image in Unraid.

Yoruio commented 1 year ago

Is there any chance you're running another instance of the bot? It seems like either the command is already being responded to somewhere else in the bot, or another bot is responding to the command.

From a brief look, I couldn't see any reason a single instance would respond twice. Will keep looking into this. Please update the issue if it gets resolved.

fitur commented 1 year ago

Yes, I do have Plex Discord Role Management and Requestrr connected to the same bot. Would that be what is causing issues? Every time someone joins the server and the bot runs its jobs, the commands stop working and I've never seen that happen in Invitarr that uses the old command function.

Yoruio commented 1 year ago

You should probably be running the different bots as seperate discord bot accounts. Slash commands need their commands to be synced with the server, and each time one bit syncs with the server, it unsyncs the other bots commands.

This wouldn't have been an issue with the old command system, as the bots were essentially just responding to messages, so it was not an issue of multiple bots were reading and responding to the same messages.

Try giving membarr its own bot account, and let me know if that fixes it! On Nov. 24, 2022, 11:43 PM -0800, Peter Olausson @.***>, wrote:

Yes, I do have Plex Discord Role Management and Requestrr connected to the same bot. Would that be what is causing issues? Every time someone joins the server and the bot runs its jobs, the commands stop working and I've never seen that happen in Invitarr that uses the old command function. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>