From 4a36ef95ec058d36bf0357449f279782926f633f Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 21 Aug 2004 09:49:45 +0000 Subject: [PATCH] Let's make sure is always in the string. --- plugins/Topic.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/Topic.py b/plugins/Topic.py index 079abce68..069a7c6a7 100644 --- a/plugins/Topic.py +++ b/plugins/Topic.py @@ -55,8 +55,17 @@ conf.registerPlugin('Topic') conf.registerChannelValue(conf.supybot.plugins.Topic, 'separator', registry.StringSurroundedBySpaces(' || ', """Determines what separator is used between individually added topics in the channel topic.""")) + +class TopicFormat(registry.String): + "Value must include $topic, otherwise the actual topic would be left out." + def setValue(self, v): + if '$topic' in v or '${topic}' in v: + registry.String.setValue(self, v) + else: + self.error() + conf.registerChannelValue(conf.supybot.plugins.Topic, 'format', - registry.String('$topic ($nick)', """Determines what format is used to add + TopicFormat('$topic ($nick)', """Determines what format is used to add topics in the topic. All the standard substitutes apply, in addiction to "$topic" for the topic itself."""))