Shorten the audit log reason appropriately, remove unused vars (#4189)

* [Mod] Check for reason length & remove unused vars

This PR also remove unused variable.

* Blame me

* Apply Kowlin order.

Text will get truncate in audit logs in case we're going over 512 characters.

* This is already handled by ban_user()

* Use `get_audit_reason()` in `[p]tempban`

* Add a new kwarg to `get_audit_reason()` instead

* Include `[p]voiceban` and `[p]voiceunban`

* Include Mutes cog

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Predeactor
2020-12-23 03:22:59 +01:00
committed by GitHub
parent d3ffb22e86
commit d53ff57794
4 changed files with 29 additions and 27 deletions

View File

@@ -978,7 +978,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
)
author = ctx.message.author
guild = ctx.guild
audit_reason = get_audit_reason(author, reason)
audit_reason = get_audit_reason(author, reason, shorten=True)
success_list = []
issue_list = []
for user in users:
@@ -1122,7 +1122,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
author = ctx.message.author
channel = ctx.message.channel
guild = ctx.guild
audit_reason = get_audit_reason(author, reason)
audit_reason = get_audit_reason(author, reason, shorten=True)
issue_list = []
success_list = []
for user in users:
@@ -1187,7 +1187,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
async with ctx.typing():
guild = ctx.guild
author = ctx.author
audit_reason = get_audit_reason(author, reason)
audit_reason = get_audit_reason(author, reason, shorten=True)
issue_list = []
success_list = []
if guild.id in self._channel_mute_events:
@@ -1252,7 +1252,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
channel = ctx.channel
author = ctx.author
guild = ctx.guild
audit_reason = get_audit_reason(author, reason)
audit_reason = get_audit_reason(author, reason, shorten=True)
success_list = []
issue_list = []
for user in users: