Skip to content

Commit 5f77f8e

Browse files
committed
Updating modmail.move
Added specifics to arguments of move, allowing for an easily expandable set of specifics for the command Added a specific for silent moving for modmail.move
1 parent 6bf83c8 commit 5f77f8e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

cogs/modmail.py

Lines changed: 14 additions & 5 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,25 +286,34 @@ 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.
294294
"""
295295
thread = ctx.thread
296+
silent = False
297+
298+
if specifics:
299+
silent_words = ['silent', 'quiet']
300+
silent = any(word in specifics for word in silent_words)
301+
296302
await thread.channel.edit(category=category, sync_permissions=True)
303+
297304
try:
298-
thread_move_notify = strtobool(self.config["thread_move_notify"])
305+
thread_move_notify = strtobool(self.bot.config["thread_move_notify"])
299306
except ValueError:
300-
thread_move_notify = self.config.remove("thread_move_notify")
301-
if thread_move_notify:
307+
thread_move_notify = self.bot.config.remove("thread_move_notify")
308+
309+
if thread_move_notify and not silent:
302310
embed = discord.Embed(
303311
title="Thread Moved",
304312
description=self.bot.config["thread_move_response"],
305313
color=discord.Color.red())
306314

307315
await thread.recipient.send(embed=embed)
316+
308317
sent_emoji, _ = await self.bot.retrieve_emoji()
309318
try:
310319
await ctx.message.add_reaction(sent_emoji)

0 commit comments

Comments
 (0)