本文整理汇总了Python中supybot.conf.registerPlugin函数的典型用法代码示例。如果您正苦于以下问题:Python registerPlugin函数的具体用法?Python registerPlugin怎么用?Python registerPlugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了registerPlugin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
def load(self, irc, msg, args, optlist, name):
"""[--deprecated] <plugin>
Loads the plugin <plugin> from any of the directories in
conf.supybot.directories.plugins; usually this includes the main
installed directory and 'plugins' in the current directory.
--deprecated is necessary if you wish to load deprecated plugins.
"""
ignoreDeprecation = False
for (option, argument) in optlist:
if option == 'deprecated':
ignoreDeprecation = True
if name.endswith('.py'):
name = name[:-3]
if irc.getCallback(name):
irc.error('%s is already loaded.' % name.capitalize())
return
try:
module = plugin.loadPluginModule(name, ignoreDeprecation)
except plugin.Deprecated:
irc.error('%s is deprecated. Use --deprecated '
'to force it to load.' % name.capitalize())
return
except ImportError as e:
if str(e).endswith(name):
irc.error('No plugin named %s exists.' % utils.str.dqrepr(name))
else:
irc.error(str(e))
return
cb = plugin.loadPluginClass(irc, module)
name = cb.name() # Let's normalize this.
conf.registerPlugin(name, True)
irc.replySuccess()
示例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('TelegramBridge', True)
示例3: configure
def configure(advanced):
from supybot.questions import output, expect, anything, something, yn
conf.registerPlugin('Dict', True)
output('The default dictd server is dict.org.')
if yn('Would you like to specify a different dictd server?'):
server = something('What server?')
conf.supybot.plugins.Dict.server.set(server)
示例4: unload
def unload(self, irc, msg, args, name):
"""<plugin>
Unloads the callback by name; use the 'list' command to see a list
of the currently loaded plugins. Obviously, the Owner plugin can't
be unloaded.
"""
if ircutils.strEqual(name, self.name()):
irc.error('You can\'t unload the %s plugin.' % name)
return
# Let's do this so even if the plugin isn't currently loaded, it doesn't
# stay attempting to load.
old_callback = irc.getCallback(name)
if old_callback:
# Normalize the plugin case to prevent duplicate registration
# entries, https://github.com/ProgVal/Limnoria/issues/1295
name = old_callback.name()
conf.registerPlugin(name, False)
callbacks = irc.removeCallback(name)
if callbacks:
for callback in callbacks:
callback.die()
del callback
gc.collect()
irc.replySuccess()
return
irc.error('There was no plugin %s.' % name)
示例5: configure
def configure(advanced):
from supybot.questions import output, expect, anything, something, yn
conf.registerPlugin('ShrinkUrl', True)
if yn(_("""This plugin offers a snarfer that will go retrieve a shorter
version of long URLs that are sent to the channel. Would you
like this snarfer to be enabled?"""), default=False):
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True)
示例6: 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 output, expect, anything, something, yn
conf.registerPlugin('Sourceforge', True)
output("""The Sourceforge plugin has the functionality to watch for URLs
that match a specific pattern (we call this a snarfer). When
supybot sees such a URL, he will parse the web page for
information and reply with the results.""")
if yn('Do you want this snarfer to be enabled by default?'):
conf.supybot.plugins.Sourceforge.trackerSnarfer.setValue(True)
output("""The bugs and rfes commands of the Sourceforge plugin can be set
to query a default project when no project is specified. If this
project is not set, calling either of those commands will display
the associated help. With the default project set, calling
bugs/rfes with no arguments will find the most recent bugs/rfes
for the default project.""")
if yn('Do you want to specify a default project?'):
project = anything('Project name:')
if project:
conf.supybot.plugins.Sourceforge.defaultProject.set(project)
output("""Sourceforge is quite the word to type, and it may get annoying
typing it all the time because Supybot makes you use the plugin
name to disambiguate calls to ambiguous commands (i.e., the bug
command is in this plugin and the Bugzilla plugin; if both are
loaded, you\'ll have you type "sourceforge bug ..." to get this
bug command). You may save some time by making an alias for
"sourceforge". We like to make it "sf".""")
示例7: 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 output, expect, anything, something, yn
conf.registerPlugin("Debian", True)
if not utils.findBinaryInPath("zgrep"):
if not advanced:
output(
"""I can't find zgrep in your path. This is necessary
to run the file command. I'll disable this command
now. When you get zgrep in your path, use the command
'enable Debian.file' to re-enable the command."""
)
capabilities = conf.supybot.capabilities()
capabilities.add("-Debian.file")
conf.supybot.capabilities.set(capabilities)
else:
output(
"""I can't find zgrep in your path. If you want to run
the file command with any sort of expediency, you'll
need it. You can use a python equivalent, but it's
about two orders of magnitude slower. THIS MEANS IT
WILL TAKE AGES TO RUN THIS COMMAND. Don't do this."""
)
if yn("Do you want to use a Python equivalent of zgrep?"):
conf.supybot.plugins.Debian.pythonZgrep.setValue(True)
else:
output("I'll disable file now.")
capabilities = conf.supybot.capabilities()
capabilities.add("-Debian.file")
conf.supybot.capabilities.set(capabilities)
示例8: configure
def configure(advanced):
from supybot.questions import output, expect, anything, something, yn
conf.registerPlugin('BadWords', True)
if yn(_('Would you like to add some bad words?')):
words = anything(_('What words? (separate individual words by '
'spaces)'))
conf.supybot.plugins.BadWords.words.set(words)
示例9: 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 output, expect, anything, something, yn
output("To use the Acronym Finder, you must have obtained a license key.")
if yn("Do you have a license key?"):
key = something("What is it?")
while len(key) != 36:
output("That is not a valid Acronym Finder license key.")
if yn("Are you sure you have a valid Acronym Finder license key?"):
key = something("What is it?")
else:
key = ""
break
if key:
conf.registerPlugin("AcronymFinder", True)
conf.supybot.plugins.AcronymFinder.licenseKey.setValue(key)
else:
output(
"""You'll need to get a key before you can use this plugin.
You can apply for a key at http://www.acronymfinder.com/dontknowyet/"""
)
示例10: configure
def configure(advanced):
from supybot.questions import expect, anything, something, yn
conf.registerPlugin('Intranet', True)
output('The default whois server is whois.verisign-grs.com.')
if yn('Would you like to specify a different whois server?'):
server = something('What server?')
conf.plugins.Intranet.whoisServer.setValue(server)
示例11: 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('Sparkfun', True)
conf.supybot.plugins.Sparkfun.sparkfunSnarfer.setValue(True)
示例12: 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 output, expect, anything, something, yn
conf.registerPlugin('Motivate', True)
if advanced:
output('The Motivate plugin gives you an inspiring quote to motivate you through your life of dreary librarydom')
示例13: 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('WikiSearch', True)
output("""Before using the WikiSearch plugin you will need to add TWiki,
Kwiki, Moin or Usemod wikis. See the "help WikiSearch add" command.""")
示例14: configurePlugin
def configurePlugin(module, advanced):
if hasattr(module, 'configure'):
output("""Beginning configuration for %s...""" %
module.Class.__name__)
module.configure(advanced)
print # Blank line :)
output("""Done!""")
else:
conf.registerPlugin(module.__name__, currentValue=True)
示例15: 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."""))