aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2021-07-15 15:25:43 -0700
committerGravatar MarkKoz <[email protected]>2021-07-15 15:25:43 -0700
commit780074f24d110534fd0c1d1975cb351420b61b0a (patch)
tree6980e3b506d052bb86a9a449a196ad82f465d844
parentAdd util function to send an infraction using an Infraction dict (diff)
Add command to resend infraction embed
Resolve #1664
-rw-r--r--bot/exts/moderation/infraction/management.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py
index b3783cd60..813559030 100644
--- a/bot/exts/moderation/infraction/management.py
+++ b/bot/exts/moderation/infraction/management.py
@@ -11,6 +11,7 @@ from discord.utils import escape_markdown
from bot import constants
from bot.bot import Bot
from bot.converters import Expiry, Infraction, Snowflake, UserMention, allowed_strings, proxy_user
+from bot.exts.moderation.infraction import _utils
from bot.exts.moderation.infraction.infractions import Infractions
from bot.exts.moderation.modlog import ModLog
from bot.pagination import LinePaginator
@@ -38,13 +39,22 @@ class ModManagement(commands.Cog):
"""Get currently loaded Infractions cog instance."""
return self.bot.get_cog("Infractions")
- # region: Edit infraction commands
-
@commands.group(name='infraction', aliases=('infr', 'infractions', 'inf', 'i'), invoke_without_command=True)
async def infraction_group(self, ctx: Context) -> None:
- """Infraction manipulation commands."""
+ """Infraction management commands."""
await ctx.send_help(ctx.command)
+ @infraction_group.command(name="resend", aliases=("send", "rs", "dm"))
+ async def infraction_resend(self, ctx: Context, infraction: Infraction) -> None:
+ """Resend a DM to a user about a given infraction of theirs."""
+ id_ = infraction["id"]
+ if await _utils.notify_infraction(infraction):
+ await ctx.send(f":incoming_envelope: Resent DM for infraction `{id_}`.")
+ else:
+ await ctx.send(f"{constants.Emojis.failmail} Failed to resend DM for infraction `{id_}`.")
+
+ # region: Edit infraction commands
+
@infraction_group.command(name="append", aliases=("amend", "add", "a"))
async def infraction_append(
self,