I build my python script, which check users in voice channel.
It's simply build for discord library like this:
client.get_guild(guild_id).get_channel(channel_id).members
and it's return all members is connected to the voice channel:
[<Member id=0 name='name' global_name='name' bot=False nick=None guild=<Guild id=0 name='name' shard_id=0 chunked=True member_count=1>>]
I try this with REST API:
import requests
import os
TOKEN = os.getenv("DISCORD_TOKEN")
header = {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Bot '+TOKEN
}
r = requests.get('https://discord.com/api/v9/guilds/guild_id/channels/channel_id/members',headers=header)
print(r.text)
But "members" is not exists in "channels":
{"message": "404: Not Found", "code": 0}
How I get list of members in the voice channel with REST API?
I used bot token and user token, but I not found how solve this problem.
There is REST API documentation about guild members: https://www.postman.com/discord-api/workspace/discord/request/23484324-60127e09-9e0d-4ce6-b905-c8ee6405a225
But nothing about channel's members.