本文整理汇总了Python中supybot.conf.registerGroup函数的典型用法代码示例。如果您正苦于以下问题:Python registerGroup函数的具体用法?Python registerGroup怎么用?Python registerGroup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了registerGroup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: registerBugzilla
def registerBugzilla(name, url=''):
if (not re.match('\w+$', name)):
s = utils.str.normalizeWhitespace(BugzillaName.__doc__)
raise registry.InvalidRegistryValue("%s (%s)" % (s, name))
install = conf.registerGroup(conf.supybot.plugins.Bugzilla.bugzillas,
name.lower())
conf.registerGlobalValue(install, 'url',
registry.String(url, """Determines the URL to this Bugzilla
installation. This must be identical to the urlbase (or sslbase)
parameter used by the installation. (The url that shows up in
emails.) It must end with a forward slash."""))
conf.registerChannelValue(install, 'queryTerms',
registry.String('',
"""Additional search terms in QuickSearch format, that will be added to
every search done with "query" against this installation."""))
# conf.registerGlobalValue(install, 'aliases',
# BugzillaNames([], """Alternate names for this Bugzilla
# installation. These must be globally unique."""))
conf.registerGroup(install, 'watchedItems', orderAlphabetically=True)
conf.registerChannelValue(install.watchedItems, 'product',
registry.CommaSeparatedListOfStrings([],
"""What products should be reported to this channel?"""))
conf.registerChannelValue(install.watchedItems, 'component',
registry.CommaSeparatedListOfStrings([],
"""What components should be reported to this channel?"""))
conf.registerChannelValue(install.watchedItems, 'changer',
registry.SpaceSeparatedListOfStrings([],
"""Whose changes should be reported to this channel?"""))
conf.registerChannelValue(install.watchedItems, 'all',
registry.Boolean(False,
"""Should *all* changes be reported to this channel?"""))
conf.registerChannelValue(install, 'reportedChanges',
registry.CommaSeparatedListOfStrings(['newBug', 'newAttach', 'Flags',
'Attachment Flags', 'Resolution', 'Product', 'Component'],
"""The names of fields, as they appear in bugmail, that should be
reported to this channel."""))
conf.registerGroup(install, 'traces')
conf.registerChannelValue(install.traces, 'report',
registry.Boolean(False, """Some Bugzilla installations have gdb
stack traces in comments. If you turn this on, the bot will report
some basic details of any trace that shows up in the comments of
a new bug."""))
conf.registerChannelValue(install.traces, 'ignoreFunctions',
registry.SpaceSeparatedListOfStrings(['__kernel_vsyscall', 'raise',
'abort', '??'], """Some functions are useless to report, from a stack trace.
This contains a list of function names to skip over when reporting
traces to the channel."""))
#conf.registerChannelValue(install.traces, 'crashStarts',
# registry.CommaSeparatedListOfStrings([],
# """These are function names that indicate where a crash starts
# in a stack trace."""))
conf.registerChannelValue(install.traces, 'frameLimit',
registry.PositiveInteger(5, """How many stack frames should be
reported from the crash?"""))
示例2: clear_repos
def clear_repos(self):
"Remove all defined repositories."
plugin_group = conf.supybot.plugins.get('Git')
try:
plugin_group.unregister('repos')
except registry.NonExistentRegistryEntry:
pass
conf.registerGroup(plugin_group, 'repos')
conf.supybot.plugins.Git.repolist.setValue('')
self.assertNotError('reload Git')
expected = ['The operation succeeded.',
'Git reinitialized with 0 repositories.',
'The operation succeeded.'
]
self.assertResponses('reload Git', expected)
示例3: register_feed_config
def register_feed_config(self, name, url=''):
self.registryValue('feeds').add(name)
group = self.registryValue('feeds', value=False)
conf.registerGlobalValue(group, name, registry.String(url, ''))
feed_group = conf.registerGroup(group, name)
conf.registerChannelValue(feed_group, 'format',
registry.String('', _("""Feed-specific format. Defaults to
supybot.plugins.RSS.format if empty.""")))
conf.registerChannelValue(feed_group, 'announceFormat',
registry.String('', _("""Feed-specific announce format.
Defaults to supybot.plugins.RSS.announceFormat if empty.""")))
示例4: register_jira_install
def register_jira_install(self, handle):
group = conf.registerGroup(conf.supybot.plugins.JIRA.installs, handle)
conf.registerGlobalValue(group, "url",
registry.String("", "URL of the JIRA install, e.g. " \
"http://issues.foresightlinux.org/jira"))
conf.registerGlobalValue(group, "username",
registry.String("", "Username to login the JIRA install",
private=True))
conf.registerGlobalValue(group, "password",
registry.String("", "Password to login the JIRA install",
private=True))
示例5: repo_option
def repo_option(reponame, option):
''' Return a repo-specific option, registering on the fly. '''
repos = global_option('repos')
try:
repo = repos.get(reponame)
except registry.NonExistentRegistryEntry:
repo = conf.registerGroup(repos, reponame)
try:
return repo.get(option)
except registry.NonExistentRegistryEntry:
conf.registerGlobalValue(repo, option, _REPO_OPTIONS[option]())
return repo.get(option)
示例6: watch_option
def watch_option(watchname, option):
''' Return a watch-specific option, registering on the fly. '''
watches = global_option('watches')
try:
watch = watches.get(watchname)
except registry.NonExistentRegistryEntry:
watch = conf.registerGroup(watches, watchname)
try:
return watch.get(option)
except registry.NonExistentRegistryEntry:
conf.registerGlobalValue(watch, option, _WATCH_OPTIONS[option]())
return watch.get(option)
示例7: registerBugtracker
def registerBugtracker(name, url='', description='', trackertype=''):
conf.supybot.plugins.Bugtracker.bugtrackers().add(name)
group = conf.registerGroup(conf.supybot.plugins.Bugtracker.bugtrackers, name)
URL = conf.registerGlobalValue(group, 'url', registry.String(url, ''))
DESC = conf.registerGlobalValue(group, 'description', registry.String(description, ''))
TRACKERTYPE = conf.registerGlobalValue(group, 'trackertype', registry.String(trackertype, ''))
if url:
URL.setValue(url)
if description:
DESC.setValue(description)
if trackertype:
if defined_bugtrackers.has_key(trackertype.lower()):
TRACKERTYPE.setValue(trackertype.lower())
else:
raise BugtrackerError("Unknown trackertype: %s" % trackertype)
示例8: register_feed_config
def register_feed_config(self, name, url=''):
self.registryValue('feeds').add(name)
group = self.registryValue('feeds', value=False)
conf.registerGlobalValue(group, name, registry.String(url, ''))
feed_group = conf.registerGroup(group, name)
conf.registerChannelValue(feed_group, 'format',
registry.String('', _("""Feed-specific format. Defaults to
supybot.plugins.RSS.format if empty.""")))
conf.registerChannelValue(feed_group, 'announceFormat',
registry.String('', _("""Feed-specific announce format.
Defaults to supybot.plugins.RSS.announceFormat if empty.""")))
conf.registerGlobalValue(feed_group, 'waitPeriod',
registry.NonNegativeInteger(0, _("""If set to a non-zero
value, overrides supybot.plugins.RSS.waitPeriod for this
particular feed.""")))
示例9: register_feed_config
def register_feed_config(self, name, url=''):
self.registryValue('feeds').add(name)
group = self.registryValue('feeds', value=False)
conf.registerGlobalValue(group, name,
registry.String(url, """The URL for the feed
%s. Note that because
announced lines are cached,
you may need to reload this
plugin after changing this
option.""" % name))
feed_group = conf.registerGroup(group, name)
conf.registerChannelValue(feed_group, 'format',
registry.String('', _("""Feed-specific format. Defaults to
supybot.plugins.RSS.format if empty.""")))
conf.registerChannelValue(feed_group, 'announceFormat',
registry.String('', _("""Feed-specific announce format.
Defaults to supybot.plugins.RSS.announceFormat if empty.""")))
conf.registerGlobalValue(feed_group, 'waitPeriod',
registry.NonNegativeInteger(0, _("""If set to a non-zero
value, overrides supybot.plugins.RSS.waitPeriod for this
particular feed.""")))
示例10: Networks
conf.registerGlobalValue(Services, 'disabledNetworks',
Networks(_('QuakeNet').split(), _("""Determines what networks this plugin
will be disabled on.""")))
conf.registerGlobalValue(Services, 'noJoinsUntilIdentified',
registry.Boolean(False, _("""Determines whether the bot will not join any
channels until it is identified. This may be useful, for instances, if
you have a vhost that isn't set until you're identified, or if you're
joining +r channels that won't allow you to join unless you identify.""")))
conf.registerGlobalValue(Services, 'ghostDelay',
registry.PositiveInteger(60, _("""Determines how many seconds the bot will
wait between successive GHOST attempts.""")))
conf.registerGlobalValue(Services, 'NickServ',
ValidNickOrEmptyString('', _("""Determines what nick the 'NickServ' service
has.""")))
conf.registerGroup(Services.NickServ, 'password')
conf.registerGlobalValue(Services, 'ChanServ',
ValidNickOrEmptyString('', _("""Determines what nick the 'ChanServ' service
has.""")))
conf.registerChannelValue(Services.ChanServ, 'password',
registry.String('', _("""Determines what password the bot will use with
ChanServ."""), private=True))
conf.registerChannelValue(Services.ChanServ, 'op',
registry.Boolean(False, _("""Determines whether the bot will request to get
opped by the ChanServ when it joins the channel.""")))
conf.registerChannelValue(Services.ChanServ, 'halfop',
registry.Boolean(False, _("""Determines whether the bot will request to get
half-opped by the ChanServ when it joins the channel.""")))
conf.registerChannelValue(Services.ChanServ, 'voice',
registry.Boolean(False, _("""Determines whether the bot will request to get
voiced by the ChanServ when it joins the channel.""")))
示例11: configure
_ = 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('Trigger', True)
Trigger = conf.registerPlugin('Trigger')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Trigger, 'someConfigVariableName',
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
conf.registerGroup(Trigger, 'triggers')
for trigger in 'join part privmsg notice highlight nick quit kick'.split(' '):
conf.registerChannelValue(Trigger.triggers, trigger,
registry.String('', _("""Command triggered by %ss""" % trigger),
private=True))
conf.registerGlobalValue(Trigger.triggers, 'connect',
registry.String('', _("""Command triggered on connect. This shouldn't be
a Supybot command, but an IRC command (as given to ircquote)."""),
private=True))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例12: ValidNonPrivmsgsHandling
class ValidNonPrivmsgsHandling(registry.OnlySomeStrings):
validStrings = ('privmsg', 'notice', 'nothing')
conf.registerChannelValue(LinkRelay, 'nonPrivmsgs',
ValidNonPrivmsgsHandling('privmsg', _("""Determines whether the
bot will use PRIVMSGs (privmsg), NOTICEs (notice), for non-PRIVMSG Relay
messages (i.e., joins, parts, nicks, quits, modes, etc.), or whether it
won't relay such messages (nothing)""")))
conf.registerGlobalValue(LinkRelay, 'relays',
registry.String('', _("""You shouldn't edit this configuration variable
yourself unless you know what you do. Use @LinkRelay {add|remove} instead.""")))
conf.registerGlobalValue(LinkRelay, 'substitutes',
registry.String('', _("""You shouldn't edit this configuration variable
yourself unless you know what you do. Use @LinkRelay (no)substitute instead.""")))
conf.registerGroup(LinkRelay, 'colors')
for name, color in {'info': '02',
'truncated': '14',
'mode': '14',
'join': '14',
'part': '14',
'kick': '14',
'nick': '14',
'quit': '14'}.items():
conf.registerChannelValue(LinkRelay.colors, name,
ColorNumber(color, _("""Color used for relaying %s.""") % color))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
示例13: configure
import supybot.conf as conf
import supybot.registry as registry
def configure(advanced):
from supybot.questions import expect, anything, something, yn
WhatCD = conf.registerPlugin('WhatCD', True)
if yn("""This plugin also offers a snarfer that will try to fetch the
title of URLs that it sees in the channel. Would like you this
snarfer to be enabled?""", default=False):
WhatCD.titleSnarfer.setValue(True)
WhatCD = conf.registerPlugin('WhatCD')
conf.registerGlobalValue(WhatCD, 'username', registry.String('', '''the what.cd username to use'''))
conf.registerGlobalValue(WhatCD, 'password', registry.String('', '''the what.cd password to use'''))
conf.registerGlobalValue(WhatCD, 'max_results', registry.String('3', '''the number of results to display from what.cd torrent searches'''))
conf.registerGroup(WhatCD, 'fetch')
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
示例14: configure
# without the i18n module
_ = lambda x: x
from .local import accountsdb
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('NuWeather', True)
NuWeather = conf.registerPlugin('NuWeather')
conf.registerGroup(NuWeather, 'apikeys')
conf.registerGroup(NuWeather, 'units')
conf.registerGlobalValue(NuWeather, accountsdb.CONFIG_OPTION_NAME, accountsdb.CONFIG_OPTION)
class NuWeatherTemperatureDisplayMode(registry.OnlySomeStrings):
validStrings = ('F/C', 'C/F', 'F', 'C')
conf.registerChannelValue(NuWeather.units, 'temperature',
NuWeatherTemperatureDisplayMode('F/C', _("""Determines how temperatures will be displayed.
F/C means show "50F/10C", C means display only Celsius, and so on.""")))
BACKENDS = ('darksky', 'apixu')
GEOCODE_BACKENDS = ('nominatim', 'googlemaps', 'opencage')
class NuWeatherBackend(registry.OnlySomeStrings):
validStrings = BACKENDS
class NuWeatherGeocode(registry.OnlySomeStrings):
示例15: _
conf.registerChannelValue(RelayNext, 'color',
registry.Boolean(True, _("""Determines whether the bot will color relayed
PRIVMSGs so as to make the messages easier to read.""")))
conf.registerChannelValue(RelayNext, 'hostmasks',
registry.Boolean(True, _("""Determines whether the bot will relay the
hostmask of the person joining or parting the channel when he or she joins
or parts.""")))
conf.registerChannelValue(RelayNext, 'noHighlight',
registry.Boolean(False, _("""Determines whether the bot should prefix nicks
with a hyphen (-) to prevent excess highlights (in PRIVMSGs and actions).""")))
conf.registerChannelValue(RelayNext, 'showPrefixes',
registry.Boolean(False, _("""Determines whether the bot should status prefixes
(@, %, +) when relaying.""")))
conf.registerGroup(RelayNext, 'antiflood')
conf.registerChannelValue(RelayNext.antiflood, 'enable',
registry.Boolean(False, _("""Determines whether flood prevention should be enabled
for the given channel.""")))
conf.registerChannelValue(RelayNext.antiflood, 'seconds',
registry.PositiveInteger(20, _("""Determines how many seconds messages should be queued
for flood protection.""")))
conf.registerChannelValue(RelayNext.antiflood, 'maximum',
registry.PositiveInteger(15, _("""Determines the maximum amount of incoming messages
the bot will allow from a relay channel before flood protection is triggered.""")))
conf.registerChannelValue(RelayNext.antiflood.maximum, 'nonPrivmsgs',
registry.PositiveInteger(10, _("""Determines the maximum amount of incoming non-PRIVMSG events
the bot will allow from a relay channel before flood protection is triggered.""")))
conf.registerChannelValue(RelayNext.antiflood, 'timeout',
registry.PositiveInteger(60, _("""Determines the amount of time in seconds the bot should
block messages if flood protection is triggered.""")))