feat(moderation): added duration logging to timeouts
Some checks failed
Pylint / Pylint (push) Failing after 1m12s
Some checks failed
Pylint / Pylint (push) Failing after 1m12s
This commit is contained in:
parent
2c6cb7f9cb
commit
a036d5b898
1 changed files with 10 additions and 4 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue