feat(moderation): added duration logging to timeouts
Some checks failed
Pylint / Pylint (push) Failing after 1m12s

This commit is contained in:
Seaswimmer 2023-10-04 11:57:21 -04:00
parent 2c6cb7f9cb
commit a036d5b898
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -17,7 +17,8 @@ class Moderation(commands.Cog):
mysql_address= " ",
mysql_database = " ",
mysql_username = " ",
mysql_password = " "
mysql_password = " ",
ignore_other_bots = True
)
disable_dateutil()
@ -59,7 +60,7 @@ class Moderation(commands.Cog):
@commands.Cog.listener('on_audit_log_entry_create')
async def autologger(self, entry: discord.AuditLogEntry):
"""This method automatically logs moderations done by users manually ("right clicks")."""
if entry.user.bot or entry.target.bot:
if entry.user.bot or entry.target.bot and await self.config.ignore_other_bots() is True:
return
duration = "NULL"
if entry.reason:
@ -72,9 +73,8 @@ class Moderation(commands.Cog):
moderation_type = 'BAN'
elif entry.action == discord.AuditLogAction.unban:
moderation_type = 'UNBAN'
elif entry.action == discord.AuditLogAction.kick:
moderation_type = 'KICK'
elif entry.action == discord.AuditLogAction.member_update:
duration = entry.after.timed_out_until
moderation_type = 'TIMEOUT'
else:
return
@ -170,6 +170,12 @@ class Moderation(commands.Cog):
async def moderationset(self, ctx: commands.Context):
"""Manage moderation commands."""
@moderationset.command(name="ignorebots")
@checks.admin()
async def moderationset_ignorebots(self, ctx: commands.Context):
await self.config.ignore_other_bots.set(not await self.config.ignore_other_bots())
await ctx.send(f"Ignore bots setting set to {await self.config.ignore_other_bots()}")
@moderationset.command(name="mysql")
@checks.is_owner()
async def moderationset_mysql(self, ctx: commands.Context):