-
Notifications
You must be signed in to change notification settings - Fork 10
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
Attempt to auto jail mention bombers. #351
base: master
Are you sure you want to change the base?
Conversation
I have limited it to 5 for now in case of valid scenarios where 3 or 4 people are mentioned for a valid reason.
futaba/cogs/moderation/core.py
Outdated
:return: Nothing. | ||
""" | ||
if len(message.mentions) > 5: | ||
await self.perform_jail_internal(message, message.author, 0, "Mention Bombing.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any reason this needs to take message.author
separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that it would break perform_jail
where it passes in a specific member into it if I did it that way. I probably could have it where if None
is passed in that 2nd param that it would default to message.author though if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👓
:param message: Messages. | ||
:return: Nothing. | ||
""" | ||
if len(message.mentions) > 5: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On another thought I probably should ensure that this line does not count the same mention more than once like for example if they did @sameperson @sameperson @sameperson
more than once.
But then again it could be considered annoying too so probably should dunce them too in that case as well.
Edit: Or even the case where they mention themselves multiple times too.
if roles.jail is None: | ||
raise CommandFailed(content="No configured jail role") | ||
|
||
if member.top_role >= ctx.me.top_role: | ||
if member.top_role >= self.bot.user.top_role: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User
s do not have roles. ctx.me
is the Member
version of the bot, which is associated with a guild and does have rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to get the Member
version of the bot without using ctx
since it would be impossible to use ctx
in on_message
?
:param message: Messages. | ||
:return: Nothing. | ||
""" | ||
if len(message.mentions) > 5: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is too simplistic. In addition to the self-mentioning problem above, this also doesn't account for multiple messages in quick succession with multiple mentions.
Finally, if we have a threshold like this it should be configurable per-guild.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright I might need to look further into what you do to store the configuration, also might need to somehow store a datetime of the user's last mention like this as well so that way it can pick up any and all history on that action they done?
I have limited it to 5 for now in case of valid scenarios where 3 or 4 people are mentioned for a valid reason.
See also #325.