Update warnings
This commit is contained in:
parent
cac3695351
commit
46a9f0342c
2 changed files with 15 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import traceback
|
import traceback
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
|
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
from dis_snek import Snake, listen
|
from dis_snek import Snake, listen
|
||||||
|
@ -312,10 +312,13 @@ class Jarvis(Snake):
|
||||||
await message.delete()
|
await message.delete()
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.debug("Message deleted before action taken")
|
self.logger.debug("Message deleted before action taken")
|
||||||
|
|
||||||
|
expires_at = datetime.now(tz=timezone.utc) + timedelta(hours=24)
|
||||||
await Warning(
|
await Warning(
|
||||||
active=True,
|
active=True,
|
||||||
admin=self.user.id,
|
admin=self.user.id,
|
||||||
duration=24,
|
duration=24,
|
||||||
|
expires_at=expires_at,
|
||||||
guild=message.guild.id,
|
guild=message.guild.id,
|
||||||
reason="Sent an invite link",
|
reason="Sent an invite link",
|
||||||
user=message.author.id,
|
user=message.author.id,
|
||||||
|
@ -342,10 +345,12 @@ class Jarvis(Snake):
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
f"Massmention threshold on {message.guild.id}/{message.channel.id}/{message.id}"
|
f"Massmention threshold on {message.guild.id}/{message.channel.id}/{message.id}"
|
||||||
)
|
)
|
||||||
|
expires_at = datetime.now(tz=timezone.utc) + timedelta(hours=24)
|
||||||
await Warning(
|
await Warning(
|
||||||
active=True,
|
active=True,
|
||||||
admin=self.user.id,
|
admin=self.user.id,
|
||||||
duration=24,
|
duration=24,
|
||||||
|
expires_at=expires_at,
|
||||||
guild=message.guild.id,
|
guild=message.guild.id,
|
||||||
reason="Mass Mention",
|
reason="Mass Mention",
|
||||||
user=message.author.id,
|
user=message.author.id,
|
||||||
|
@ -398,10 +403,12 @@ class Jarvis(Snake):
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
f"Rolepinged role in {message.guild.id}/{message.channel.id}/{message.id}"
|
f"Rolepinged role in {message.guild.id}/{message.channel.id}/{message.id}"
|
||||||
)
|
)
|
||||||
|
expires_at = datetime.now(tz=timezone.utc) + timedelta(hours=24)
|
||||||
await Warning(
|
await Warning(
|
||||||
active=True,
|
active=True,
|
||||||
admin=self.user.id,
|
admin=self.user.id,
|
||||||
duration=24,
|
duration=24,
|
||||||
|
expires_at=expires_at,
|
||||||
guild=message.guild.id,
|
guild=message.guild.id,
|
||||||
reason="Pinged a blocked role/user with a blocked role",
|
reason="Pinged a blocked role/user with a blocked role",
|
||||||
user=message.author.id,
|
user=message.author.id,
|
||||||
|
@ -416,10 +423,12 @@ class Jarvis(Snake):
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
f"Phishing url `{m}` detected in {message.guild.id}/{message.channel.id}/{message.id}"
|
f"Phishing url `{m}` detected in {message.guild.id}/{message.channel.id}/{message.id}"
|
||||||
)
|
)
|
||||||
|
expires_at = datetime.now(tz=timezone.utc) + timedelta(hours=24)
|
||||||
await Warning(
|
await Warning(
|
||||||
active=True,
|
active=True,
|
||||||
admin=self.user.id,
|
admin=self.user.id,
|
||||||
duration=24,
|
duration=24,
|
||||||
|
expires_at=expires_at,
|
||||||
guild=message.guild.id,
|
guild=message.guild.id,
|
||||||
reason="Phishing URL",
|
reason="Phishing URL",
|
||||||
user=message.author.id,
|
user=message.author.id,
|
||||||
|
@ -445,10 +454,12 @@ class Jarvis(Snake):
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
f"Scam url `{match.string}` detected in {message.guild.id}/{message.channel.id}/{message.id}"
|
f"Scam url `{match.string}` detected in {message.guild.id}/{message.channel.id}/{message.id}"
|
||||||
)
|
)
|
||||||
|
expires_at = datetime.now(tz=timezone.utc) + timedelta(hours=24)
|
||||||
await Warning(
|
await Warning(
|
||||||
active=True,
|
active=True,
|
||||||
admin=self.user.id,
|
admin=self.user.id,
|
||||||
duration=24,
|
duration=24,
|
||||||
|
expires_at=expires_at,
|
||||||
guild=message.guild.id,
|
guild=message.guild.id,
|
||||||
reason="Unsafe URL",
|
reason="Unsafe URL",
|
||||||
user=message.author.id,
|
user=message.author.id,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"""JARVIS WarningCog."""
|
"""JARVIS WarningCog."""
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import datetime, timedelta, timezone
|
||||||
|
|
||||||
from dis_snek import InteractionContext, Permissions, Snake
|
from dis_snek import InteractionContext, Permissions, Snake
|
||||||
from dis_snek.client.utils.misc_utils import get_all
|
from dis_snek.client.utils.misc_utils import get_all
|
||||||
|
@ -59,12 +60,14 @@ class WarningCog(ModcaseCog):
|
||||||
await ctx.send("User not in guild", ephemeral=True)
|
await ctx.send("User not in guild", ephemeral=True)
|
||||||
return
|
return
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
|
expires_at = datetime.now(tz=timezone.utc) + timedelta(hours=duration)
|
||||||
await Warning(
|
await Warning(
|
||||||
user=user.id,
|
user=user.id,
|
||||||
reason=reason,
|
reason=reason,
|
||||||
admin=ctx.author.id,
|
admin=ctx.author.id,
|
||||||
guild=ctx.guild.id,
|
guild=ctx.guild.id,
|
||||||
duration=duration,
|
duration=duration,
|
||||||
|
expires_at=expires_at,
|
||||||
active=True,
|
active=True,
|
||||||
).commit()
|
).commit()
|
||||||
embed = warning_embed(user, reason)
|
embed = warning_embed(user, reason)
|
||||||
|
|
Loading…
Add table
Reference in a new issue