本文整理汇总了Python中supybot.questions.output函数的典型用法代码示例。如果您正苦于以下问题:Python output函数的具体用法?Python output怎么用?Python output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了output函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: configure
def configure(advanced):
from supybot.questions import expect, something, yn, output
def anything(prompt, default=None):
"""Because supybot is pure fail"""
from supybot.questions import expect
return expect(prompt, [], default=default)
Mess = conf.registerPlugin('Mess', True)
def getDelay():
output("What should be the minimum number of seconds between mess output?")
delay = something("Enter an integer greater or equal to 0", default=Mess.delay._default)
try:
delay = int(delay)
if delay < 0:
raise TypeError
except TypeError:
output("%r is not a valid value, it must be an interger greater or equal to 0" % delay)
return getDelay()
else:
return delay
output("WARNING: This plugin is unmaintained, may have bugs and is potentially offensive to users")
Mess.enabled.setValue(yn("Enable this plugin for all channels?", default=Mess.enabled._default))
Mess.offensive.setValue(yn("Enable possibly offensive content?", default=Mess.offensive._default))
Mess.delay.setValue(getDelay())
示例2: 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)
示例3: 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)
示例4: configure
def configure(advanced):
from supybot.questions import output, yn
conf.registerPlugin('Google', True)
output("""The Google plugin has the functionality to watch for URLs
that match a specific pattern. (We call this a snarfer)
When supybot sees such a URL, it will parse the web page
for information and reply with the results.""")
if yn('Do you want the Google search snarfer enabled by default?'):
conf.supybot.plugins.Google.searchSnarfer.setValue(True)
示例5: 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('NACO', True)
if advanced:
output('The NACO plugin normalizes text for comparison purposes according to the rules of http://www.loc.gov/catdir/pcc/naco/normrule.html')
示例6: configure
def configure(advanced):
from supybot.questions import output, expect, anything, something, yn
conf.registerPlugin('Relay', True)
if yn(_('Would you like to relay between any channels?')):
channels = anything(_('What channels? Separate them by spaces.'))
conf.supybot.plugins.Relay.channels.set(channels)
if yn(_('Would you like to use color to distinguish between nicks?')):
conf.supybot.plugins.Relay.color.setValue(True)
output("""Right now there's no way to configure the actual connection to
the server. What you'll need to do when the bot finishes starting up is
use the 'start' command followed by the 'connect' command. Use the 'help'
command to see how these two commands should be used.""")
示例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('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)
示例8: getRepeatdelay
def getRepeatdelay():
output("How many seconds should the bot wait before repeating bug information?")
repeatdelay = something("Enter a number greater or equal to 0.", default=Bugtracker.repeatdelay._default)
try:
repeatdelay = int(repeatdelay)
if repeatdelay < 0:
raise TypeError
except TypeError:
output("Invalid value '%s', it must be an integer greater or equal to 0." % repeatdelay)
return getRepeatdelay()
else:
return repeatdelay
示例9: getReviewTime
def getReviewTime():
output("How many days should the bot wait before requesting a ban/quiet review?")
review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.request.review._default))
try:
review = float(review)
if review < 0:
raise TypeError
except TypeError:
output("%r is an invalid value, it must be an integer or float greater or equal to 0" % review)
return getReviewTime()
else:
return review
示例10: getDelay
def getDelay():
output("What should be the minimum number of seconds between mess output?")
delay = something("Enter an integer greater or equal to 0", default=Mess.delay._default)
try:
delay = int(delay)
if delay < 0:
raise TypeError
except TypeError:
output("%r is not a valid value, it must be an interger greater or equal to 0" % delay)
return getDelay()
else:
return delay
示例11: configure
def configure(advanced):
from supybot.questions import expect, something, yn, output
def anything(prompt, default=None):
"""Because supybot is pure fail"""
from supybot.questions import expect
return expect(prompt, [], default=default)
Bugtracker = conf.registerPlugin('Bugtracker', True)
def getRepeatdelay():
output("How many seconds should the bot wait before repeating bug information?")
repeatdelay = something("Enter a number greater or equal to 0.", default=Bugtracker.repeatdelay._default)
try:
repeatdelay = int(repeatdelay)
if repeatdelay < 0:
raise TypeError
except TypeError:
output("Invalid value '%s', it must be an integer greater or equal to 0." % repeatdelay)
return getRepeatdelay()
else:
return repeatdelay
output("Each of the next 3 questions can be set per-channel with the '@config channel' command.")
bugSnarfer = yn("Enable detecting bugs numbers and URL in all channels?", default=Bugtracker.bugSnarfer._default)
cveSnarfer = yn("Enable detecting CVE numbers and URL in all channels?", default=Bugtracker.cveSnarfer._default)
oopsSnarfer = yn("Enable detecting Launchpad OOPS IDs in all channels?", default=Bugtracker.oopsSnarfer._default)
if advanced:
replyNoBugtracker = something("What should the bot reply with when a user requests information from an unknown bug tracker?", default=Bugtracker.replyNoBugtracker._default)
snarfTarget = something("What should be the default bug tracker used when none is specified?", default=Bugtracker.snarfTarget._default)
replyWhenNotFound = yn("Should the bot report when a bug is not found?", default=Bugtracker.replyWhenNotFound._default)
repeatdelay = getRepeatdelay()
else:
replyNoBugtracker = Bugtracker.replyNoBugtracker._default
snarfTarget = Bugtracker.snarfTarget._default
replyWhenNotFound = Bugtracker.replyWhenNotFound._default
repeatdelay = Bugtracker.repeatdelay._default
showassignee = yn("Show the assignee of a bug in the reply?", default=Bugtracker.showassignee._default)
extended = yn("Show tracker-specific extended infomation?", default=Bugtracker.extended._default)
Bugtracker.bugSnarfer.setValue(bugSnarfer)
Bugtracker.cveSnarfer.setValue(cveSnarfer)
Bugtracker.oopsSnarfer.setValue(oopsSnarfer)
Bugtracker.replyNoBugtracker.setValue(replyNoBugtracker)
Bugtracker.snarfTarget.setValue(snarfTarget)
Bugtracker.replyWhenNotFound.setValue(replyWhenNotFound)
Bugtracker.repeatdelay.setValue(repeatdelay)
Bugtracker.showassignee.setValue(showassignee)
Bugtracker.extended.setValue(extended)
示例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('Insult', True)
if advanced:
output("""The Insult plugin constructs an insult in the form of \"You
are nothing but a(n) {adjective} {amount} of {adjective} {noun}.\"
""")
if yn("""Include foul language in pools of randomly chosen adjective,
amount and noun words?""", default=True):
conf.supybot.plugins.Insult.allowFoul.setValue(True)
示例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 themself 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('Unix', True)
output(_("""The "progstats" command can reveal potentially sensitive
information about your machine. Here's an example of its output:
%s\n""") % progstats())
if yn(_('Would you like to disable this command for non-owner users?'),
default=True):
conf.supybot.commands.disabled().add('Unix.progstats')
示例14: loadPlugin
def loadPlugin(name):
import supybot.plugin as plugin
try:
module = plugin.loadPluginModule(name)
if hasattr(module, 'Class'):
return module
else:
output("""That plugin loaded fine, but didn't seem to be a real
Supybot plugin; there was no Class variable to tell us what class
to load when we load the plugin. We'll skip over it for now, but
you can always add it later.""")
return None
except Exception, e:
output("""We encountered a bit of trouble trying to load plugin %r.
Python told us %r. We'll skip over it for now, you can always add it
later.""" % (name, utils.gen.exnToString(e)))
return None
示例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 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/"""
)