ChannelStats: Fix bug when conf.supybot.databases.plugins.channelSpecific is true (KeyError in channels list).

This commit is contained in:
Valentin Lorentz 2013-05-09 12:47:53 +02:00
parent 70a169ab6f
commit 115f8001fe

View File

@ -362,7 +362,9 @@ class ChannelStats(callbacks.Plugin):
irc.error(format('You must be in %s to use this command.', channel)) irc.error(format('You must be in %s to use this command.', channel))
return return
try: try:
stats = self.db.getChannelStats(channel) channeldb = conf.supybot.databases.plugins.channelSpecific. \
getChannelLink(channel)
stats = self.db.getChannelStats(channeldb)
curUsers = len(irc.state.channels[channel].users) curUsers = len(irc.state.channels[channel].users)
s = format(_('On %s there %h been %i messages, containing %i ' s = format(_('On %s there %h been %i messages, containing %i '
'characters, %n, %n, and %n; ' 'characters, %n, %n, and %n; '
@ -387,7 +389,7 @@ class ChannelStats(callbacks.Plugin):
irc.reply(s) irc.reply(s)
except KeyError: except KeyError:
irc.error(format(_('I\'ve never been on %s.'), channel)) irc.error(format(_('I\'ve never been on %s.'), channel))
channelstats = wrap(channelstats, ['channeldb']) channelstats = wrap(channelstats, ['channel'])
Class = ChannelStats Class = ChannelStats