Skip to content

Conversation

tombuente
Copy link

@tombuente tombuente commented Sep 25, 2024

First, we verify if the old state is valid and whether its channel ID is not nil. This indicates that the user has left a voice channel. Next, we check if the event includes a new channel ID. This indicates that the user has joined a new voice channel.
oldOk && oldVoiceState.ChannelID != nil && event.ChannelID != nil

The first part ((oldOk || oldVoiceState.ChannelID == nil)) of the next comparison is redundant. We already confirmed whether a move took place, so if the event's channel ID is not nil, it must be a join.

In my opinion the last comparison is flawed. We don't really check whether there was an old voice state. If the old state is invalid, we have not left a channel. According to the old logic, a leave still takes place, even if only the new channel ID is not equal to nil.

@tombuente tombuente closed this Sep 25, 2024
@tombuente tombuente reopened this Sep 25, 2024
@tombuente tombuente closed this Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant