1717from core .models import PermissionLevel
1818from core .paginator import EmbedPaginatorSession
1919from 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+ )
2127
2228logger = logging .getLogger ("Modmail" )
2329
@@ -286,7 +292,9 @@ async def snippet_edit(self, ctx, name: str.lower, *, value):
286292 @commands .command ()
287293 @checks .has_permissions (PermissionLevel .MODERATOR )
288294 @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+ ):
290298 """
291299 Move a thread to another category.
292300
@@ -297,7 +305,7 @@ async def move(self, ctx, category: discord.CategoryChannel, *, specifics: str =
297305 silent = False
298306
299307 if specifics :
300- silent_words = [' silent' , ' silently' ]
308+ silent_words = [" silent" , " silently" ]
301309 silent = any (word in silent_words for word in specifics .split ())
302310
303311 await thread .channel .edit (category = category , sync_permissions = True )
@@ -311,7 +319,7 @@ async def move(self, ctx, category: discord.CategoryChannel, *, specifics: str =
311319 embed = discord .Embed (
312320 title = "Thread Moved" ,
313321 description = self .bot .config ["thread_move_response" ],
314- color = self .bot .main_color
322+ color = self .bot .main_color ,
315323 )
316324 await thread .recipient .send (embed = embed )
317325
@@ -718,6 +726,43 @@ async def logs_closed_by(self, ctx, *, user: User = None):
718726 session = EmbedPaginatorSession (ctx , * embeds )
719727 await session .run ()
720728
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+
721766 @logs .command (name = "search" , aliases = ["find" ])
722767 @checks .has_permissions (PermissionLevel .SUPPORTER )
723768 async def logs_search (self , ctx , limit : Optional [int ] = None , * , query ):
0 commit comments