mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-13 04:01:05 +01:00
Seen: prevent KeyError when calling commands on channels that the bot is not in
This fixes a bug introdiced by 38ff1a1137.
This commit is contained in:
parent
7bba16a55e
commit
a85fbead23
@ -236,6 +236,8 @@ class Seen(callbacks.Plugin):
|
|||||||
if name and ircutils.strEqual(name, irc.nick):
|
if name and ircutils.strEqual(name, irc.nick):
|
||||||
irc.reply(_("You've found me!"))
|
irc.reply(_("You've found me!"))
|
||||||
return
|
return
|
||||||
|
if channel not in irc.state.channels:
|
||||||
|
irc.error(_("I'm not in %s." % channel), Raise=True)
|
||||||
if msg.nick not in irc.state.channels[channel].users:
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
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
|
||||||
@ -256,6 +258,8 @@ class Seen(callbacks.Plugin):
|
|||||||
if name and ircutils.strEqual(name, irc.nick):
|
if name and ircutils.strEqual(name, irc.nick):
|
||||||
irc.reply(_("You've found me!"))
|
irc.reply(_("You've found me!"))
|
||||||
return
|
return
|
||||||
|
if channel not in irc.state.channels:
|
||||||
|
irc.error(_("I'm not in %s." % channel), Raise=True)
|
||||||
if msg.nick not in irc.state.channels[channel].users:
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
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
|
||||||
@ -295,6 +299,8 @@ class Seen(callbacks.Plugin):
|
|||||||
Returns the last thing said in <channel>. <channel> is only necessary
|
Returns the last thing said in <channel>. <channel> is only necessary
|
||||||
if the message isn't sent in the channel itself.
|
if the message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
|
if channel not in irc.state.channels:
|
||||||
|
irc.error(_("I'm not in %s." % channel), Raise=True)
|
||||||
if msg.nick not in irc.state.channels[channel].users:
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
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
|
||||||
@ -327,6 +333,8 @@ class Seen(callbacks.Plugin):
|
|||||||
<channel> is only necessary if the message isn't sent in the channel
|
<channel> is only necessary if the message isn't sent in the channel
|
||||||
itself.
|
itself.
|
||||||
"""
|
"""
|
||||||
|
if channel not in irc.state.channels:
|
||||||
|
irc.error(_("I'm not in %s." % channel), Raise=True)
|
||||||
if msg.nick not in irc.state.channels[channel].users:
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user