diff --git a/plugins/Topic/config.py b/plugins/Topic/config.py index 4a3712ed6..5bbe8f200 100644 --- a/plugins/Topic/config.py +++ b/plugins/Topic/config.py @@ -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 diff --git a/plugins/Topic/plugin.py b/plugins/Topic/plugin.py index 3836c430c..329f51fa4 100644 --- a/plugins/Topic/plugin.py +++ b/plugins/Topic/plugin.py @@ -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) diff --git a/plugins/Topic/test.py b/plugins/Topic/test.py index d6b7be816..45738adf7 100644 --- a/plugins/Topic/test.py +++ b/plugins/Topic/test.py @@ -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: