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

Emit poll events on uncached messages #10326

Open
uhKevinMC opened this issue Jun 6, 2024 · 0 comments · May be fixed by #10328
Open

Emit poll events on uncached messages #10326

uhKevinMC opened this issue Jun 6, 2024 · 0 comments · May be fixed by #10328

Comments

@uhKevinMC
Copy link
Contributor

uhKevinMC commented Jun 6, 2024

Which package is this bug report for?

discord.js

Issue description

No poll events are emitted when the message attached to the poll is uncached (regardless of partials). There was a discussion about it in the discord server here and the solution for now was to use the raw event to fetch the message, then resolve the poll data.

Slightly inconvenient for now as this temporary fix is not particularly type-friendly with my events framework and there is some slightly unexpected behavior from the event not being emitted, even with partials enabled.

Code sample

//pretend we received a message that has a poll object, now we go to sweep the messages cache
client.channels.cache.get('insertIdHere').messages.cache.sweep(() => true)

//vote on the poll attached to a sweeped, uncached message

client.on(Events.MessagePollVoteAdd, (answer: PollAnswer, userId: Snowflake) => {
  console.log(answer, userId)
  //does not emit
})

Versions

-discord.js v14.15.3

Issue priority

Low (slightly annoying)

Which partials do you have configured?

User, Channel, GuildMember, Message

Which gateway intents are you subscribing to?

Guilds, GuildMembers, GuildMessages, DirectMessages, MessageContent, GuildMessagePolls, DirectMessagePolls

I have tested this issue on a development release

94cc02a

@Jiralite Jiralite changed the title poll events are not emitted when the message is uncached, regardless of partials Emit poll events on uncached messages Jun 6, 2024
@uhKevinMC uhKevinMC linked a pull request Jun 6, 2024 that will close this issue
@Jiralite Jiralite linked a pull request Jun 7, 2024 that will close this issue
@almeidx almeidx added the has PR label Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants