If you access server-specific (aka Member related stuff) with a user-installed app, python throws an exception trying to get the member object. I also found that member.display_avatar in particular throws an error only if a server-specific avatar has been set.
Reproduction Steps
Make a user app
Install it on your account
Make a user command (context menu > user)
Try to print member.roles, member.top_role, member.display_avatar (if set) etc., anything Member-specific
See the console for the exception
Pycord handles the case of a user-installed app automatically, and simply returns None for e.g. member.roles, or the global avatar in the case of member.display_avatar
Actual Results
Pycord seems to not handle this at all and throws an exception
Intents
all / not applicable, happens regardless of intents
System Information
Python v3.12.4-final
py-cord v2.6.None-final
aiohttp v3.9.5
system info: Windows 11 10.0.22631
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
Traceback for printing member.roles (project path replaced with ...)
Ignoring exception in command bugrepro:
Traceback (most recent call last):
File "...venv\Lib\site-packages\discord\commands\core.py", line 138, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^^^
File "...venv\Lib\site-packages\discord\commands\core.py", line 1796, in _invoke
await self.callback(self.cog, ctx, target)
File "...cogs\user_commands.py", line 30, in bugrepro
print(member.roles)
^^^^^^^^^^^^
File "...venv\Lib\site-packages\discord\member.py", line 562, in roles
role = g.get_role(role_id)
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_role'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "...venv\Lib\site-packages\discord\bot.py", line 1137, in invoke_application_command
await ctx.command.invoke(ctx)
File "...venv\Lib\site-packages\discord\commands\core.py", line 435, in invoke
await injected(ctx)
File "...venv\Lib\site-packages\discord\commands\core.py", line 146, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'get_role'
Summary
If you access server-specific (aka Member related stuff) with a user-installed app, python throws an exception trying to get the member object. I also found that member.display_avatar in particular throws an error only if a server-specific avatar has been set.
Reproduction Steps
Make a user app Install it on your account Make a user command (context menu > user) Try to print member.roles, member.top_role, member.display_avatar (if set) etc., anything Member-specific See the console for the exception
Minimal Reproducible Code
Expected Results
Pycord handles the case of a user-installed app automatically, and simply returns None for e.g. member.roles, or the global avatar in the case of member.display_avatar
Actual Results
Pycord seems to not handle this at all and throws an exception
Intents
all / not applicable, happens regardless of intents
System Information
Checklist
Additional Context
Traceback for printing member.roles (project path replaced with
...
)