mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Topic: Add supybot.plugins.Topic.alwaysSetOnJoin.
This commit is contained in:
parent
e3acc03fd6
commit
b57be07f1c
@ -61,6 +61,9 @@ conf.registerChannelValue(Topic, 'recognizeTopiclen',
|
||||
conf.registerChannelValue(Topic, 'default',
|
||||
registry.String('', _("""Determines what the default topic for the channel
|
||||
is. This is used by the default command to set this topic.""")))
|
||||
conf.registerChannelValue(Topic, 'alwaysSetOnJoin',
|
||||
registry.Boolean(False, _("""Determines whether the bot will set the topic
|
||||
every time it joins, or only if the topic is empty.""")))
|
||||
conf.registerGroup(Topic, 'undo')
|
||||
conf.registerChannelValue(Topic.undo, 'max',
|
||||
registry.NonNegativeInteger(10, _("""Determines the number of previous
|
||||
|
@ -248,7 +248,7 @@ class Topic(callbacks.Plugin):
|
||||
self.log.debug('Not trying to restore topic in %s. I\'m not opped '
|
||||
'and %s is +t.', channel, channel)
|
||||
return
|
||||
if c.topic == '':
|
||||
if c.topic == '' or self.registryValue('alwaysSetOnJoin', channel):
|
||||
try:
|
||||
topics = self.lastTopics[channel]
|
||||
self._sendTopics(irc, channel, topics)
|
||||
|
@ -225,6 +225,7 @@ class TopicTestCase(ChannelPluginTestCase):
|
||||
finally:
|
||||
conf.supybot.plugins.Topic.default.setValue(original)
|
||||
|
||||
|
||||
def testTopic(self):
|
||||
original = conf.supybot.plugins.Topic.format()
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user