Enhance AutoMod configuration by introducing event-specific settings and thresholds. Refactor Automod schemas to include event configurations, thresholds, and limits for ignored roles and channels. Update database interactions to support new structure and improve handling of AutoMod rules in cogs, ensuring dynamic thresholds for various events. Update dashboard components to accommodate new configurations and improve user experience in managing AutoMod settings.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
# ║ ║
|
||||
# ╚══════════════════════════════════════════════════════════════════╝
|
||||
from utils.db_paths import db_path
|
||||
from utils.automod_settings import get_thresholds
|
||||
|
||||
import discord
|
||||
from utils.emoji import TICK
|
||||
@@ -105,15 +106,17 @@ class AntiInvite(commands.Cog):
|
||||
if any(invite.code == invite_code for invite in invite):
|
||||
return
|
||||
|
||||
th = await get_thresholds(guild_id, "anti_invites")
|
||||
mute_minutes = float(th.get("mute_minutes", 12))
|
||||
punishment = await self.get_punishment(guild_id)
|
||||
action_taken = None
|
||||
reason = "Posted an invite link"
|
||||
|
||||
try:
|
||||
if punishment == "Mute":
|
||||
timeout_duration = discord.utils.utcnow() + timedelta(minutes=12)
|
||||
timeout_duration = discord.utils.utcnow() + timedelta(minutes=mute_minutes)
|
||||
await user.edit(timed_out_until=timeout_duration, reason="Posted an invite link")
|
||||
action_taken = "Muted for 12 minutes"
|
||||
action_taken = f"Muted for {int(mute_minutes)} minutes"
|
||||
elif punishment == "Kick":
|
||||
await user.kick(reason="Posted an invite link")
|
||||
action_taken = "Kicked"
|
||||
|
||||
Reference in New Issue
Block a user