Skip to content
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

[V3] Ban peers with hackban #2127

Closed
Liante-0216 opened this issue Sep 13, 2018 · 2 comments · Fixed by #2128
Closed

[V3] Ban peers with hackban #2127

Liante-0216 opened this issue Sep 13, 2018 · 2 comments · Fixed by #2128
Labels
Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.

Comments

@Liante-0216
Copy link

Command bugs

Command name

[p]hackban

What cog is this command from?

Mod

What were you expecting to happen?

When called by a mod on another mod, display error message: "I cannot let you do that. You are not higher than the user in the role hierarchy." and do nothing.

What actually happened?

Mod got banned, message displayed: "Done. The user will not be able to join this server."

How can we reproduce this issue?

  1. Set a role with ban permissions and access to the Mod cog and hackban command.
  2. Give the role to two members, it should be the highest role for both of them.
  3. Have one of them execute [p]hackban <other's id>
@Kowlin Kowlin added Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing. V3 Status: Accepted We want this labels Sep 14, 2018
@Kowlin
Copy link
Member

Kowlin commented Sep 14, 2018

Can confirm that this is a bug. Also as an additional bug, ban does not check if you can actually ban the user and it will error out if the bot doesn't have the permissions to ban.

Traceback

Exception in command 'hackban' Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 61, in wrapped ret = await coro(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/redbot/cogs/mod/mod.py", line 441, in hackban ban_list = await guild.bans() File "/usr/local/lib/python3.6/dist-packages/discord/guild.py", line 857, in bans data = await self._state.http.get_bans(self.id) File "/usr/local/lib/python3.6/dist-packages/discord/http.py", line 209, in request raise Forbidden(r, data) discord.errors.Forbidden: FORBIDDEN (status code: 403): Missing Permissions

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/bot.py", line 898, in invoke
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 550, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 70, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: FORBIDDEN (status code: 403): Missing Permissions

@palmtree5 palmtree5 assigned palmtree5 and unassigned palmtree5 Sep 17, 2018
@palmtree5 palmtree5 added Status: In Progress There's a PR open to deal with this, or an org member is working on this internally and removed Status: Accepted We want this labels Sep 17, 2018
Tobotimus pushed a commit that referenced this issue Sep 24, 2018
If the member is in the guild, delegates to existing ban logic.

Additionally, check that we have ban perms prior to attempting to fetch the existing ban list.

Fixes #2127.
@Tobotimus
Copy link
Member

Thanks for this report. Resolved by #2128.

@Tobotimus Tobotimus removed the Status: In Progress There's a PR open to deal with this, or an org member is working on this internally label Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants