mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Warnings]Make it possible to add reason with unwarn (#3490)
* Unwarn now able to have a reason * black * Update string to say Run instead of Do Co-Authored-By: Draper <27962761+Drapersniper@users.noreply.github.com> * Make error for unregistered reason less agressive Co-Authored-By: Draper <27962761+Drapersniper@users.noreply.github.com> * Removing unneccessary lines and not putting the user input through the translator. * Because black hates me, here black formatting with adjusted line length * Trigger CI * Now always sendes a message when an invalid reason is passed, not only if the command author was an admin, guild owner or bot owner. * That should do the trick * Correct * Make Reason optional Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com> Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
parent
6ddaff6260
commit
e7969992c3
@ -198,7 +198,7 @@ class Warnings(commands.Cog):
|
||||
for r, v in registered_reasons.items():
|
||||
if await ctx.embed_requested():
|
||||
em = discord.Embed(
|
||||
title=_("Reason: {name}").format(name=r), description=v["description"]
|
||||
title=_("Reason: {name}").format(name=r), description=v["description"],
|
||||
)
|
||||
em.add_field(name=_("Points"), value=str(v["points"]))
|
||||
msg_list.append(em)
|
||||
@ -226,7 +226,9 @@ class Warnings(commands.Cog):
|
||||
if await ctx.embed_requested():
|
||||
em = discord.Embed(title=_("Action: {name}").format(name=r["action_name"]))
|
||||
em.add_field(name=_("Points"), value="{}".format(r["points"]), inline=False)
|
||||
em.add_field(name=_("Exceed command"), value=r["exceed_command"], inline=False)
|
||||
em.add_field(
|
||||
name=_("Exceed command"), value=r["exceed_command"], inline=False,
|
||||
)
|
||||
em.add_field(name=_("Drop command"), value=r["drop_command"], inline=False)
|
||||
msg_list.append(em)
|
||||
else:
|
||||
@ -371,7 +373,8 @@ class Warnings(commands.Cog):
|
||||
description=user_warnings[key]["description"],
|
||||
)
|
||||
await ctx.send_interactive(
|
||||
pagify(msg, shorten_by=58), box_lang=_("Warnings for {user}").format(user=user)
|
||||
pagify(msg, shorten_by=58),
|
||||
box_lang=_("Warnings for {user}").format(user=user),
|
||||
)
|
||||
|
||||
@commands.command()
|
||||
@ -400,13 +403,20 @@ class Warnings(commands.Cog):
|
||||
description=user_warnings[key]["description"],
|
||||
)
|
||||
await ctx.send_interactive(
|
||||
pagify(msg, shorten_by=58), box_lang=_("Warnings for {user}").format(user=user)
|
||||
pagify(msg, shorten_by=58),
|
||||
box_lang=_("Warnings for {user}").format(user=user),
|
||||
)
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
async def unwarn(self, ctx: commands.Context, user: Union[discord.Member, int], warn_id: str):
|
||||
async def unwarn(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
user: Union[discord.Member, int],
|
||||
warn_id: str,
|
||||
reason: str = None,
|
||||
):
|
||||
"""Remove a warning from a user."""
|
||||
|
||||
guild = ctx.guild
|
||||
@ -440,7 +450,7 @@ class Warnings(commands.Cog):
|
||||
"unwarned",
|
||||
member,
|
||||
ctx.message.author,
|
||||
None,
|
||||
reason,
|
||||
until=None,
|
||||
channel=None,
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user