def testStringSurroundedBySpaces(self): v = registry.StringSurroundedBySpaces('foo', 'help') self.assertEqual(v(), ' foo ') v.setValue('||') self.assertEqual(v(), ' || ') v.set('&&') self.assertEqual(v(), ' && ')
class FeedItemSortOrder(registry.OnlySomeStrings): """Valid values include 'asInFeed', 'oldestFirst', 'newestFirst'.""" validStrings = ('asInFeed', 'oldestFirst', 'newestFirst') RSS = conf.registerPlugin('RSS') conf.registerChannelValue( RSS, 'bold', registry.Boolean( True, _("""Determines whether the bot will bold the title of the feed when it announces news."""))) conf.registerChannelValue( RSS, 'headlineSeparator', registry.StringSurroundedBySpaces( '|', _("""Determines what string is used to separate headlines in new feeds."""))) conf.registerChannelValue( RSS, 'announcementPrefix', registry.StringWithSpaceOnRight( _('News from '), _("""Determines what prefix is prepended (if any) to the news item announcements made in the channel."""))) conf.registerChannelValue( RSS, 'announcementSeparator', registry.StringWithSpaceOnRight( _(': '), _("""Determines what suffix is appended to the feed name in a news item."""))) conf.registerChannelValue(
# user or not. You should effect your configuration by manipulating the # registry as appropriate. from supybot.questions import expect, anything, something, yn conf.registerPlugin('Topic', True) class TopicFormat(registry.TemplatedString): "Value must include $topic, otherwise the actual topic would be left out." requiredTemplates = ['topic'] Topic = conf.registerPlugin('Topic') conf.registerChannelValue( Topic, 'separator', registry.StringSurroundedBySpaces( ' || ', _("""Determines what separator is used between individually added topics in the channel topic."""))) conf.registerChannelValue( Topic, 'format', TopicFormat( '$topic ($nick)', _("""Determines what format is used to add topics in the topic. All the standard substitutes apply, in addition to "$topic" for the topic itself."""))) conf.registerChannelValue( Topic, 'recognizeTopiclen', registry.Boolean( True, _("""Determines whether the bot will recognize the TOPICLEN value sent to it by the server and thus refuse to send TOPICs longer than the TOPICLEN. These topics are likely to be truncated by the
MCStatus, 'prefix', registry.String( '', _("""This text is prepended to the mcstatus command's output."""))) conf.registerChannelValue( MCStatus, 'suffix', registry.String( '', _("""This text is appended to the mcstatus command's output."""))) conf.registerChannelValue( MCStatus, 'separator', registry.StringSurroundedBySpaces( '|', _("""This text is inserted between service-status pairs, surrounded by spaces until I find a better way."""))) conf.registerGroup(MCStatus, 'service') conf.registerChannelValue( MCStatus.service, 'prefix', registry.String( '', _("""This text is prepended to each service's name."""))) conf.registerChannelValue( MCStatus.service, 'suffix', registry.StringWithSpaceOnRight( ':',