mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 18:44:04 +01:00
Fix bug #1031277, exception in some Topic commands when trying to modify a
topic in a channel that the bot is not in.
This commit is contained in:
parent
e48b78787a
commit
535f4a164f
@ -142,7 +142,10 @@ class Topic(callbacks.Privmsg):
|
||||
irc.queueMsg(ircmsgs.topic(channel, newTopic))
|
||||
|
||||
def _canChangeTopic(self, irc, channel):
|
||||
c = irc.state.channels[channel]
|
||||
try:
|
||||
c = irc.state.channels[channel]
|
||||
except KeyError:
|
||||
irc.error('I\'m not currently in %s.' % channel, Raise=True)
|
||||
if irc.nick not in c.ops and 't' in c.modes:
|
||||
irc.error('I can\'t change the topic, I\'m not opped and %s '
|
||||
'is +t.' % channel, Raise=True)
|
||||
|
@ -58,6 +58,7 @@ class TopicTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
m = self.getMsg('topic add bar')
|
||||
self.assertEqual(m.command, 'TOPIC')
|
||||
self.assertEqual(m.args[0], self.channel)
|
||||
self.assertError('topic add #floorgle')
|
||||
|
||||
def testChange(self):
|
||||
_ = self.getMsg('topic add foo')
|
||||
|
Loading…
Reference in New Issue
Block a user