mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Changed the topic command to be topic.set-with-no-number.
This commit is contained in:
parent
30f93fdc8f
commit
0143a41e4f
@ -152,15 +152,6 @@ class Topic(callbacks.Privmsg):
|
||||
except (ValueError, IndexError):
|
||||
irc.error('That\'s not a valid topic number.', Raise=True)
|
||||
|
||||
def topic(self, irc, msg, args, channel):
|
||||
"""[<channel>] <topic>
|
||||
|
||||
Sets the topic of <channel> to <topic>.
|
||||
"""
|
||||
topic = privmsgs.getArgs(args)
|
||||
self._sendTopics(irc, channel, [topic])
|
||||
topic = privmsgs.channel(topic)
|
||||
|
||||
def add(self, irc, msg, args, channel, insert=False):
|
||||
"""[<channel>] <topic>
|
||||
|
||||
@ -299,14 +290,20 @@ class Topic(callbacks.Privmsg):
|
||||
change = privmsgs.channel(change)
|
||||
|
||||
def set(self, irc, msg, args, channel):
|
||||
"""[<channel>] <number> <topic>
|
||||
"""[<channel>] [<number>] <topic>
|
||||
|
||||
Sets the topic <number> to be <text>. <channel> is only necessary if
|
||||
the message isn't sent in the channel itself.
|
||||
Sets the topic <number> to be <text>. If no <number> is given, this
|
||||
sets the entire topic. <channel> is only necessary if the message
|
||||
isn't sent in the channel itself.
|
||||
"""
|
||||
self._canChangeTopic(irc, channel)
|
||||
(i, topic) = privmsgs.getArgs(args, required=2)
|
||||
(i, topic) = privmsgs.getArgs(args, optional=1)
|
||||
topics = self._splitTopic(irc.state.getTopic(channel), channel)
|
||||
try:
|
||||
int(i) # If this isn't a number, do something else.
|
||||
except ValueError:
|
||||
self._sendTopics(irc, channel, [privmsgs.getArgs(args)])
|
||||
return
|
||||
i = self._topicNumber(irc, i, topics=topics)
|
||||
topic = self._formatTopic(irc, msg, channel, topic)
|
||||
topics[i] = topic
|
||||
|
@ -115,15 +115,13 @@ class TopicTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
_ = self.getMsg('topic add foo')
|
||||
self.assertRegexp('topic set -1 bar', 'bar')
|
||||
self.assertNotRegexp('topic set -1 baz', 'bar')
|
||||
|
||||
def testTopic(self):
|
||||
self.assertResponse('topic foo bar baz', 'foo bar baz')
|
||||
self.assertResponse('topic set foo bar baz', 'foo bar baz')
|
||||
|
||||
def testUndo(self):
|
||||
try:
|
||||
original = conf.supybot.plugins.Topic.format()
|
||||
conf.supybot.plugins.Topic.format.setValue('$topic')
|
||||
self.assertResponse('topic ""', '')
|
||||
self.assertResponse('topic set ""', '')
|
||||
self.assertResponse('topic add foo', 'foo')
|
||||
self.assertResponse('topic add bar', 'foo || bar')
|
||||
self.assertResponse('topic add baz', 'foo || bar || baz')
|
||||
|
Loading…
Reference in New Issue
Block a user