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

[p]warn ask to ban when user not in server #6481

Merged
merged 18 commits into from
Dec 8, 2024

Conversation

Ascensionn
Copy link
Contributor

@Ascensionn Ascensionn commented Nov 26, 2024

Description of the changes

image

This is to follow up with what @Flame442 said: "If a disruptive user is leaving before a moderator is able to take action, it may often make sense to consider them a troll and bypass the server's standard warnings track."

Instead of warning them, I check if they are in the discord guild; if they are not, then they will be banned.

Closes #6445

Have the changes in this PR been tested?

image

Note: the command here is "[p]wasd" because I tested it by implementing a new temporary cog.

Ascensionn and others added 4 commits November 20, 2024 16:21
…dBot into V3/develop

This is to add the extra feature for the [p]warn command, where now the
user will be banned if they are found to have left the discord server
instead. This suspect will be traced by their userIDc
@github-actions github-actions bot added the Category: Cogs - Warnings This is related to the Warnings cog. label Nov 26, 2024
@Flame442
Copy link
Member

My original comment was not intended to be complete approval of the idea of having this command default to banning the member if they have left the server. I think it could be useful to have it as an option (whether that be by asking if they should be banned as a prompt when [p]warn is used on a member that left, or as a config option that causes [p]warn to ban when used on a member that has left), but I would consider it unexpected to happen automatically without any input from the server owner/mod. My comment was mostly intended to address the fact that this issue is one I would consider a fairly rare one to run into, and one that has a fairly easy manual second step to address it.

Regarding the implementation of this fix, the RawUserIdConverter would be the preferred way to accept both a mention or a user ID, and is the converter used by other parts of the bot with similar behavior (ie, [p]ban).

Additionally, you are currently failing the style checks. Please format your PR with black -l 99 using the instructions in our CONTRIBUTING.MD file.

@Flame442 Flame442 added the Type: Enhancement Something meant to enhance existing Red features. label Nov 26, 2024
@Ascensionn
Copy link
Contributor Author

ok, I can add that as a prompt then. The bot should say "[User]" has left the server, so I cannot warn them. Would you like to ban them instead? [Y/N]". If the mod/owner responds with "Y", [User] will be banned. Else, no action will be taken.

I will submit another PR request with the changes.

@Ascensionn
Copy link
Contributor Author

Ascensionn commented Nov 28, 2024

*Reminder: the reason I used "[p]wasd" here is because I had to create a new separate cog in order to test for this kind of command. After I finished testing it, I carefully put in the modified parts.

image

From this image, we can see that the bot eventually timed out after it hasn't received a proper command (either Y or N).

image
image

The bot only registers the responses it expects. Otherwise it will not do anything and eventually time out.

redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
@Flame442 Flame442 self-assigned this Nov 29, 2024
@Ascensionn
Copy link
Contributor Author

Ascensionn commented Nov 30, 2024

Implemented the fixes you have mentioned @Flame442

Here is what happens when you warn the user who is not in the server:

image
image

Here is what happens when it times out after 10 seconds.

image

Copy link
Member

@Flame442 Flame442 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the ban is successful, it should create a modlog case (example).

redbot/cogs/warnings/warnings.py Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
Ascensionn and others added 7 commits December 1, 2024 20:55
Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
…command if they have already left the server.
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
@Ascensionn Ascensionn requested a review from Flame442 December 5, 2024 00:54
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
redbot/cogs/warnings/warnings.py Outdated Show resolved Hide resolved
@Flame442 Flame442 added this to the 3.5.14 milestone Dec 8, 2024
Copy link
Member

@Flame442 Flame442 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!

@Flame442 Flame442 merged commit 48b2fe7 into Cog-Creators:V3/develop Dec 8, 2024
17 checks passed
@red-githubbot red-githubbot bot added the Changelog Entry: Pending Changelog entry for this PR hasn't been added by repo maintainers yet. label Dec 8, 2024
@Flame442 Flame442 changed the title #6476 Update on implementing a ban function for users who have left the server. [p]warn ask to ban when user not in server Dec 8, 2024
BenCos17 added a commit to JARVIS-discordbot/Red-DiscordBot-jarvis that referenced this pull request Dec 9, 2024
`[p]warn` ask to ban when user not in server (Cog-Creators#6481)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Cogs - Warnings This is related to the Warnings cog. Changelog Entry: Pending Changelog entry for this PR hasn't been added by repo maintainers yet. Type: Enhancement Something meant to enhance existing Red features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement warning by user ID.
2 participants