@@ -420,7 +420,7 @@ async def user_nomination_counts(self, user: MemberOrUser) -> tuple[str, str]:
420
420
421
421
return "Nominations" , "\n " .join (output )
422
422
423
- async def user_messages (self , user : MemberOrUser ) -> tuple [bool | str , tuple [ str , str ] ]:
423
+ async def user_messages (self , user : MemberOrUser ) -> tuple [str , str ]:
424
424
"""
425
425
Gets the amount of messages for `member`.
426
426
@@ -435,15 +435,21 @@ async def user_messages(self, user: MemberOrUser) -> tuple[bool | str, tuple[str
435
435
if e .status == 404 :
436
436
activity_output = "No activity"
437
437
else :
438
- activity_output .append (f"{ user_activity ['total_messages' ]:,} " or "No messages" )
439
- activity_output .append (f"{ user_activity ['activity_blocks' ]:,} " or "No activity" )
438
+ total_message_text = (
439
+ f"{ user_activity ['total_messages' ]:,} " if user_activity ["total_messages" ] else "No messages"
440
+ )
441
+ activity_blocks_text = (
442
+ f"{ user_activity ['activity_blocks' ]:,} " if user_activity ["activity_blocks" ] else "No activity"
443
+ )
444
+ activity_output .append (total_message_text )
445
+ activity_output .append (activity_blocks_text )
440
446
441
447
activity_output = "\n " .join (
442
448
f"{ name } : { metric } "
443
449
for name , metric in zip (["Messages" , "Activity blocks" ], activity_output , strict = True )
444
450
)
445
451
446
- return ( "Activity" , activity_output )
452
+ return "Activity" , activity_output
447
453
448
454
def format_fields (self , mapping : Mapping [str , Any ], field_width : int | None = None ) -> str :
449
455
"""Format a mapping to be readable to a human."""
0 commit comments