Fixed pluralization bug in stats command.

This commit is contained in:
Jeremy Fincher 2003-10-09 19:20:50 +00:00
parent 18a8f81985
commit bc3ec9f70c

View File

@ -410,16 +410,25 @@ class ChannelDB(plugins.ChannelDBHandler, callbacks.PrivmsgCommandAndRegexp):
irc.reply(msg, 'I have no stats for that user.') irc.reply(msg, 'I have no stats for that user.')
return return
values = cursor.fetchone() values = cursor.fetchone()
s = '%s has sent %s messages; a total of %s characters, %s words, ' \ s = '%s has sent %s; a total of %s, %s, ' \
'%s smileys, and %s frowns; %s of those messages were ACTIONs. ' \ '%s, and %s; %s of those messages %s' \
'%s has joined %s times, parted %s times, kicked someone %s times'\ '%s has joined %s, parted %s, kicked someone %s, '\
' been kicked %s times, changed the topic %s times, ' \ 'been kicked %s, changed the topic %s, ' \
'and changed the mode %s times.' % \ 'and changed the mode %s.' % \
(name, values.msgs, values.chars, values.words, (name, utils.nItems(values.msgs, 'message'),
values.smileys, values.frowns, values.actions, utils.nItems(values.chars, 'character'),
name, values.joins, values.parts, values.kicks, utils.nItems(values.words, 'word'),
values.kicked, values.topics, utils.nItems(values.smileys, 'smiley'),
values.modes) utils.nItems(values.frowns, 'frown'),
values.actions, values.actions == 1 and 'was an ACTION. '
or 'were ACTIONs. ',
name,
utils.nItems(values.joins, 'time'),
utils.nItems(values.parts, 'time'),
utils.nItems(values.kicks, 'time'),
utils.nItems(values.kicked, 'time'),
utils.nItems(values.topics, 'time'),
utils.nItems(values.modes, 'time'))
irc.reply(msg, s) irc.reply(msg, s)
def channelstats(self, irc, msg, args): def channelstats(self, irc, msg, args):