@@ -455,7 +455,7 @@ def friends(text, chan, conn, db):
455455 return "it appears no on has friended any ducks yet."
456456
457457 topfriends = sorted (friends .items (), key = operator .itemgetter (1 ), reverse = True )
458- out += ' • ' .join (["{}: {}" .format ('\x02 ' + k [:1 ] + u'\u200b ' + k [1 :] + '\x02 ' , str ( v ) ) for k , v in topfriends ])
458+ out += ' • ' .join (["{}: {:, }" .format ('\x02 ' + k [:1 ] + u'\u200b ' + k [1 :] + '\x02 ' , v ) for k , v in topfriends ])
459459 out = smart_truncate (out )
460460 return out
461461
@@ -498,7 +498,7 @@ def killers(text, chan, conn, db):
498498 return "it appears no on has killed any ducks yet."
499499
500500 topkillers = sorted (killers .items (), key = operator .itemgetter (1 ), reverse = True )
501- out += ' • ' .join (["{}: {}" .format ('\x02 ' + k [:1 ] + u'\u200b ' + k [1 :] + '\x02 ' , str ( v ) ) for k , v in topkillers ])
501+ out += ' • ' .join (["{}: {:, }" .format ('\x02 ' + k [:1 ] + u'\u200b ' + k [1 :] + '\x02 ' , v ) for k , v in topkillers ])
502502 out = smart_truncate (out )
503503 return out
504504
@@ -598,9 +598,10 @@ def duck_merge(text, conn, db, message):
598598 .where (table .c .name == oldnick )
599599 db .execute (query )
600600 db .commit ()
601- message ("Migrated {} duck kills and {} duck friends from {} to {}" .format (duckmerge ["TKILLS" ],
602- duckmerge ["TFRIENDS" ], oldnick ,
603- newnick ))
601+ message ("Migrated {} and {} from {} to {}" .format (
602+ pluralize (duckmerge ["TKILLS" ], "duck kill" ), pluralize (duckmerge ["TFRIENDS" ], "duck friend" ),
603+ oldnick , newnick
604+ ))
604605 else :
605606 return "There are no duck scores to migrate from {}" .format (oldnick )
606607
@@ -631,15 +632,20 @@ def ducks_user(text, nick, chan, conn, db, message):
631632 ducks ["chans" ] += 1
632633 # Check if the user has only participated in the hunt in this channel
633634 if ducks ["chans" ] == 1 and has_hunted_in_chan :
634- message ("{} has killed {} and befriended {} ducks in {}." .format (name , ducks ["chankilled" ],
635- ducks ["chanfriends" ], chan ))
635+ message ("{} has killed {} and befriended {} in {}." .format (
636+ name , pluralize (ducks ["chankilled" ], "duck" ), pluralize (ducks ["chanfriends" ], "duck" ), chan
637+ ))
636638 return
637639 kill_average = int (ducks ["killed" ] / ducks ["chans" ])
638640 friend_average = int (ducks ["friend" ] / ducks ["chans" ])
639641 message (
640- "\x02 {}'s\x02 duck stats: \x02 {}\x02 killed and \x02 {}\x02 befriended in {}. Across {} channels: \x02 {}\x02 killed and \x02 {}\x02 befriended. Averaging \x02 {}\x02 kills and \x02 {}\x02 friends per channel." .format (
641- name , ducks ["chankilled" ], ducks ["chanfriends" ], chan , ducks ["chans" ], ducks ["killed" ], ducks ["friend" ],
642- kill_average , friend_average ))
642+ "\x02 {}'s\x02 duck stats: \x02 {}\x02 killed and \x02 {}\x02 befriended in {}. Across {} channels: \x02 {}\x02 killed and \x02 {}\x02 befriended. Averaging \x02 {}\x02 and \x02 {}\x02 per channel." .format (
643+ name , pluralize (ducks ["chankilled" ], "duck" ), pluralize (ducks ["chanfriends" ], "duck" ),
644+ chan , pluralize (ducks ["chans" ], "channel" ),
645+ pluralize (ducks ["killed" ], "duck" ), pluralize (ducks ["friend" ], "duck" ),
646+ pluralize (kill_average , "kill" ), pluralize (friend_average , "friend" )
647+ )
648+ )
643649 else :
644650 return "It appears {} has not participated in the duck hunt." .format (name )
645651
@@ -666,8 +672,11 @@ def duck_stats(chan, conn, db, message):
666672 killerchan , killscore = sorted (ducks ["killchan" ].items (), key = operator .itemgetter (1 ), reverse = True )[0 ]
667673 friendchan , friendscore = sorted (ducks ["friendchan" ].items (), key = operator .itemgetter (1 ), reverse = True )[0 ]
668674 message (
669- "\x02 Duck Stats:\x02 {} killed and {} befriended in \x02 {}\x02 . Across {} channels \x02 {}\x02 ducks have been killed and \x02 {}\x02 befriended. \x02 Top Channels:\x02 \x02 {}\x02 with {} kills and \x02 {}\x02 with {} friends" .format (
670- ducks ["chankilled" ], ducks ["chanfriends" ], chan , ducks ["chans" ], ducks ["killed" ], ducks ["friend" ],
671- killerchan , killscore , friendchan , friendscore ))
675+ "\x02 Duck Stats:\x02 {:,} killed and {:,} befriended in \x02 {}\x02 . Across {} \x02 {:,}\x02 ducks have been killed and \x02 {:,}\x02 befriended. \x02 Top Channels:\x02 \x02 {}\x02 with {} and \x02 {}\x02 with {}" .format (
676+ ducks ["chankilled" ], ducks ["chanfriends" ], chan , pluralize (ducks ["chans" ], "channel" ),
677+ ducks ["killed" ], ducks ["friend" ],
678+ killerchan , pluralize (killscore , "kill" ),
679+ friendchan , pluralize (friendscore , "friend" )
680+ ))
672681 else :
673682 return "It looks like there has been no duck activity on this channel or network."
0 commit comments