Add REST endpoint for getting members in a voice channel


3 條評論

  • Emma Marcus

    I recently rewrote my bot from using a gateway connection to purely using Discord's REST API due to scalability and reliability problems once it passed ~90 thousand servers.

    In doing so, I've had to drop one command that relied on getting the nick/global/usernames of people connected to a particular voice channel. My bot previously used gateway events to know who was in a voice channel, with the Presence Intent enabled.  Barnes and Noble Survey

    My request is for the ability to get the guild members currently connected to a voice channel with a REST call, either with the existing Get Channel endpoint, or a new endpoint.

    Additionally, it would be helpful if I could get a particular guild member's voice state. That way I could get the user from the interaction, then the voice channel from that user's voice state, and finally the members from that voice channel.


    I can suggest a workaround you might consider for getting the members in a voice channel using the REST API.

    Use the GET /guilds/{}/voice-states endpoint:
    You can use this endpoint to get the voice states of all members in a specific guild. The response will contain information about the voice channels members are connected to.

    Filter the response:
    After receiving the voice states of all members in the guild, you can filter the result to get the list of members who are connected to a particular voice channel.

    Use the GET /guilds/{}/members/{} endpoint (optional):
    If you need to get specific details about a member's voice state (e.g., mute status, deaf status), you can use this endpoint to fetch that information individually for a user.

    Please note that while this approach can help you get information about members connected to voice channels, it might not be as efficient or real-time as using the gateway events. If your bot operates in a very large and active guild, you may still encounter scalability issues with this approach.

    As of now, the Discord API documentation or the API reference may have been updated, so I recommend checking the official Discord API documentation or their developer community for any new changes or endpoints that might have been introduced after my last update.






  • Gunnar

    Emma, could you link to where this endpoint is documented? I can't find it, and that endpoint returns a 404 when I hit it. Additionally, a lot of what you wrote makes little sense and gives off strong written-by-AI vibes. Please feel free to prove me wrong.

  • Elijah

    Bro that's written with AI + that endpoint doesn't exist