[Mod] Add kick and warn to mention spam (#4038)

* Mention spam addition

Adjust code to allow for warning and kicking in mention spam automoderation.

Added new subcommand group, mentionspam. Which will display settings of warn, kick, ban, mentionspam when called.

Adjust config to account for this.

* Condense config + removal of comments

Condense config into one variable to make one call.

Removed unneeded comments I left.

* Add warning casetype

Copied over from warnings cog

* Update strings + change function names

* Changed prints and logs. Account for showsettings, removed blocking.

If this style breaks, blame draper...

* Black format...still blaming draper.

* Adding period at end of description

Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>

* config migration

* Fix TypeError, add default information.

* Max_mention wording change

Thanks to @zephyrkul for suggesting the word changes.

* Require argument for max_mention

* Fix warn modlog case creation

* Fix casetype conflict

maaaaaaaaaagicccccccccc timeeeeeeeeeeeeeeeeeeeeeeeee

Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
Sharky
2020-08-11 21:24:22 -06:00
committed by GitHub
parent 9798538438
commit 73a34eacd6
4 changed files with 216 additions and 33 deletions

View File

@@ -49,7 +49,7 @@ class Mod(
default_global_settings = {"version": ""}
default_guild_settings = {
"ban_mention_spam": False,
"mention_spam": {"ban": None, "kick": None, "warn": None},
"delete_repeats": -1,
"ignored": False,
"respect_hierarchy": True,
@@ -130,7 +130,7 @@ class Mod(
val = 3
else:
val = -1
await self.config.guild(discord.Object(id=guild_id)).delete_repeats.set(val)
await self.config.guild_from_id(guild_id).delete_repeats.set(val)
await self.config.version.set("1.0.0") # set version of last update
if await self.config.version() < "1.1.0":
message_sent = False
@@ -165,6 +165,16 @@ class Mod(
self.bot.loop.create_task(send_to_owners_with_prefix_replaced(self.bot, msg))
break
await self.config.version.set("1.2.0")
if await self.config.version() < "1.3.0":
guild_dict = await self.config.all_guilds()
async for guild_id in AsyncIter(guild_dict.keys(), steps=25):
async with self.config.guild_from_id(guild_id).all() as guild_data:
current_state = guild_data.pop("ban_mention_spam", False)
if current_state is not False:
if "mention_spam" not in guild_data:
guild_data["mention_spam"] = {}
guild_data["mention_spam"]["ban"] = current_state
await self.config.version.set("1.3.0")
@commands.command()
@commands.is_owner()