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

Sequencing of events? #55

Open
MorrowM opened this issue Oct 7, 2022 · 1 comment
Open

Sequencing of events? #55

MorrowM opened this issue Oct 7, 2022 · 1 comment

Comments

@MorrowM
Copy link
Contributor

MorrowM commented Oct 7, 2022

This is more of a question than an issue, but is there a way to figure out which event occurred first between two events?

My use-case is that I have a bot that sends join and leave messages into a text channel whenever someone joins or leaves an associated voice channel. I have a handler which reacts to VoiceStateUpdateEvts and sends the appropriate message. The issue is that sometimes someone joins and immediately leaves a voice channel (or vice-versa). When that occurs it can sometimes happen that the leave event is handled before the join event which means the messages are sent out of order.

So my question is whether there's a way to recover such ordering information. From the Discord API I see there's some sort of sequence number but I'm not sure whether that's suitable for this.

@simmsb
Copy link
Owner

simmsb commented Oct 7, 2022

We could definitely add something to the event handler context to include the sequence number, though I really wouldn't be surprised if discord is sending the events out of order to begin with. The only point of parallelism in event handling is each event handling running in its own thread, internal library event handling is sequential until that point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants