Discord.js: guildMembers still in voiceChannel whilst moved away

Created on 17 Jan 2018  Â·  1Comment  Â·  Source: discordjs/discord.js

Please describe the problem you are having in as much detail as possible:
When I move members from 1 channel to another and then log the users from both channels then it still logs the users in the old channel whilst they aren't there anymore. I have tested it with moving between 2 channels in the same category and also moving to other categories.

Include a reproducible code sample here, if possible:
Moving 2 people from channel through .setVoiceChannel (I did it with the use of a loop if that matters)

Further details:

  • discord.js version: discord.[email protected] (master)
  • node.js version: v8.8.1
  • Operating system: Windows 10 Home
  • Priority this issue should have – please be realistic and elaborate if possible: No priority at all (imo)

  • [ ] I found this issue while running code on a __user account__

  • [x] I have also tested the issue on latest master, commit hash: e576387fea2a973eefe298a6f3610eb0d8b54999
low caching bug

Most helpful comment

Latest commit to master should fix this. (https://github.com/discordjs/discord.js/commit/fbd25f867742bac5511e47bbf69274bdc82ccb23)

The intended behaviour is:

  • The member you get from the promise of GuildMember#setVoiceChannel is a clone of the original one with the modified voice state. (So the voiceChannel property of it will be the new channel)
  • The old channel still holds the member until the voice state update comes from the gateway
  • The new channel won't hold the member until ^

Somewhat explanation on what went wrong:
GuildMember#edit (also called from GuildMember#setVoiceChannel) edited the original voice state instead of a copy of it for the clone.
This made it impossible for the possibly later coming voice state update to remove the moved member from the old voice channel.
Resulting in a stale GuildMember in the old VoiceChannel's member collection, until the member moves initiated from external sources back in and out.

>All comments

Latest commit to master should fix this. (https://github.com/discordjs/discord.js/commit/fbd25f867742bac5511e47bbf69274bdc82ccb23)

The intended behaviour is:

  • The member you get from the promise of GuildMember#setVoiceChannel is a clone of the original one with the modified voice state. (So the voiceChannel property of it will be the new channel)
  • The old channel still holds the member until the voice state update comes from the gateway
  • The new channel won't hold the member until ^

Somewhat explanation on what went wrong:
GuildMember#edit (also called from GuildMember#setVoiceChannel) edited the original voice state instead of a copy of it for the clone.
This made it impossible for the possibly later coming voice state update to remove the moved member from the old voice channel.
Resulting in a stale GuildMember in the old VoiceChannel's member collection, until the member moves initiated from external sources back in and out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  Â·  3Comments

Alipoodle picture Alipoodle  Â·  3Comments

tom-barnes picture tom-barnes  Â·  3Comments

shukriadams picture shukriadams  Â·  3Comments

xCuzImPro picture xCuzImPro  Â·  3Comments