[Admin] add reasoning to addrole & removerole. (#5927)

Co-authored-by: Matt <psykzz@users.noreply.github.com>
This commit is contained in:
Lemon Rose 2022-12-18 09:06:40 +05:30 committed by GitHub
parent fb3dc51fe2
commit 333e359bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ import discord
from redbot.core import Config, checks, commands from redbot.core import Config, checks, commands
from redbot.core.i18n import Translator, cog_i18n from redbot.core.i18n import Translator, cog_i18n
from redbot.core.utils.chat_formatting import box from redbot.core.utils.chat_formatting import box
from redbot.core.utils.mod import get_audit_reason
from redbot.core.utils.predicates import MessagePredicate from redbot.core.utils.predicates import MessagePredicate
from .announcer import Announcer from .announcer import Announcer
@ -170,7 +171,8 @@ class Admin(commands.Cog):
await ctx.send(_(NEED_MANAGE_ROLES)) await ctx.send(_(NEED_MANAGE_ROLES))
return return
try: try:
await member.add_roles(role) reason = get_audit_reason(ctx.author)
await member.add_roles(role, reason=reason)
except discord.Forbidden: except discord.Forbidden:
await ctx.send(_(GENERIC_FORBIDDEN)) await ctx.send(_(GENERIC_FORBIDDEN))
else: else:
@ -200,7 +202,8 @@ class Admin(commands.Cog):
await ctx.send(_(NEED_MANAGE_ROLES)) await ctx.send(_(NEED_MANAGE_ROLES))
return return
try: try:
await member.remove_roles(role) reason = get_audit_reason(ctx.author)
await member.remove_roles(role, reason=reason)
except discord.Forbidden: except discord.Forbidden:
await ctx.send(_(GENERIC_FORBIDDEN)) await ctx.send(_(GENERIC_FORBIDDEN))
else: else: