def testJson(self): data = {'foo': ['bar', 'baz', 5], 'qux': None} v = registry.Json('foo', 'help') self.assertEqual(v(), 'foo') v.setValue(data) self.assertEqual(v(), data) self.assertIsNot(v(), data) with v.editable() as dict_: dict_['supy'] = 'bot' del dict_['qux'] self.assertNotIn('supy', v()) self.assertIn('qux', v()) self.assertIn('supy', v()) self.assertEqual(v()['supy'], 'bot') self.assertIsNot(v()['supy'], 'bot') self.assertNotIn('qux', v())
def configure(advanced): # This will be called by supybot to configure this module. advanced is # a bool that specifies whether the user identified themself as an advanced # user or not. You should effect your configuration by manipulating the # registry as appropriate. from supybot.questions import expect, anything, something, yn conf.registerPlugin('Gogs', True) Gogs = conf.registerPlugin('Gogs') # Settings conf.registerChannelValue(Gogs, 'projects', registry.Json({}, _("""List of projects"""))) # Format conf.registerGroup(Gogs, 'format') conf.registerChannelValue(Gogs, 'use-notices', registry.Boolean(False, _("""Determines whether the bot should announce using NOTICE instead of PRIVMSG."""))) conf.registerChannelValue(Gogs.format, 'push', registry.String(_("""\x02[{repository[name]}]\x02 {pusher[username]} pushed \x02{total_commits_count} commit(s)\x02 to \x02{repository[name]} {ref}\x02:"""), _("""Format for push events."""))) conf.registerChannelValue(Gogs.format, 'commit', registry.String(_("""\x02[{repository[name]}]\x02 {short_id} \x02{short_message}\x02 by {author[name]}"""), _("""Format for commits."""))) conf.registerChannelValue(Gogs.format, 'create', registry.String(_("""\x02[{repository[name]}]\x02 {sender[username]} created a new {ref_type} : {ref}"""),
except: # Placeholder that allows to run the plugin on a bot # without the i18n module _ = lambda x: x def configure(advanced): # This will be called by supybot to configure this module. advanced is # a bool that specifies whether the user identified themself as an advanced # user or not. You should effect your configuration by manipulating the # registry as appropriate. from supybot.questions import expect, anything, something, yn conf.registerPlugin('Wekan', True) Wekan = conf.registerPlugin('Wekan') # Settings conf.registerChannelValue(Wekan, 'boards', registry.Json({}, _("""List of boards"""))) # Format conf.registerGroup(Wekan, 'format') conf.registerChannelValue( Wekan, 'use-notices', registry.Boolean( False, _("""Determines whether the bot should announce using NOTICE instead of PRIVMSG.""" )))
from supybot.i18n import internationalizeDocstring _ = PluginInternationalization('Iwant') except: # This are useless functions that's allow to run the plugin on a bot # without the i18n plugin _ = lambda x: x internationalizeDocstring = lambda x: x def configure(advanced): # This will be called by supybot to configure this module. advanced is # a bool that specifies whether the user identified himself as an advanced # user or not. You should effect your configuration by manipulating the # registry as appropriate. from supybot.questions import expect, anything, something, yn conf.registerPlugin('Iwant', True) Iwant = conf.registerPlugin('Iwant') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Iwant, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) conf.registerChannelValue( Iwant, 'wishlist', registry.Json([], _("""List of wanted things. Don't edit this variable unless you know what you do."""))) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# a bool that specifies whether the user identified himself as an advanced # user or not. You should effect your configuration by manipulating the # registry as appropriate. from supybot.questions import expect, anything, something, yn conf.registerPlugin('Redmine', True) Redmine = conf.registerPlugin('Redmine') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Redmine, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) conf.registerGlobalValue( Redmine, 'sites', registry.Json({}, _("""JSON-formatted dict of site data. Don't edit this unless you known what you are doing. Use @site add and @site remove instead."""))) conf.registerChannelValue( Redmine, 'defaultsite', registry.String('', _("""Default site for this channel."""))) conf.registerGroup(Redmine, 'format') conf.registerChannelValue( Redmine.format, 'projects', registry.String('$name ($identifier)', _("""Format of projects displayed by @projects."""))) conf.registerChannelValue( Redmine.format, 'issues', registry.String( '\x02#$id)i: $subject\x02 (last update: ' '$updated_on / status: $status__name)', _("""Format of issues displayed by @issues.""")))