New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The base !help-command does not work in staff channels #262

Closed
SebastiaanZ opened this Issue Jan 9, 2019 · 5 comments

Comments

2 participants
@SebastiaanZ
Copy link
Member

SebastiaanZ commented Jan 9, 2019

At the moment, the base !help command does not work in staff channels. A cursory search in staff indicates that it broke somewhere after 2018-12-17, as this is the last time it was successful there:

2019-01-09_17-52-27

Currently, the bot just doesn't respond when !help is called without arguments. Strangely enough, it does work when used with an argument, .e.g, !help unban, whether called directly or as fallback when a command is run without the proper arguments, e.g. !unban without arguments.

I've not found any obvious reason for it, but I know @scragly also looked, so maybe he can share his findings as well.

@SebastiaanZ

This comment has been minimized.

Copy link
Member

SebastiaanZ commented Jan 9, 2019

Okay, the base command can only be called from bot-commands at the moment, so the problem is not restricted to the staff channels. Seems like a whitelisting problem somewhere.

@SebastiaanZ

This comment has been minimized.

Copy link
Member

SebastiaanZ commented Jan 9, 2019

Running the command !help on my test/sandbox server show this in the debug logs:

Jan 09 18:29:47 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Ves Zappa#3787 tried to call the 'charinfo' command. The command was not used in a whitelisted channel, but the author had a role to bypass the in_channel check.

That's weird. I'll look into it.

@SebastiaanZ

This comment has been minimized.

Copy link
Member

SebastiaanZ commented Jan 9, 2019

It seems like the bot actually tries to call some of the commands when creating the help embed and that's why those debug messages are there. However, at the end it fails with a traceback as well.

I'll dump the output below to document it and continue my search.

This is a user with minimal roles:

Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'bigbrother' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'echo' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'embed' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'internal' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'cogs' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'defcon' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'redeploy' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'uptimes' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'roles' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'user' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'ban' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'infraction' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'kick' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'mute' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'tempban' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'tempmute' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'unban' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'unmute' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'warn' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 does not have the required role to use the 'otname' command, so the request is rejected.
Jan 09 18:40:27 pd.beardfist.com Bot: |                 bot.decorators |    DEBUG | Hemlock's Cat#4641 tried to call the 'eval' command. The in_channel check failed.
Ignoring exception in command_error
Traceback (most recent call last):
  File "/home/sebastiaan/.local/share/virtualenvs/bot-05f_83Kn/src/discord-py/discord/client.py", line 225, in _run_event
    await coro(*args, **kwargs)
  File "/home/sebastiaan/pydis/bot/bot/cogs/events.py", line 147, in on_command_error
    raise e
  File "/home/sebastiaan/.local/share/virtualenvs/bot-05f_83Kn/src/discord-py/discord/ext/commands/bot.py", line 899, in invoke
    await ctx.command.invoke(ctx)
  File "/home/sebastiaan/.local/share/virtualenvs/bot-05f_83Kn/src/discord-py/discord/ext/commands/core.py", line 614, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/sebastiaan/.local/share/virtualenvs/bot-05f_83Kn/src/discord-py/discord/ext/commands/core.py", line 61, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/sebastiaan/pydis/bot/bot/cogs/help.py", line 651, in new_help
    await HelpSession.start(ctx, *commands)
  File "/home/sebastiaan/pydis/bot/bot/cogs/help.py", line 556, in start
    await session.prepare()
  File "/home/sebastiaan/pydis/bot/bot/cogs/help.py", line 255, in prepare
    await self.build_pages()
  File "/home/sebastiaan/pydis/bot/bot/cogs/help.py", line 430, in build_pages
    can_run = await command.can_run(self._ctx)
  File "/home/sebastiaan/.local/share/virtualenvs/bot-05f_83Kn/src/discord-py/discord/ext/commands/core.py", line 815, in can_run
    return (await discord.utils.async_all(predicate(ctx) for predicate in predicates))
  File "/home/sebastiaan/.local/share/virtualenvs/bot-05f_83Kn/src/discord-py/discord/utils.py", line 279, in async_all
    for elem in gen:
  File "/home/sebastiaan/.local/share/virtualenvs/bot-05f_83Kn/src/discord-py/discord/ext/commands/core.py", line 815, in <genexpr>
    return (await discord.utils.async_all(predicate(ctx) for predicate in predicates))
  File "/home/sebastiaan/pydis/bot/bot/decorators.py", line 43, in predicate
    f"Sorry, but you may only use this command within {channels_str}."
bot.decorators.InChannelCheckFailure: Sorry, but you may only use this command within <#530364025243041802>.

@sco1 sco1 added this to To Do in Bot Tracking via automation Jan 9, 2019

@SebastiaanZ

This comment has been minimized.

Copy link
Member

SebastiaanZ commented Jan 9, 2019

Okay, I think I know what's going on.

The help command checks which commands a user can run to determine which should be in the help embed. However, the way it does that throws the bot.decorators.InChannelCheckFailure exception for some commands when executed outside of bot-commands. Since that exception is not handled, the help command stops executing.

I'll work on a patch.

@sco1

This comment has been minimized.

Copy link
Member

sco1 commented Jan 9, 2019

Closed by #263

@sco1 sco1 closed this Jan 9, 2019

Bot Tracking automation moved this from In progress to Done Jan 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment