-
-
Notifications
You must be signed in to change notification settings - Fork 482
Description
Summary
The ctx.channel.members property is not right
Reproduction Steps
I was working on a discord.ui.View that needs ctx.channel.members
, however it is giving the wrong result.
So after that I made a test slash command to check if it was a bug, and yeah, turns out that something is wrong, len(ctx.channel.members
is giving 712 while I am asking for the length of one private channel, which only 12 people can access that with view_channel and send_messages permissions
Minimal Reproducible Code
This is the snippet of code in production:
def is_a_normal_member(user: discord.Member):
return # had some conditions
interaction: discord.Interaction # from a button callback
users = tuple(filter(is_a_normal_member, interaction.channel.members))
Expected Results
To give the members that have access to the current channel
Actual Results
It gave the members of the whole guild
Intents
discord.Intents.all() # all
System Information
- Python v3.12.3-final
- py-cord v2.6.1-final
- aiohttp v3.11.11
- system info: Linux 6.8.0-1019-oem #19-Ubuntu SMP PREEMPT_DYNAMIC Mon Dec 9 06:30:03 UTC 2024
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
I went to the discord server and asked for this problem, and here are some snippets I got
@bot.slash_command(name="some")
async def some(ctx: discord.ApplicationContext):
channel = ctx.guild.get_channel(1325911264941314059)
await ctx.respond(str(ctx.channel == channel))
This assertion gave me True
@bot.slash_command(name="some")
async def some(ctx: discord.ApplicationContext):
channel: discord.TextChannel = await bot.fetch_channel(1325911264941314059)
mystr = str(len(ctx.channel.members))
channel = ctx.guild.get_channel(1325911264941314059)
await ctx.respond(f"{mystr} {len(channel.members)}")
This gave me 711 12
By the way, when I use ctx.guild.get_channel(...).members
, it gives the correct result of 12