mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-03 08:04:07 +01:00
ChannelStats: Skip checks of nick in irc.state.channels[channel] when channel databases are linked.
It crashes with KeyError because databases.plugins.channelspecific sets channel='#', which is a non-existent channel. And it doesn't make sense to check for presence in channel if the DB is shared between all channels anyway.
This commit is contained in:
parent
c489d2e9be
commit
2bbd43fd85
@ -242,9 +242,11 @@ class ChannelStats(callbacks.Plugin):
|
|||||||
necessary if the message isn't sent on the channel itself. If <name>
|
necessary if the message isn't sent on the channel itself. If <name>
|
||||||
isn't given, it defaults to the user sending the command.
|
isn't given, it defaults to the user sending the command.
|
||||||
"""
|
"""
|
||||||
if msg.nick not in irc.state.channels[channel].users:
|
if channel != '#':
|
||||||
irc.error(format('You must be in %s to use this command.', channel))
|
# Skip this check if databases.plugins.channelspecific is False.
|
||||||
return
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
if name and ircutils.strEqual(name, irc.nick):
|
if name and ircutils.strEqual(name, irc.nick):
|
||||||
id = 0
|
id = 0
|
||||||
elif not name:
|
elif not name:
|
||||||
@ -303,9 +305,11 @@ class ChannelStats(callbacks.Plugin):
|
|||||||
'kicks', 'kicked', 'topics', and 'modes'. Any simple mathematical
|
'kicks', 'kicked', 'topics', and 'modes'. Any simple mathematical
|
||||||
expression involving those variables is permitted.
|
expression involving those variables is permitted.
|
||||||
"""
|
"""
|
||||||
if msg.nick not in irc.state.channels[channel].users:
|
if channel != '#':
|
||||||
irc.error(format('You must be in %s to use this command.', channel))
|
# Skip this check if databases.plugins.channelspecific is False.
|
||||||
return
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
expr = expr.lower()
|
expr = expr.lower()
|
||||||
users = []
|
users = []
|
||||||
for ((c, id), stats) in self.db.items():
|
for ((c, id), stats) in self.db.items():
|
||||||
|
Loading…
Reference in New Issue
Block a user