await me.edit() results in a error('channel_id': self.voice.channel.id, AttributeError: 'NoneType' object has no attribute 'channel')
Summary
Editing a fetched member results in a error
Reproduction Steps
- Join a stage channel
- Try to fetch a member in the channel and then try to unsupress them
Minimal Reproducible Code
guild = await self.Aivo.fetch_guild(guildid)
me = await guild.fetch_member(self.Aivo.user.id)
await me.edit(suppress = False)
Expected Results
It should unsupress the member with the id
Actual Results
Unhandled exception in internal background task 'join_vc'.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/discord/ext/tasks/__init__.py", line 101, in _loop
await self.coro(*args, **kwargs)
File "/root/Azure/Cogs/Music.py", line 51, in join_vc
await me.edit(suppress = False) # THIS NU WORK
File "/usr/local/lib/python3.9/dist-packages/discord/member.py", line 652, in edit
'channel_id': self.voice.channel.id,
AttributeError: 'NoneType' object has no attribute 'channel'
Intents
All intents enabled
System Information
- Python v3.9.5-final
- discord.py v1.7.2-final
- aiohttp v3.6.3
- system info: Linux 5.11.0-16-generic #17-Ubuntu SMP Wed Apr 14 20:12:43 UTC 2021
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
What happens if you use the member from the cache, if it exists? Fetch APIs do not return some of the data.
If the ID of the stage channel is known, you can call internal HTTP methods. See https://github.com/Rapptz/discord.py/blob/fa6fa6a5678dcd17dc148d81916d3a71a18a744c/discord/member.py#L716
What happens if you use the member from the cache, if it exists? Fetch APIs do not return some of the data.
If the ID of the stage channel is known, you can call internal HTTP methods. See https://github.com/Rapptz/discord.py/blob/fa6fa6a5678dcd17dc148d81916d3a71a18a744c/discord/member.py#L716
Thanks! But I already solved this issue by just fetching the channel and then getting the member needed from it.
This was fixed a long time ago.