17
17
from core .models import PermissionLevel
18
18
from core .paginator import EmbedPaginatorSession
19
19
from core .time import UserFriendlyTime , human_timedelta
20
- from core .utils import format_preview , User , create_not_found_embed , format_description , strtobool
20
+ from core .utils import (
21
+ format_preview ,
22
+ User ,
23
+ create_not_found_embed ,
24
+ format_description ,
25
+ strtobool ,
26
+ )
21
27
22
28
logger = logging .getLogger ("Modmail" )
23
29
@@ -286,7 +292,9 @@ async def snippet_edit(self, ctx, name: str.lower, *, value):
286
292
@commands .command ()
287
293
@checks .has_permissions (PermissionLevel .MODERATOR )
288
294
@checks .thread_only ()
289
- async def move (self , ctx , category : discord .CategoryChannel , * , specifics : str = None ):
295
+ async def move (
296
+ self , ctx , category : discord .CategoryChannel , * , specifics : str = None
297
+ ):
290
298
"""
291
299
Move a thread to another category.
292
300
@@ -297,7 +305,7 @@ async def move(self, ctx, category: discord.CategoryChannel, *, specifics: str =
297
305
silent = False
298
306
299
307
if specifics :
300
- silent_words = [' silent' , ' silently' ]
308
+ silent_words = [" silent" , " silently" ]
301
309
silent = any (word in silent_words for word in specifics .split ())
302
310
303
311
await thread .channel .edit (category = category , sync_permissions = True )
@@ -311,7 +319,7 @@ async def move(self, ctx, category: discord.CategoryChannel, *, specifics: str =
311
319
embed = discord .Embed (
312
320
title = "Thread Moved" ,
313
321
description = self .bot .config ["thread_move_response" ],
314
- color = self .bot .main_color
322
+ color = self .bot .main_color ,
315
323
)
316
324
await thread .recipient .send (embed = embed )
317
325
@@ -718,6 +726,43 @@ async def logs_closed_by(self, ctx, *, user: User = None):
718
726
session = EmbedPaginatorSession (ctx , * embeds )
719
727
await session .run ()
720
728
729
+ @logs .command (name = "responded" )
730
+ @checks .has_permissions (PermissionLevel .SUPPORTER )
731
+ async def logs_responded (self , ctx , * , user : User = None ):
732
+ """
733
+ Get all logs where the specified user has responded at least once.
734
+
735
+ If no `user` is provided, the user will be the person who sent this command.
736
+ `user` may be a user ID, mention, or name.
737
+ """
738
+ user = user if user is not None else ctx .author
739
+
740
+ entries = []
741
+ async for l in self .bot .db .logs .find (
742
+ {
743
+ "messages" : {
744
+ "$elemMatch" : {
745
+ "author.id" : str (user .id ),
746
+ "author.mod" : True ,
747
+ "type" : {"$in" : ["anonymous" , "thread_message" ]},
748
+ }
749
+ }
750
+ }
751
+ ):
752
+ entries .append (l )
753
+
754
+ embeds = self .format_log_embeds (entries , avatar_url = self .bot .guild .icon_url )
755
+
756
+ if not embeds :
757
+ embed = discord .Embed (
758
+ color = discord .Color .red (),
759
+ description = "No log entries have been found for that query" ,
760
+ )
761
+ return await ctx .send (embed = embed )
762
+
763
+ session = EmbedPaginatorSession (ctx , * embeds )
764
+ await session .run ()
765
+
721
766
@logs .command (name = "search" , aliases = ["find" ])
722
767
@checks .has_permissions (PermissionLevel .SUPPORTER )
723
768
async def logs_search (self , ctx , limit : Optional [int ] = None , * , query ):
0 commit comments