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

Co-authored-by: Lemon Rose <78662983+japandotorg@users.noreply.github.com>
Co-authored-by: Matt <psykzz@users.noreply.github.com>
This commit is contained in:
Red-GitHubBot
2023-04-19 23:52:38 +02:00
committed by GitHub
parent 36b75f8600
commit be843581dc

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
@@ -177,7 +178,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:
@@ -207,7 +209,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: