mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
Make audit_type optional in casetypes (#1119)
This commit is contained in:
@@ -128,16 +128,17 @@ class ModLog:
|
||||
bot_perms = guild.me.guild_permissions
|
||||
if bot_perms.view_audit_log:
|
||||
case_type = await modlog.get_casetype(case_before.action_type, guild)
|
||||
audit_type = getattr(discord.AuditLogAction, case_type.audit_type)
|
||||
if audit_type:
|
||||
audit_case = None
|
||||
async for entry in guild.audit_logs(action=audit_type):
|
||||
if entry.target.id == case_before.user.id and \
|
||||
entry.user.id == case_before.moderator.id:
|
||||
audit_case = entry
|
||||
break
|
||||
if audit_case:
|
||||
case_before.moderator = audit_case.user
|
||||
if case_type is not None and case_type.audit_type is not None:
|
||||
audit_type = getattr(discord.AuditLogAction, case_type.audit_type)
|
||||
if audit_type:
|
||||
audit_case = None
|
||||
async for entry in guild.audit_logs(action=audit_type):
|
||||
if entry.target.id == case_before.user.id and \
|
||||
entry.user.id == case_before.moderator.id:
|
||||
audit_case = entry
|
||||
break
|
||||
if audit_case:
|
||||
case_before.moderator = audit_case.user
|
||||
is_guild_owner = author == guild.owner
|
||||
is_case_author = author == case_before.moderator
|
||||
author_is_mod = await ctx.bot.is_mod(author)
|
||||
|
||||
Reference in New Issue
Block a user