@@ -424,7 +424,7 @@ def friends(text, chan, conn, db):
424424 return "it appears no on has friended any ducks yet."
425425
426426 topfriends = sorted (friends .items (), key = operator .itemgetter (1 ), reverse = True )
427- out += ' • ' .join (["{}: {}" .format ('\x02 ' + k [:1 ] + u'\u200b ' + k [1 :] + '\x02 ' , str ( v ) ) for k , v in topfriends ])
427+ out += ' • ' .join (["{}: {:, }" .format ('\x02 ' + k [:1 ] + u'\u200b ' + k [1 :] + '\x02 ' , v ) for k , v in topfriends ])
428428 out = smart_truncate (out )
429429 return out
430430
@@ -467,7 +467,7 @@ def killers(text, chan, conn, db):
467467 return "it appears no on has killed any ducks yet."
468468
469469 topkillers = sorted (killers .items (), key = operator .itemgetter (1 ), reverse = True )
470- out += ' • ' .join (["{}: {}" .format ('\x02 ' + k [:1 ] + u'\u200b ' + k [1 :] + '\x02 ' , str ( v ) ) for k , v in topkillers ])
470+ out += ' • ' .join (["{}: {:, }" .format ('\x02 ' + k [:1 ] + u'\u200b ' + k [1 :] + '\x02 ' , v ) for k , v in topkillers ])
471471 out = smart_truncate (out )
472472 return out
473473
@@ -567,9 +567,10 @@ def duck_merge(text, conn, db, message):
567567 .where (table .c .name == oldnick )
568568 db .execute (query )
569569 db .commit ()
570- message ("Migrated {} duck kills and {} duck friends from {} to {}" .format (duckmerge ["TKILLS" ],
571- duckmerge ["TFRIENDS" ], oldnick ,
572- newnick ))
570+ message ("Migrated {} duck kills and {} duck friends from {} to {}" .format (
571+ pluralize (duckmerge ["TKILLS" ], "duck kill" ), pluralize (duckmerge ["TFRIENDS" ], "duck friend" ),
572+ oldnick , newnick
573+ ))
573574 else :
574575 return "There are no duck scores to migrate from {}" .format (oldnick )
575576
@@ -600,15 +601,20 @@ def ducks_user(text, nick, chan, conn, db, message):
600601 ducks ["chans" ] += 1
601602 # Check if the user has only participated in the hunt in this channel
602603 if ducks ["chans" ] == 1 and has_hunted_in_chan :
603- message ("{} has killed {} and befriended {} ducks in {}." .format (name , ducks ["chankilled" ],
604- ducks ["chanfriends" ], chan ))
604+ message ("{} has killed {} and befriended {} in {}." .format (
605+ name , pluralize (ducks ["chankilled" ], "duck" ), pluralize (ducks ["chanfriends" ], "duck" ), chan
606+ ))
605607 return
606608 kill_average = int (ducks ["killed" ] / ducks ["chans" ])
607609 friend_average = int (ducks ["friend" ] / ducks ["chans" ])
608610 message (
609- "\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 (
610- name , ducks ["chankilled" ], ducks ["chanfriends" ], chan , ducks ["chans" ], ducks ["killed" ], ducks ["friend" ],
611- kill_average , friend_average ))
611+ "\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 (
612+ name , pluralize (ducks ["chankilled" ], "duck" ), pluralize (ducks ["chanfriends" ], "duck" ),
613+ chan , pluralize (ducks ["chans" ], "channel" ),
614+ pluralize (ducks ["killed" ], "duck" ), pluralize (ducks ["friend" ], "duck" ),
615+ pluralize (kill_average , "kill" ), pluralize (friend_average , "friend" )
616+ )
617+ )
612618 else :
613619 return "It appears {} has not participated in the duck hunt." .format (name )
614620
@@ -635,8 +641,11 @@ def duck_stats(chan, conn, db, message):
635641 killerchan , killscore = sorted (ducks ["killchan" ].items (), key = operator .itemgetter (1 ), reverse = True )[0 ]
636642 friendchan , friendscore = sorted (ducks ["friendchan" ].items (), key = operator .itemgetter (1 ), reverse = True )[0 ]
637643 message (
638- "\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 (
639- ducks ["chankilled" ], ducks ["chanfriends" ], chan , ducks ["chans" ], ducks ["killed" ], ducks ["friend" ],
640- killerchan , killscore , friendchan , friendscore ))
644+ "\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 (
645+ ducks ["chankilled" ], ducks ["chanfriends" ], chan , pluralize (ducks ["chans" ], "channel" ),
646+ ducks ["killed" ], ducks ["friend" ],
647+ killerchan , pluralize (killscore , "kill" ),
648+ friendchan , pluralize (friendscore , "friend" )
649+ ))
641650 else :
642651 return "It looks like there has been no duck activity on this channel or network."
0 commit comments