• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python questions.yn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中supybot.questions.yn函数的典型用法代码示例。如果您正苦于以下问题:Python yn函数的具体用法?Python yn怎么用?Python yn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了yn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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())
开发者ID:bnrubin,项目名称:ubuntu-bots,代码行数:28,代码来源:config.py


示例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 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/"""
        )
开发者ID:stepnem,项目名称:supybot-plugins,代码行数:25,代码来源:config.py


示例3: 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
    Jira = conf.registerPlugin('Jira', True)
    server = something("""What is the URL for the Jira instance?""")
    user = something("""What is the username for the Jira user?""")
    password = something("""What is the password for the Jira user?""")
    template = something("""What output template would you like?""",
            default=template)
    lookup = yn("""Do you want to lookup Jira issues once they appear on a channel?""", default=True)
    snarfRegex = something("""What is the prefix for your Jira issue keys?""",
            default="CLB")
    snarfRegex = ''.join((snarfRegex, '-[0-9]+'))
    verifySSL = yn("""Would you like the plugin to verify your Jira instance's
            SSL certificate?""", default=False)
    OAuthConsumerName = something("""What is the consumer name as per the Jira linked applications?""")
    OAuthConsumerKey = something("""What is the consumer secret key as per the Jira linked applications?""")
    OAuthConsumerSSLKey = something("""What is the filename holding the SSL key bound with the Jira trusted cert?""")
    OAuthTokenDatabase = something("""What is the filename holding the yaml structure with OAuth tokens?""")

    Jira.server.setValue(server)
    Jira.user.setValue(user)
    Jira.password.setValue(password)
    Jira.template.setValue(template)
    Jira.lookup.setValue(lookup)
    Jira.snarfRegex.setValue(snarfRegex)
    Jira.verifySSL.setValue(verifySSL)
    Jira.OAuthConsumerName.setValue(OauthConsumerName)
    Jira.OAuthConsumerKey.setValue(OauthConsumerKey)
    Jira.OAuthTokenDatabase.setValue(OauthTokenDatabase)
开发者ID:ballock,项目名称:supybot-jira,代码行数:33,代码来源:config.py


示例4: 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".""")
开发者ID:D0MF,项目名称:supybot-plugins-1,代码行数:32,代码来源:config.py


示例5: 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.""")
开发者ID:ElectroCode,项目名称:Limnoria,代码行数:12,代码来源:config.py


示例6: configure

def configure(advanced):
    from supybot.questions import yn
    conf.registerPlugin('Minecraft', True)

    if yn(_("""Do you want to use list mode instead colorful mode?
             (colorful mode uses color per service, list mode prints
              two list, one with the onlines other with the offlines)"""),
          default=False):
        Minecraft.listMode.setValue(True)

    if not yn(_("""Do you want the plugin banner to be bold?"""),
              default=True):
        Minecraft.boldBanner.setValue(False)
开发者ID:rostob,项目名称:Limnoria-plugins,代码行数:13,代码来源:config.py


示例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 expect, anything, something, yn
    assembla = conf.registerPlugin('Assembla', True)
    if yn("Would you like to configure Assembla now?", default=False):
    	key = something("Please enter an API key", '')
    	secret = something("Please enter an API Secret", '')
    	assembla.apiKey.setValue(key)
    	assembla.apiSecret.setValue(Secret)
    if yn('Do you want the Assembla snarfer enabled by default?'):
        conf.supybot.plugins.Google.ticketSnarfer.setValue(True)
开发者ID:perfectsearch,项目名称:supybot-plugins,代码行数:14,代码来源:config.py


示例8: 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.

              Google has two available snarfers: Google Groups link
              snarfing and a google search snarfer.""")
    if yn('Do you want the Google Groups link snarfer enabled by '
        'default?'):
        conf.supybot.plugins.Google.groupsSnarfer.setValue(True)
    if yn('Do you want the Google search snarfer enabled by default?'):
        conf.supybot.plugins.Google.searchSnarfer.setValue(True)
开发者ID:prashantpawar,项目名称:supybot-rothbot,代码行数:15,代码来源:config.py


示例9: 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)
开发者ID:onlyhavecans,项目名称:SupyBotBiz,代码行数:7,代码来源:config.py


示例10: 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)
开发者ID:4poc,项目名称:competitionbot,代码行数:7,代码来源:config.py


示例11: 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)
开发者ID:Chalks,项目名称:Supybot,代码行数:7,代码来源:config.py


示例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 expect, anything, something, yn
    botPort = conf.registerPlugin(PluginName, True)
    
    if yn("""The Beatport plugin rocks.  Would you like these commands to
             be enabled for everyone?""", default = False):
        botPort.userLevelRequires.setValue("")
    else:
        cap = something("""What capability would you like to require for
                           this command to be used?""", default = "Admin")
        botPort.userLevelRequires.setValue(cap)
    
    perPage = something("""How many results would you like returned per search?
                           """, default = 5)
    botPort.numResults.setValue(perPage)
    
    sortBy = expect("""In what order would you like results displayed?
                       See http://api.beatport.com/catalog-search.html for
                       options.""",
                       ["releaseDate", "publishDate", "releaseId", "trackName",
                        "trackId", "labelName", "genreName"],
                       default = "releaseDate")
    botPort.sortBy.setValue(sortBy)
开发者ID:doublerebel,项目名称:Supybot-beatport,代码行数:27,代码来源:config.py


示例13: configure

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)
开发者ID:GlitterCakes,项目名称:PoohBot,代码行数:7,代码来源:config.py


示例14: 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)
开发者ID:4poc,项目名称:competitionbot,代码行数:7,代码来源:config.py


示例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

    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)
开发者ID:jtgorman,项目名称:supybot-plugins,代码行数:34,代码来源:config.py


示例16: 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
    dtBot = conf.registerPlugin(PluginName, True)
    
    if yn("""The Digital-Tunes plugin rocks.  Would you like these commands to
             be enabled for everyone?""", default = False):
        dtBot.userLevelRequires.setValue("")
    else:
        cap = something("""What capability would you like to require for
                           this command to be used?""", default = "Admin")
        dtBot.userLevelRequires.setValue(cap)
    
    # 905872135d3b762556484e3256bdf17aa2ddcba0
    apiKey = something("""Digital-Tunes requires an API key to access their API.
                          If you don't have one, sign up at:
                          http://www.digital-tunes.net/affiliates/new""", default = False)
    dtBot.apiKey.setValue(apiKey)

    perPage = something("""How many results would you like returned per search?
                           """, default = 5)
    dtBot.numResults.setValue(perPage)
开发者ID:doublerebel,项目名称:Supybot-dt,代码行数:25,代码来源:config.py


示例17: 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 expect, anything, something, yn
    QuranFinder = conf.registerPlugin('QuranFinder', True)
    if yn("""Split long verses?""", default=True):
        QuranFinder.splitMessages.setValue(True)
    else:
        QuranFinder.splitMessages.setValue(False)
开发者ID:SafaAlfulaij,项目名称:QuranFinder,代码行数:11,代码来源:config.py


示例18: 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('Bugzilla', True)
    if yn("""This plugin can show data about bug URLs and numbers mentioned
             in the channel. Do you want this bug snarfer enabled by
             default?""", default=False):
        conf.supybot.plugins.Bugzilla.bugSnarfer.setValue(True)
开发者ID:LeoMcA,项目名称:remobot,代码行数:11,代码来源:config.py


示例19: 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 expect, anything, something, yn
    Web = conf.registerPlugin('Web', 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):
        Web.titleSnarfer.setValue(True)
开发者ID:Web-Development-Guru,项目名称:Limnoria,代码行数:11,代码来源:config.py


示例20: 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("Shift", True)
    if yn(
        """ This allows the ability to get all: in a channel and 
                translate it to names""",
        default=True,
    ):
        conf.supybot.plugins.Shift.shiftSnarfer.setValue(True)
开发者ID:kwoodson,项目名称:bot-plugins,代码行数:14,代码来源:config.py



注:本文中的supybot.questions.yn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python registry.split函数代码示例发布时间:2022-05-27
下一篇:
Python questions.output函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap