Skip to content

Commit c5d4ccf

Browse files
authored
Merge pull request #358 from Weirdllamas/feature
Features: Show Message ID and Thread_Move_Notify
2 parents c32f44a + 133a565 commit c5d4ccf

File tree

5 files changed

+52
-4
lines changed

5 files changed

+52
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ however, insignificant breaking changes does not guarantee a major version bump,
1212

1313
- Ability to change permission levels of individual commands.
1414
- See `?permissions override` for more information.
15+
- `thread_move_notify` and `thread_move_response` to notify recipients if a thread is moved.
16+
- IDs of messages sent to Modmail are now viewable.
1517

1618
### Fixed
1719

cogs/modmail.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from core.models import PermissionLevel
1818
from core.paginator import EmbedPaginatorSession
1919
from core.time import UserFriendlyTime, human_timedelta
20-
from core.utils import format_preview, User, create_not_found_embed, format_description
20+
from core.utils import format_preview, User, create_not_found_embed, format_description, strtobool
2121

2222
logger = logging.getLogger("Modmail")
2323

@@ -286,14 +286,35 @@ async def snippet_edit(self, ctx, name: str.lower, *, value):
286286
@commands.command()
287287
@checks.has_permissions(PermissionLevel.MODERATOR)
288288
@checks.thread_only()
289-
async def move(self, ctx, *, category: discord.CategoryChannel):
289+
async def move(self, ctx, category: discord.CategoryChannel, *, specifics: str = None):
290290
"""
291291
Move a thread to another category.
292292
293293
`category` may be a category ID, mention, or name.
294+
`specifics` is a string which takes in arguments on how to perform the move. Ex: "silently"
294295
"""
295296
thread = ctx.thread
297+
silent = False
298+
299+
if specifics:
300+
silent_words = ['silent', 'silently']
301+
silent = any(word in silent_words for word in specifics.split())
302+
296303
await thread.channel.edit(category=category, sync_permissions=True)
304+
305+
try:
306+
thread_move_notify = strtobool(self.bot.config["thread_move_notify"])
307+
except ValueError:
308+
thread_move_notify = self.bot.config.remove("thread_move_notify")
309+
310+
if thread_move_notify and not silent:
311+
embed = discord.Embed(
312+
title="Thread Moved",
313+
description=self.bot.config["thread_move_response"],
314+
color=self.bot.main_color
315+
316+
await thread.recipient.send(embed=embed)
317+
297318
sent_emoji, _ = await self.bot.retrieve_emoji()
298319
try:
299320
await ctx.message.add_reaction(sent_emoji)

core/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class ConfigManager:
5353
"thread_close_title": "Thread Closed",
5454
"thread_close_response": "{closer.mention} has closed this Modmail thread.",
5555
"thread_self_close_response": "You have closed this Modmail thread.",
56+
"thread_move_notify": False,
57+
"thread_move_response": "This thread has been moved.",
5658
# moderation
5759
"recipient_color": str(discord.Color.gold()),
5860
"mod_color": str(discord.Color.green()),
@@ -109,6 +111,7 @@ class ConfigManager:
109111
"reply_without_command",
110112
"recipient_thread_close",
111113
"thread_auto_close_silently",
114+
"thread_move_notify",
112115
}
113116

114117
defaults = {**public_keys, **private_keys, **protected_keys}

core/config_help.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,28 @@
300300
"See also: `thread_close_title`, `thread_close_footer`, `thread_close_response`."
301301
]
302302
},
303+
"thread_move_notify": {
304+
"default": "No",
305+
"description": "Notify the recipient if the thread was moved.",
306+
"examples": [
307+
"`{prefix}config set thread_move_notify yes`",
308+
"`{prefix}config set thread_move_notify no`"
309+
],
310+
"notes": [
311+
"See also: `thread_move_response`."
312+
]
313+
},
314+
"thread_move_response": {
315+
"default": "This thread has been moved.",
316+
"description": "This is the message to display to the user when the thread is moved.",
317+
"examples": [
318+
"`{prefix}config set thread_move_response This thread has been moved to another category for review!`"
319+
],
320+
"notes": [
321+
"Only has an effect when `thread_move_notify` is on.",
322+
"See also: `thread_move_notify`."
323+
]
324+
},
303325
"recipient_color": {
304326
"default": "Discord Gold [#F1C40F](https://placehold.it/100/f1c40f?text=+)",
305327
"description": "This is the color of the messages sent by the recipient, this applies to messages received in the thread channel.",
@@ -446,4 +468,4 @@
446468
"This configuration can only to be set through `.env` file or environment (config) variables."
447469
]
448470
}
449-
}
471+
}

core/thread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ async def send(
763763
elif note:
764764
embed.colour = discord.Color.blurple()
765765
else:
766-
embed.set_footer(text=f"Recipient")
766+
embed.set_footer(text=f"Message ID: {message.id}")
767767
embed.colour = self.bot.recipient_color
768768

769769
try:

0 commit comments

Comments
 (0)