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

Fix/invite spam and automod spam fixes #310

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/zorak/cogs/admin/admin_automod_spam_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ async def on_message(self, message):
# Dont catch Zorak
if message.author.bot:
return
# Dont care about DM channels
if isinstance(message.channel, discord.DMChannel):
return

# new speaker. Welcome to auto mod.
if message.author.id not in self.records:
Expand Down
9 changes: 6 additions & 3 deletions src/zorak/cogs/admin/moderation_invites.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def log_message(arg_message):
author = arg_message.author
embed = discord.Embed(
title="<:red_circle:1043616578744357085> Invite removed",
description=f"Posted by {arg_message.author}\nIn {arg_message.channel.mention}",
description=f"Posted by {arg_message.author}\nIn {'a DM.' if isinstance(arg_message.channel, discord.DMChannel) else arg_message.channel.mention}",
color=discord.Color.dark_red(),
timestamp=datetime.utcnow(),
)
Expand All @@ -70,8 +70,8 @@ def embed_warning(arg_message):
embed = discord.Embed(
title="<:x:1055080113336762408> External Invites are not allowed here!",
description=f"{arg_message.author}, your message was removed "
f"because it contained an external invite.\nIf this "
f"was a mistake, contact the @staff",
f"because it contained an external invite.\nIf this "
f"was a mistake, contact the @staff",
color=discord.Color.dark_red(),
timestamp=datetime.utcnow(),
)
Expand All @@ -87,6 +87,9 @@ def check_for_admin_override(arg_message):
return any(role.id in self.bot.server_settings.admin_roles.values() for role in message.author.roles)

if is_invite(txt):
if isinstance(message.channel, discord.DMChannel):
return

if not check_for_admin_override(txt):
logs_channel = await self.bot.fetch_channel(self.bot.server_settings.log_channel["mod_log"])
await logs_channel.send(embed=log_message(message))
Expand Down