Add auto-delete of invites that aren't SIRD and dbrand
This commit is contained in:
parent
fd1bcbfaac
commit
872a3ef170
2 changed files with 43 additions and 3 deletions
|
@ -23,6 +23,10 @@ intents = Intents.default()
|
|||
intents.members = True
|
||||
restart_ctx = None
|
||||
|
||||
invites = re.compile(
|
||||
r"(https?://)?(www.)?(discord.(gg|io|me|li)|discordapp.com/invite)/([^\s/]+?)(?=\b)"
|
||||
)
|
||||
|
||||
|
||||
jarvis = commands.Bot(command_prefix=utils.get_prefix, intents=intents)
|
||||
slash = SlashCommand(jarvis, sync_commands=True, sync_on_cog_reload=True)
|
||||
|
@ -173,6 +177,45 @@ async def on_message(message: Message):
|
|||
)
|
||||
if autopurge:
|
||||
await message.delete(delay=autopurge["delay"])
|
||||
matches = invites.match(message.content)
|
||||
if matches:
|
||||
if matches.group(5) not in ["dbrand", "VtgZntXcnZ"]:
|
||||
await message.delete()
|
||||
db.jarvis.warns.insert_one(
|
||||
{
|
||||
"user": message.author.id,
|
||||
"reason": "Sent an invite link",
|
||||
"admin": get_config().client_id,
|
||||
"time": datetime.now(),
|
||||
"guild": message.guild.id,
|
||||
"duration": 24,
|
||||
"active": True,
|
||||
}
|
||||
)
|
||||
fields = [
|
||||
Field(
|
||||
"Reason",
|
||||
"Sent an invite link",
|
||||
False,
|
||||
)
|
||||
]
|
||||
embed = build_embed(
|
||||
title="Warning",
|
||||
description=f"{message.author.mention} has been warned",
|
||||
fields=fields,
|
||||
)
|
||||
embed.set_author(
|
||||
name=message.author.nick
|
||||
if message.author.nick
|
||||
else message.author.name,
|
||||
icon_url=message.author.avatar_url,
|
||||
)
|
||||
embed.set_footer(
|
||||
text=f"{message.author.name}#"
|
||||
+ f"{message.author.discriminator} "
|
||||
+ f"| {message.author.id}"
|
||||
)
|
||||
await message.channel.send(embed=embed)
|
||||
await jarvis.process_commands(message)
|
||||
|
||||
|
||||
|
|
|
@ -241,6 +241,3 @@ class StarboardCog(commands.Cog):
|
|||
|
||||
def setup(bot):
|
||||
bot.add_cog(StarboardCog(bot))
|
||||
|
||||
|
||||
cog(StarboardCog(bot))
|
||||
|
|
Loading…
Add table
Reference in a new issue