本文整理汇总了Python中supybot.conf.registerChannelValue函数的典型用法代码示例。如果您正苦于以下问题:Python registerChannelValue函数的具体用法?Python registerChannelValue怎么用?Python registerChannelValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了registerChannelValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testOpNonEditable
def testOpNonEditable(self):
var_name = 'testOpNonEditable' + random_string()
conf.registerChannelValue(conf.supybot.plugins.Config, var_name,
registry.Integer(0, 'help'), opSettable=False)
self.assertNotError('register bar passwd', frm=self.prefix3,
private=True)
self.assertRegexp('whoami', 'bar', frm=self.prefix3)
ircdb.users.getUser('bar').addCapability(self.channel + ',op')
self.assertRegexp('config plugins.Config.%s 1' % var_name,
'^Completely: Error: ',
frm=self.prefix3)
self.assertResponse('config plugins.Config.%s' % var_name,
'Global: 0; #test: 0')
self.assertRegexp('config channel plugins.Config.%s 1' % var_name,
'^Completely: Error: ',
frm=self.prefix3)
self.assertResponse('config plugins.Config.%s' % var_name,
'Global: 0; #test: 0')
self.assertNotRegexp('config channel plugins.Config.%s 1' % var_name,
'^Completely: Error: ')
self.assertResponse('config plugins.Config.%s' % var_name,
'Global: 0; #test: 1')
示例2: configure
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('QuoteSite', True)
conf.registerChannelValue(RSS, 'headlineSeparator',
registry.StringSurroundedBySpaces(' \n ', """Determines what string is used to separate headlines in new feeds."""))
示例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_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.""")))
示例5: 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.""")))
示例6: setup_config
def setup_config(OriginalConfig):
# Set all string variables in the default Config class as supybot
# registry variables.
for attrname in dir(OriginalConfig):
# Don't configure attributs starting with '_'
if attrname[0] == '_':
continue
attr = getattr(OriginalConfig, attrname)
# Don't configure attributes that aren't strings.
if isinstance(attr, (str, unicode)):
attr = attr.replace('\n', '\\n')
# For a global value: conf.registerGlobalValue and remove the
# channel= option from registryValue call above.
conf.registerChannelValue(MeetBotConfigGroup, attrname,
registry.String(attr, ""))
settable_attributes.append(attrname)
if isinstance(attr, bool):
conf.registerChannelValue(MeetBotConfigGroup, attrname,
registry.Boolean(attr, ""))
settable_attributes.append(attrname)
# writer_map
# (doing the commented out commands below will erase the previously
# stored value of a config variable)
#if 'writer_map' in MeetBotConfigGroup._children:
# MeetBotConfigGroup.unregister('writer_map')
conf.registerChannelValue(MeetBotConfigGroup, 'writer_map',
WriterMap(OriginalConfig.writer_map, ""))
settable_attributes.append('writer_map')
示例7: something
username = something("""What iRacing user name (email address) should be used to query for users?
This account must watch or friend any user to be known to this bot.""")
password = something("""What is the password for that iRacing account?""")
Racebot.iRacingUsername.setValue(username)
Racebot.iRacingPassword.setValue(password)
Racebot = conf.registerPlugin('Racebot')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Racebot, 'someConfigVariableName',
# registry.Boolean(False, """Help for someConfigVariableName."""))
conf.registerGlobalValue(Racebot, 'iRacingUsername',
registry.String('', """iRacing account (email) that will have all relevat users watched or friended."""))
conf.registerGlobalValue(Racebot, 'iRacingPassword',
registry.String('', """Password for the iRacing account. Hopefully we get OAuth some day :-/""", private=True))
conf.registerChannelValue(Racebot, 'raceRegistrationAlerts',
registry.Boolean(True, """Determines whether the bot will broadcast in this channel whenever
a user joins a race"""))
conf.registerChannelValue(Racebot, 'nonRaceRegistrationAlerts',
registry.Boolean(False, """Determines whether the bot will broadcast in this channel whenever
a user joins a session other than a race (practice, qual, etc.)"""))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例8: DAMAGES
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
###
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
import os
_ = PluginInternationalization('SeattleIncidentResponse')
def configure(advanced):
from supybot.questions import expect, anything, something, yn
conf.registerPlugin('Seattle911')
SeattleIncidentResponse = conf.registerPlugin('SeattleIncidentResponse')
conf.registerGlobalValue(SeattleIncidentResponse, 'checkinterval',
registry.NonNegativeInteger(1, """How often, in minutes, to check for new incidents"""))
conf.registerGlobalValue(SeattleIncidentResponse, 'postformat',
registry.String("[911] [{incident_number}][{incident_type}] {address}", """How often, in minutes, to check for new incidents"""))
conf.registerChannelValue(SeattleIncidentResponse, 'enabled',
registry.Boolean(False, """Determines whether the bot will announce 911 calls in this channel"""))
示例9: configure
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 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('ChannelStatus', True)
ChannelStatus = conf.registerPlugin('ChannelStatus')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(ChannelStatus, 'someConfigVariableName',
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
conf.registerChannelValue(ChannelStatus, 'listed',
registry.Boolean(False, _("""Determines whether or not this channel will
be publicly listed on the web server.""")))
conf.registerChannelValue(ChannelStatus, 'nicks',
registry.Boolean(False, _("""Determines whether or not the list of users
in this channel will be listed.""")))
conf.registerChannelValue(ChannelStatus, 'topic',
registry.Boolean(True, _("""Determines whether or not the topic of this
channel will be displayed.""")))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例10: PluginInternationalization
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('AutoMode')
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('AutoMode', True)
AutoMode = conf.registerPlugin('AutoMode')
conf.registerChannelValue(AutoMode, 'enable',
registry.Boolean(True, _("""Determines whether this plugin is enabled.
""")))
conf.registerGlobalValue(AutoMode, 'owner',
registry.Boolean(True, _("""Determines whether this plugin will automode
owners even if they don't have op/halfop/voice/whatever capability.""")))
conf.registerChannelValue(AutoMode, 'alternativeCapabilities',
registry.Boolean(False, _("""Determines whether the bot will
check for 'alternative capabilities' (ie. autoop, autohalfop,
autovoice) in addition to/instead of classic ones.""")))
conf.registerChannelValue(AutoMode, 'fallthrough',
registry.Boolean(False, _("""Determines whether the bot will "fall
through" to halfop/voicing when auto-opping is turned off but
auto-halfopping/voicing are turned on.""")))
conf.registerChannelValue(AutoMode, 'op',
registry.Boolean(True, _("""Determines whether the bot will automatically
op people with the <channel>,op capability when they join the channel.
示例11: PluginInternationalization
#
#
###
import supybot.conf as conf
import supybot.registry as registry
try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('Football')
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 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('Football', True)
Football = conf.registerPlugin('Football')
# This is where your configuration variables (if any) should go. For example:
conf.registerChannelValue(Football, 'prefix', registry.Boolean(False, """Should we prefix output with the string"""))
conf.registerChannelValue(Football, 'prefixString', registry.String("NFL: ", """Prefix String."""))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例12: configure
# coding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
###
import supybot.conf as conf
import supybot.registry as registry
# noinspection PyUnusedLocal
def configure(advanced):
conf.registerPlugin("YouTube", True)
YouTube = conf.registerPlugin("YouTube")
conf.registerChannelValue(
YouTube,
"nonSnarfingRegexp",
registry.Regexp(
None,
"""Determines what URLs are to be snarfed and stored in the database in
the channel; URLs matching the regexp given will not be snarfed. Give
the empty string if you have no URLs that you'd like to exclude from
being snarfed.""",
),
)
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例13: netsplit
conf.registerGlobalValue(Sigyn, 'enable',
registry.Boolean(False, """set to True to enable kill and klines, otherwise bot will only report to logChannel"""))
conf.registerGlobalValue(Sigyn, 'logChannel',
registry.String("", """channel where bot's actions is announced"""))
conf.registerGlobalValue(Sigyn, 'useNotice',
registry.Boolean(False, """use notices for announces in logChannel"""))
conf.registerGlobalValue(Sigyn,'resolverTimeout',
registry.PositiveInteger(3, """max duration of dns request/resolve in seconds"""))
conf.registerGlobalValue(Sigyn, 'klineDuration',
registry.Integer(-1, """kline duration, in minutes, with -1, bot will not kill or kline"""))
conf.registerGlobalValue(Sigyn, 'klineMessage',
registry.String("Merci de ne pas spammer les utilisateurs d'EkiNetIrc. En cas d'erreur, contactez [email protected]", """default reason used in kline's message"""))
conf.registerChannelValue(Sigyn, 'killMessage',
registry.String("Le spam est interdit sur EkiNetIrc", """kill reason"""))
conf.registerGlobalValue(Sigyn, 'operatorNick',
registry.String("", """oper's nick, must be filled""", private=True))
conf.registerGlobalValue(Sigyn, 'operatorPassword',
registry.String("", """oper's password, must be filled""", private=True))
conf.registerGlobalValue(Sigyn, 'alertPeriod',
registry.PositiveInteger(1,"""interval between 2 alerts of same type in logChannel"""))
conf.registerGlobalValue(Sigyn, 'netsplitDuration',
registry.PositiveInteger(1,"""duration of netsplit ( which disable some protections )"""))
conf.registerGlobalValue(Sigyn, 'alertOnWideKline',
registry.Integer(-1,"""alert if a kline hits more than expected users"""))
conf.registerGlobalValue(Sigyn, 'lagPermit',
示例14: something
Twitter = conf.registerPlugin('Twitter', True)
consumer_key = something("twitter.com consumer key:");
Twitter.consumer_key.setValue(consumer_key)
consumer_secret = something("twitter.com consumer secret:");
Twitter.consumer_secret.setValue(consumer_secret)
access_key = something("twitter.com access token:");
Twitter.access_key.setValue(access_key)
access_secret = something("twitter.com access token secret:");
Twitter.access_secret.setValue(access_secret)
Twitter = conf.registerPlugin('Twitter')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Twitter, 'someConfigVariableName',
# registry.Boolean(False, """Help for someConfigVariableName."""))
conf.registerChannelValue(Twitter, 'enabled',
registry.Boolean(False, 'Enable this plugin'))
conf.registerGlobalValue(Twitter, 'consumer_key',
registry.String('', "twitter.com consumer_key", private=True))
conf.registerGlobalValue(Twitter, 'consumer_secret',
registry.String('', "twitter.com consumer_secret", private=True))
conf.registerGlobalValue(Twitter, 'access_key',
registry.String('', "twitter.com access_key", private=True))
conf.registerGlobalValue(Twitter, 'access_secret',
registry.String('', "twitter.com access_secret", private=True))
conf.registerGlobalValue(Twitter, 'displayReplies',
registry.Boolean(True, "Automatically display replies?", private=False))
conf.registerGlobalValue(Twitter, 'replyAnnounceMsg',
registry.String("Here's what Twitter has to say:", "String to use when announcing replies.", private=False))
conf.registerGlobalValue(Twitter, 'postConfirmation',
registry.String("Posted.", "String to use when confirming a post", private=False))
conf.registerGlobalValue(Twitter, 'channelList',
示例15: TORT
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
###
import supybot.conf as conf
import supybot.registry as registry
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 output, expect, anything, something, yn
conf.registerPlugin('Geekquote', True)
output("""The Geekquote plugin has the ability to watch for geekquote
(bash.org / qdb.us) URLs and respond to them as though the user
had asked for the geekquote by ID""")
if yn('Do you want the Geekquote snarfer enabled by default?'):
conf.supybot.plugins.Geekquote.geekSnarfer.setValue(True)
Geekquote = conf.registerPlugin('Geekquote')
conf.registerChannelValue(Geekquote, 'geekSnarfer',
registry.Boolean(False, """Determines whether the bot will automatically
'snarf' Geekquote URLs and print information about them."""))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: