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
|
* Changed the supybot.user configuration variable so that if it
|
||||||
isn't configured, the user will stay up-to-date with the current
|
isn't configured, the user will stay up-to-date with the current
|
||||||
version of the bot. To take advantage of this, set your
|
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)
|
irc.error('There is no default topic configured for %s.' % channel)
|
||||||
default = wrap(default, ['canChangeTopic'])
|
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
|
Class = Topic
|
||||||
|
|
||||||
|
|
||||||
|
@ -190,6 +190,19 @@ class TopicTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
self.assertResponse('topic', 'foo || bar')
|
self.assertResponse('topic', 'foo || bar')
|
||||||
finally:
|
finally:
|
||||||
conf.supybot.plugins.Topic.format.setValue(original)
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user