Skip to content

Commands Used in Threads as User-Installed App #6501

@SomewhatDamaged

Description

@SomewhatDamaged

What Red version are you using?

3.5.14

What were you trying to do?

Receive a command.

Context:
Installed as a user app
Not present on server
Command run in a thread (cannot replicate what is causing this, permission wise, but a user can trigger it every time)

What did you expect to happen?

Bot receives command, processes it as normal and passes it to the cog.

What actually happened?

Function doesn't get called. Following appears in Red's log after a few minutes:

[2025-01-03 16:13:18] [ERROR] asyncio: Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper() done, defined at /home/gel/sourcebot/lib/python3.11/site-packages/discord/app_commands/tree.py:1149> exception=AttributeError("'NoneType' object has no attribute 'id'")>
Traceback (most recent call last):
  File "/home/gel/sourcebot/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1151, in wrapper
    await self._call(interaction)
  File "/home/gel/sourcebot/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1272, in _call
    if not await self.interaction_check(interaction):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gel/sourcebot/lib/python3.11/site-packages/redbot/core/tree.py", line 361, in interaction_check
    if not (await self.client.ignored_channel_or_guild(interaction)):
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gel/sourcebot/lib/python3.11/site-packages/redbot/core/bot.py", line 920, in ignored_channel_or_guild
    chann_ignored = await self._ignored_cache.get_ignored_channel(channel)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gel/sourcebot/lib/python3.11/site-packages/redbot/core/_settings_caches.py", line 169, in get_ignored_channel
    cid: int = channel.id
               ^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'

How can we reproduce this error?

I cannot replicate this myself, though the user who keeps having the problem can reliably trigger it on servers (and they aren't able to get the permissions list for them, though they are trying to contact an admin to do so).

Anything else?

What it looks like is your code here is running the check as if the bot was present on the server (which it isn't).

Then this check attempts to get the parent channel (which isn't available to the bot because it is a user-installed-app), and then tries to call that channel's (None) attributes.

There really can't be any checks for ignored (by the bot) channels like this, since it isn't on that server for anyone to run the command to lock channels.

Metadata

Metadata

Assignees

Labels

Status: In ProgressThere's a PR open to deal with this, or an org member is working on this internallyType: BugUnexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions