Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can`t delete or modify ephemeral message after Interaction error 10008 Unknown Message #2889

Open
3 tasks done
NnN6574 opened this issue Mar 21, 2024 · 2 comments
Open
3 tasks done
Labels
Needs investigation Needs to be looked at by a maintainer

Comments

@NnN6574
Copy link

NnN6574 commented Mar 21, 2024

Check The Docs

  • I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • I verified the issue was caused by Discord.Net.

Check your intents

  • I double checked that I have the required intents.

Description

Шn the event handler of the message components сan`t delete or modify ephemeral message after Interaction error 10008 Unknown Message

Version

ex. 3.14.1

Working Version

No response

Logs

info: Discord.Addons.Hosting.Services.DiscordHostedService[0]
      Discord.NET hosted service is starting
info: Discord.WebSocket.DiscordSocketClient[0]
      Discord: Discord.Net v3.14.1 (API v10)
info: Discord.Addons.Hosting.Services.CommandServiceRegistrationHost[0]
      Registered logger for CommandService
info: Discord.Addons.Hosting.Services.InteractionServiceRegistrationHost[0]
      Registered logger for InteractionService
info: Discord.WebSocket.DiscordSocketClient[0]
      Gateway: Connecting
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: D:\Projects\DarkBotv2\bin\Debug\net8.0
[General/Verbose] 22:17:21 Rest        GET gateway/bot: 519,1 ms
[General/Debug] 22:17:21 Gateway     Received Hello
[General/Debug] 22:17:21 Gateway     Heartbeat Started
[General/Debug] 22:17:21 Gateway     Identifying
[General/Debug] 22:17:21 Gateway     Sent Heartbeat
[General/Debug] 22:17:21 Gateway     Sent Identify
[General/Debug] 22:17:21 Gateway     Received HeartbeatAck
[General/Debug] 22:17:21 Gateway     Latency = 203 ms
[General/Debug] 22:17:22 Gateway     Received Dispatch (READY)
[General/Debug] 22:17:22 Gateway     GuildDownloader Started
warn: Discord.WebSocket.DiscordSocketClient[0]
      Gateway: You're using the GuildPresences intent without listening to the PresenceUpdate event, consider removing the intent from your config.
[General/Warning] 22:17:22 Gateway     You're using the GuildPresences intent without listening to the PresenceUpdate event, consider removing the intent from your config.
warn: Discord.WebSocket.DiscordSocketClient[0]
      Gateway: You're using the GuildScheduledEvents gateway intent without listening to any events related to that intent, consider removing the intent from your config.
[General/Warning] 22:17:22 Gateway     You're using the GuildScheduledEvents gateway intent without listening to any events related to that intent, consider removing the intent from your config.
warn: Discord.WebSocket.DiscordSocketClient[0]
      Gateway: You're using the GuildInvites gateway intent without listening to any events related to that intent, consider removing the intent from your config.
[General/Warning] 22:17:22 Gateway     You're using the GuildInvites gateway intent without listening to any events related to that intent, consider removing the intent from your config.
info: Discord.WebSocket.DiscordSocketClient[0]
      Gateway: Connected
[General/Info] 22:17:22 Gateway     Connected
[General/Debug] 22:17:22 Gateway     Raising Event
[General/Debug] 22:17:22 Gateway     Received Dispatch (GUILD_AVAILABLE)
[General/Verbose] 22:17:22 Gateway     Connected to АЗС #1  World RP
[General/Debug] 22:17:22 Gateway     GuildDownloader Stopped
info: Discord.WebSocket.DiscordSocketClient[0]
      Gateway: Ready
[General/Info] 22:17:22 Gateway     Ready
[General/Verbose] 22:17:23 Rest        PUT applications/1219611352549818439/commands: 421,48 ms
[General/Debug] 22:17:33 Gateway     Received Dispatch (INTERACTION_CREATE)
ApplicationCommand
[General/Verbose] 22:17:33 Rest        POST interactions/1220451261128900719/aW50ZXJhY3Rpb246MTIyMDQ1MTI2MTEyODkwMDcxOTp3eDJ5dmNVZEZXR0xoVFduZHBzSlJBOXFtOWpxa1Z4SjhZd0FBTUJiWUdZT0ZEdmJQYVhZTVFrNjE3WUJYQXo3SHZ4TVZhcWx5U1VscEJRV3pkTTh1elJaQTdPVjZsMzBiVDVIaDNUMGVKMjJOQTFEZzhTaEdUb0taalNOc3lWSQ/callback: 330,3 ms
after RespondAsync
Name: dark_one_frome_three Id: 1220071058070306836
[General/Debug] 22:17:33 Gateway     Received Dispatch (MESSAGE_CREATE)
[General/Debug] 22:17:42 Gateway     Received Dispatch (INTERACTION_CREATE)
MessageComponent
1220451262579871794
warn: Discord.WebSocket.DiscordSocketClient[0]
      Gateway: A ButtonExecuted handler has thrown an unhandled exception.
      Discord.Net.HttpException: The server responded with error 10008: Unknown Message
         at Discord.Net.Queue.RequestBucket.SendAsync(RestRequest request)
         at Discord.Net.Queue.RequestQueue.SendAsync(RestRequest request)
         at Discord.API.DiscordRestApiClient.SendInternalAsync(String method, String endpoint, RestRequest request)
         at DarkBotv2.Services.GameInteractionHandler.ButtonExecuted(SocketMessageComponent component) in D:\Projects\DarkBotv2\Services\GameInteractionHandler.cs:line 78
         at Discord.EventExtensions.InvokeAsync[T](AsyncEvent`1 eventHandler, T arg)
         at Discord.WebSocket.DiscordSocketClient.TimeoutWrap(String name, Func`1 action)
[General/Warning] 22:17:42 Gateway     A ButtonExecuted handler has thrown an unhandled exception.:
Discord.Net.HttpException: The server responded with error 10008: Unknown Message
   at Discord.Net.Queue.RequestBucket.SendAsync(RestRequest request)
   at Discord.Net.Queue.RequestQueue.SendAsync(RestRequest request)
   at Discord.API.DiscordRestApiClient.SendInternalAsync(String method, String endpoint, RestRequest request)
   at DarkBotv2.Services.GameInteractionHandler.ButtonExecuted(SocketMessageComponent component) in D:\Projects\DarkBotv2\Services\GameInteractionHandler.cs:line 78
   at Discord.EventExtensions.InvokeAsync[T](AsyncEvent`1 eventHandler, T arg)
   at Discord.WebSocket.DiscordSocketClient.TimeoutWrap(String name, Func`1 action)
Removed: 339654874142867456
[General/Debug] 22:17:58 Gateway     Received Dispatch (PRESENCE_UPDATE)
[General/Debug] 22:17:58 Gateway     Sent Heartbeat
[General/Debug] 22:17:59 Gateway     Received HeartbeatAck
[General/Debug] 22:17:59 Gateway     Latency = 156 ms

Sample

private async Task StartOneFromThreeGame(SocketSlashCommand command)
{
   var builder = new ComponentBuilder();
   for (int i = 0; i < numbers.Count; i++)
   {
      builder.WithButton($"{numbers[i]}", $"OneFromThree_{i}", style: ButtonStyle.Secondary);
   }
   await command.RespondAsync("title", components: builder.Build(), ephemeral: true);
}
private async Task ButtonExecuted(SocketMessageComponent component)
{
   Console.WriteLine(component.Message.Id); // message id (1220444646094671953)

   var msg = component.Message;
   await msg.ModifyAsync(x => x.Content = "", (RequestOptions.Default)); //  10008 Unknown Message
   //await msg.DeleteAsync(RequestOptions.Default); //   10008 Unknown Message
} 

Packages

<PackageReference Include="Discord.Addons.Hosting" Version="6.0.0" />
<PackageReference Include="Discord.Addons.Interactive" Version="2.0.0" />
<PackageReference Include="Discord.Net" Version="3.14.1" />
<PackageReference Include="Microsoft.AspNet.SignalR.Core" Version="2.4.3" />
<PackageReference Include="MySql.Data" Version="8.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />

Environment

  • OS: Windows 10 Pro 22H2
  • Architecture: x64 (vps)
  • .Net: 8.0
@NnN6574 NnN6574 added the bug label Mar 21, 2024
@Misha-133
Copy link
Member

You can't use regular Modify/DeleteAsync methods on ephemeral interaction responses.
Use IMessageComponent.UpdateAsync of Modify/DeleteOriginalResponseAsync instead. Note that the two latter ones are followup methods and require the interaction to be already acknowledged (ex. with DeferAsync)

A docs page to help you understand interactions flow

@NnN6574
Copy link
Author

NnN6574 commented Mar 22, 2024

You can't use regular Modify/DeleteAsync methods on ephemeral interaction responses. Use IMessageComponent.UpdateAsync of Modify/DeleteOriginalResponseAsync instead. Note that the two latter ones are followup methods and require the interaction to be already acknowledged (ex. with DeferAsync)

A docs page to help you understand interactions flow

Thank you, I previously used the Modify/DeleteOriginalResponseAsync method but I did not specify its parameter RequestOptions which is why the error persisted. The default null value was creating an error for me

@Misha-133 Misha-133 removed the bug label Mar 22, 2024
@Misha-133 Misha-133 added the Needs investigation Needs to be looked at by a maintainer label May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs investigation Needs to be looked at by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants