Coder Social home page Coder Social logo

Comments (2)

kyriog avatar kyriog commented on May 28, 2024

Okay, I investigated a little bit about this on my side.
I've found an easy way to reproduce this:

  1. Open Discord twice with the same account (eg. PC + navigator, PC + Smartphone…)
  2. On Device 1, connect to any vocal channel.
  3. It will trigger a VoiceStateUpdate with session_id A (so Device 1 = Session ID A), and it'll be added to state.voice_states and state.guild[guild_id].voice_states
  4. Without disconnecting device 1, on Device 2, connect to any vocal channel from the same server (Same channel as device 1 or not, it doesn't matter).
  5. It will trigger a VoiceStateUpdate with session_id B (Device 2 = Session ID B), which will be added to the two same hashmaps.
  6. No VoiceStateUpdate will be triggered with the old disconnected session A.
    => The self.voice_states now contains a wrong entry. It will only be removed if the user connects using device 1 (session A) again later (or by restarting the bot).

I think we should use user_id rather than session_id for voice_states keys, as a same user can't be vocally connected twice from two devices.

I'll try to make a PR to fix this issue.

from disco.

kyriog avatar kyriog commented on May 28, 2024

This is a "quick&easy" fix which does not broke the voice_states management.

imo, we should completly replace session_id key by user_id but as it could broke some bots, and as I don't know if you're agree with me, I made this first.

from disco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.