mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 12:49:24 +01:00
Added Topic.separator.
This commit is contained in:
parent
d6136cc39e
commit
c350baa2ae
@ -1,3 +1,7 @@
|
||||
* Added a Topic.separator command, which replaces the current
|
||||
separator with a new separator, changing the topic to reflect the
|
||||
change.
|
||||
|
||||
* Changed the supybot.user configuration variable so that if it
|
||||
isn't configured, the user will stay up-to-date with the current
|
||||
version of the bot. To take advantage of this, set your
|
||||
|
@ -425,6 +425,17 @@ class Topic(callbacks.Privmsg):
|
||||
irc.error('There is no default topic configured for %s.' % channel)
|
||||
default = wrap(default, ['canChangeTopic'])
|
||||
|
||||
def separator(self, irc, msg, args, channel, separator):
|
||||
"""[<channel>] <separator>
|
||||
|
||||
Sets the topic separator for <channel> to <separator> Converts the
|
||||
current topic appropriately.
|
||||
"""
|
||||
topics = self._splitTopic(irc.state.getTopic(channel), channel)
|
||||
self.setRegistryValue('separator', separator, channel)
|
||||
self._sendTopics(irc, channel, topics)
|
||||
separator = wrap(separator, ['canChangeTopic', 'something'])
|
||||
|
||||
Class = Topic
|
||||
|
||||
|
||||
|
@ -191,6 +191,19 @@ class TopicTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
finally:
|
||||
conf.supybot.plugins.Topic.format.setValue(original)
|
||||
|
||||
def testSeparator(self):
|
||||
original = conf.supybot.plugins.Topic.format()
|
||||
try:
|
||||
conf.supybot.plugins.Topic.format.setValue('$topic')
|
||||
self.assertResponse('topic add foo', 'foo')
|
||||
self.assertResponse('topic add bar', 'foo || bar')
|
||||
self.assertResponse('topic add baz', 'foo || bar || baz')
|
||||
self.assertResponse('topic separator |', 'foo | bar | baz')
|
||||
self.assertResponse('topic separator ::', 'foo :: bar :: baz')
|
||||
self.assertResponse('topic separator ||', 'foo || bar || baz')
|
||||
finally:
|
||||
conf.supybot.plugins.Topic.format.setValue(original)
|
||||
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user