-
-
Notifications
You must be signed in to change notification settings - Fork 315
Open
Description
Summary
When a poll ends and the completion message is sent, if the winning vote in the completion message has a custom emoji, a System.Collections.Generic.KeyNotFoundException
is thrown ("Given emote was not found") while trying to parse the emoji
What version of the library are you using?
v5.0.0-nightly (make sure you are using the latest nightly!)
What .NET version are you using? Make sure to use the latest patch release for your major version.
.NET 9.0
Operating System
No response
Reproduction Steps
- Create a poll where at least one choice has a custom emoji
- Vote for any choice that has a custom emoji
- End the poll
- Observe exception
Trace Logs
[2025-09-29 10:21:14 -04:00] [Verbose] Length for the last inbound gateway event: 69
[2025-09-29 10:21:14 -04:00] [Verbose] Payload for the last inbound gateway event: "{\"t\":\"MESSAGE_POLL_VOTE_ADD\",\"s\":11,\"op\":0,\"d\":{\"user_id\":\"455432936339144705\",\"message_id\":\"1422226595929784471\",\"channel_id\":\"885928971068387352\",\"answer_id\":1,\"guild_id\":\"885928970137260093\"}}"
[2025-09-29 10:21:16 -04:00] [Verbose] Length for the last inbound gateway event: 336
[2025-09-29 10:21:16 -04:00] [Verbose] Payload for the last inbound gateway event: "{\"t\":\"MESSAGE_UPDATE\",\"s\":12,\"op\":0,\"d\":{\"type\":0,\"tts\":false,\"timestamp\":\"2025-09-29T14:20:44.162000+00:00\",\"position\":0,\"poll\":{\"question\":{\"text\":\"test poll\"},\"layout_type\":1,\"expiry\":\"2025-09-29T14:21:16.921079+00:00\",\"answers\":[{\"poll_media\":{\"text\":\"aaaaa\",\"emoji\":{\"name\":\"meowupsidedown\",\"id\":\"390962614840328192\"}},\"answer_id\":1},{\"poll_media\":{\"text\":\"bbbbb\",\"emoji\":{\"name\":\"meowdizzy\",\"id\":\"390261220491395073\"}},\"answer_id\":2}],\"allow_multiselect\":false},\"pinned\":false,\"mentions\":[],\"mention_roles\":[],\"mention_everyone\":false,\"member\":{\"roles\":[\"885928970183393345\",\"885928970183393347\",\"1196155537390321725\",\"1322642014486925333\",\"885928970162417709\"],\"premium_since\":null,\"pending\":false,\"nick\":null,\"mute\":false,\"joined_at\":\"2021-09-10T18:47:52.083000+00:00\",\"flags\":0,\"deaf\":false,\"communication_disabled_until\":null,\"banner\":null,\"avatar\":null},\"id\":\"1422226595929784471\",\"flags\":0,\"embeds\":[],\"edited_timestamp\":null,\"content\":\"\",\"components\":[],\"channel_type\":0,\"channel_id\":\"885928971068387352\",\"author\":{\"username\":\"floatingmilkshake\",\"public_flags\":4194560,\"primary_guild\":null,\"id\":\"455432936339144705\",\"global_name\":\"FloatingMilkshake\",\"display_name_styles\":null,\"discriminator\":\"0\",\"collectibles\":null,\"clan\":null,\"avatar_decoration_data\":null,\"avatar\":\"c668d339c1921da81a2c101b7c479390\"},\"attachments\":[],\"guild_id\":\"885928970137260093\"}}"
[2025-09-29 10:21:17 -04:00] [Verbose] Length for the last inbound gateway event: 86
[2025-09-29 10:21:17 -04:00] [Verbose] Payload for the last inbound gateway event: "{\"t\":\"MESSAGE_UPDATE\",\"s\":13,\"op\":0,\"d\":{\"type\":0,\"tts\":false,\"timestamp\":\"2025-09-29T14:20:44.162000+00:00\",\"position\":0,\"poll\":{\"results\":{\"is_finalized\":true,\"answer_counts\":[{\"me_voted\":false,\"id\":1,\"count\":1},{\"me_voted\":false,\"id\":2,\"count\":0}]},\"question\":{\"text\":\"test poll\"},\"layout_type\":1,\"expiry\":\"2025-09-29T14:21:16.921079+00:00\",\"answers\":[{\"poll_media\":{\"text\":\"aaaaa\",\"emoji\":{\"name\":\"meowupsidedown\",\"id\":\"390962614840328192\"}},\"answer_id\":1},{\"poll_media\":{\"text\":\"bbbbb\",\"emoji\":{\"name\":\"meowdizzy\",\"id\":\"390261220491395073\"}},\"answer_id\":2}],\"allow_multiselect\":false},\"pinned\":false,\"mentions\":[],\"mention_roles\":[],\"mention_everyone\":false,\"member\":{\"roles\":[\"885928970183393345\",\"885928970183393347\",\"1196155537390321725\",\"1322642014486925333\",\"885928970162417709\"],\"premium_since\":null,\"pending\":false,\"nick\":null,\"mute\":false,\"joined_at\":\"2021-09-10T18:47:52.083000+00:00\",\"flags\":0,\"deaf\":false,\"communication_disabled_until\":null,\"banner\":null,\"avatar\":null},\"id\":\"1422226595929784471\",\"flags\":0,\"embeds\":[],\"edited_timestamp\":null,\"content\":\"\",\"components\":[],\"channel_type\":0,\"channel_id\":\"885928971068387352\",\"author\":{\"username\":\"floatingmilkshake\",\"public_flags\":4194560,\"primary_guild\":null,\"id\":\"455432936339144705\",\"global_name\":\"FloatingMilkshake\",\"display_name_styles\":null,\"discriminator\":\"0\",\"collectibles\":null,\"clan\":null,\"avatar_decoration_data\":null,\"avatar\":\"c668d339c1921da81a2c101b7c479390\"},\"attachments\":[],\"guild_id\":\"885928970137260093\"}}"
[2025-09-29 10:21:17 -04:00] [Verbose] Length for the last inbound gateway event: 214
[2025-09-29 10:21:17 -04:00] [Verbose] Payload for the last inbound gateway event: "{\"t\":\"MESSAGE_CREATE\",\"s\":14,\"op\":0,\"d\":{\"type\":46,\"tts\":false,\"timestamp\":\"2025-09-29T14:21:17.502000+00:00\",\"pinned\":false,\"message_reference\":{\"type\":0,\"message_id\":\"1422226595929784471\",\"channel_id\":\"885928971068387352\"},\"mentions\":[{\"username\":\"floatingmilkshake\",\"public_flags\":4194560,\"primary_guild\":null,\"member\":{\"roles\":[\"885928970183393345\",\"885928970183393347\",\"1196155537390321725\",\"1322642014486925333\",\"885928970162417709\"],\"premium_since\":null,\"pending\":false,\"nick\":null,\"mute\":false,\"joined_at\":\"2021-09-10T18:47:52.083000+00:00\",\"flags\":0,\"deaf\":false,\"communication_disabled_until\":null,\"banner\":null,\"avatar\":null},\"id\":\"455432936339144705\",\"global_name\":\"FloatingMilkshake\",\"display_name_styles\":null,\"discriminator\":\"0\",\"collectibles\":null,\"clan\":null,\"avatar_decoration_data\":null,\"avatar\":\"c668d339c1921da81a2c101b7c479390\"}],\"mention_roles\":[],\"mention_everyone\":false,\"member\":{\"roles\":[\"885928970183393345\",\"885928970183393347\",\"1196155537390321725\",\"1322642014486925333\",\"885928970162417709\"],\"premium_since\":null,\"pending\":false,\"nick\":null,\"mute\":false,\"joined_at\":\"2021-09-10T18:47:52.083000+00:00\",\"flags\":0,\"deaf\":false,\"communication_disabled_until\":null,\"banner\":null,\"avatar\":null},\"id\":\"1422226735767748678\",\"flags\":0,\"embeds\":[{\"type\":\"poll_result\",\"id\":\"1422226735767748679\",\"fields\":[{\"value\":\"test poll\",\"name\":\"poll_question_text\",\"inline\":false},{\"value\":\"1\",\"name\":\"victor_answer_votes\",\"inline\":false},{\"value\":\"1\",\"name\":\"total_votes\",\"inline\":false},{\"value\":\"1\",\"name\":\"victor_answer_id\",\"inline\":false},{\"value\":\"aaaaa\",\"name\":\"victor_answer_text\",\"inline\":false},{\"value\":\"390962614840328192\",\"name\":\"victor_answer_emoji_id\",\"inline\":false},{\"value\":\"meowupsidedown\",\"name\":\"victor_answer_emoji_name\",\"inline\":false}],\"content_scan_version\":0}],\"edited_timestamp\":null,\"content\":\"\",\"components\":[],\"channel_type\":0,\"channel_id\":\"885928971068387352\",\"author\":{\"username\":\"floatingmilkshake\",\"public_flags\":4194560,\"primary_guild\":null,\"id\":\"455432936339144705\",\"global_name\":\"FloatingMilkshake\",\"display_name_styles\":null,\"discriminator\":\"0\",\"collectibles\":null,\"clan\":null,\"avatar_decoration_data\":null,\"avatar\":\"c668d339c1921da81a2c101b7c479390\"},\"attachments\":[],\"guild_id\":\"885928970137260093\"}}"
[2025-09-29 10:21:17 -04:00] [Error] Dispatch threw an exception:
System.Collections.Generic.KeyNotFoundException: Given emote was not found.
[...]
Exceptions or other error messages
[2025-09-29 10:21:17 -04:00] [Error] Dispatch threw an exception:
System.Collections.Generic.KeyNotFoundException: Given emote was not found.
at DSharpPlus.Entities.DiscordEmoji.FromGuildEmote(BaseDiscordClient client, UInt64 id)
at DSharpPlus.Entities.DiscordPollCompletionMessage..ctor(DiscordMessage other)
at DSharpPlus.DiscordClient.OnMessageCreateEventAsync(DiscordMessage message, TransportUser author, TransportMember member, TransportUser referenceAuthor, TransportMember referenceMember)
at DSharpPlus.DiscordClient.HandleDispatchAsync(GatewayPayload payload)
at DSharpPlus.DiscordClient.ReceiveGatewayEventsAsync()
Anything else you'd like to share
No response
Metadata
Metadata
Assignees
Labels
No labels