Fix issues with modlog

This commit is contained in:
Zeva Rose 2021-07-25 12:12:43 -06:00
parent f697d07728
commit 078df960da
2 changed files with 6 additions and 6 deletions

View file

@ -44,7 +44,7 @@ jarvis = commands.Bot(
) )
slash = SlashCommand(jarvis, sync_commands=True, sync_on_cog_reload=True) slash = SlashCommand(jarvis, sync_commands=True, sync_on_cog_reload=True)
jarvis_self = Process() jarvis_self = Process()
__version__ = "1.6.0" __version__ = "1.6.1"
db = DBManager(get_config().mongo).mongo db = DBManager(get_config().mongo).mongo

View file

@ -67,12 +67,12 @@ class ModlogCog(commands.Cog):
if modlog: if modlog:
channel = guild.get_channel(modlog.value) channel = guild.get_channel(modlog.value)
await asyncio.sleep(0.5) # Need to wait for audit log await asyncio.sleep(0.5) # Need to wait for audit log
auditlog = guild.audit_logs( auditlog = await guild.audit_logs(
limit=50, limit=50,
action=discord.AuditLogAction.ban, action=discord.AuditLogAction.ban,
after=datetime.utcnow() - timedelta(seconds=15), after=datetime.utcnow() - timedelta(seconds=15),
oldest_first=False, oldest_first=False,
) ).flatten()
log: discord.AuditLogEntry = self.get_latest_log(auditlog, user) log: discord.AuditLogEntry = self.get_latest_log(auditlog, user)
admin: discord.User = log.user admin: discord.User = log.user
if admin.id == get_config().client_id: if admin.id == get_config().client_id:
@ -99,12 +99,12 @@ class ModlogCog(commands.Cog):
if modlog: if modlog:
channel = guild.get_channel(modlog.value) channel = guild.get_channel(modlog.value)
await asyncio.sleep(0.5) # Need to wait for audit log await asyncio.sleep(0.5) # Need to wait for audit log
auditlog = guild.audit_logs( auditlog = await guild.audit_logs(
limit=50, limit=50,
action=discord.AuditLogAction.unban, action=discord.AuditLogAction.unban,
after=datetime.utcnow() - timedelta(seconds=15), after=datetime.utcnow() - timedelta(seconds=15),
oldest_first=False, oldest_first=False,
) ).flatten()
log: discord.AuditLogEntry = self.get_latest_log(auditlog, user) log: discord.AuditLogEntry = self.get_latest_log(auditlog, user)
admin: discord.User = log.user admin: discord.User = log.user
if admin.id == get_config().client_id: if admin.id == get_config().client_id:
@ -136,7 +136,7 @@ class ModlogCog(commands.Cog):
action=discord.AuditLogAction.kick, action=discord.AuditLogAction.kick,
after=datetime.utcnow() - timedelta(seconds=15), after=datetime.utcnow() - timedelta(seconds=15),
oldest_first=False, oldest_first=False,
) ).flatten()
log: discord.AuditLogEntry = self.get_latest_log(auditlog, user) log: discord.AuditLogEntry = self.get_latest_log(auditlog, user)
admin: discord.User = log.user admin: discord.User = log.user
if admin.id == get_config().client_id: if admin.id == get_config().client_id: