示例#1
0
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
0
 def testCommaSeparatedListOfStrings(self):
     v = registry.CommaSeparatedListOfStrings(['foo', 'bar'], 'help')
     self.assertEqual(v(), ['foo', 'bar'])
     v.setValue(['foo', 'bar', 'baz'])
     self.assertEqual(v(), ['foo', 'bar', 'baz'])
     v.set('foo,bar')
     self.assertEqual(v(), ['foo', 'bar'])
示例#3
0
#     registry.Boolean(False, """Help for someConfigVariableName."""))

conf.registerChannelValue(
    Hubie, 'port', registry.Integer(8880, """The port on which Hubie runs."""))

# it is probably a good idea to really obfuscate your urls. Though it is also
# probably a good idea to use iptables or some firewall tools to limit access
# to the server on which you run this application.

# The pathmaps value below is a paired entry represented by the first entry,
# the uri or 'path' which will be appended to your host. The second entry will
# be the channel to which the messages will be sent. In the example below, if
# you posted json data to http://yourhost:8880/saltstack, whatever json you
# posted would be parsed and the resulting message would be displayed in the
# #salt-devel channel (assuming your bot was configured to connect to that
# channel).

conf.registerChannelValue(
    Hubie, 'pathmaps',
    registry.CommaSeparatedListOfStrings([
        'saltstack', '#salt-devel', 'saltstack', '#herlo'
    ], """List of allowed path references to use in the web server. Ensure the channels line up with these paths or you will get messages in the wrong channels."""
                                         ))
conf.registerChannelValue(
    Hubie, 'description',
    registry.String(
        "I am Hubie, the github issues and events bot!. More information is available at http://github.com/herlo/supybot-hubie/",
        """Description of this plugin"""))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例#4
0
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('Cayenne', True)

Cayenne = conf.registerPlugin('Cayenne')

conf.registerChannelValue(Cayenne, 'enable',
                        registry.Boolean(True, _("""Turns on and off Cayenne.""")))

conf.registerGlobalValue(Cayenne, 'factChance',
                        registry.Integer(10, _("""0-100 chance to trigger a cat fact""")))

conf.registerGlobalValue(Cayenne, 'linkChance',
                        registry.Integer(10, _("""0-100 chance to trigger a link to a cat gif""")))

conf.registerGlobalValue(Cayenne, 'linkURL',
                        registry.String("http://edgecats.net/random", _("""URL to get cat gif links from""")))

conf.registerGlobalValue(Cayenne, 'throttleInSeconds',
                        registry.Integer(60, _("""Will only trigger if it has been X seconds since the last trigger""")))

conf.registerGlobalValue(Cayenne, 'triggerWords',
                        registry.CommaSeparatedListOfStrings(["meow","cat","aww","kitten","feline"], _("""List of words that may trigger facts or links""")))
         
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例#5
0
    _ = 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('ProxyCheck', True)


ProxyCheck = conf.registerPlugin('ProxyCheck')
conf.registerGlobalValue(
    ProxyCheck, 'honeypotKey',
    registry.String("", """api key needed for httpbl.org - honeypot"""))
conf.registerChannelValue(
    ProxyCheck, 'logChannel',
    registry.String(
        "",
        """if filled with a #channel, bot will do check on join and announce anything that has an entry in dnsbl"""
    ))
conf.registerChannelValue(
    ProxyCheck, 'dnsbls',
    registry.CommaSeparatedListOfStrings([
        'spamhaus', 'tornevall', 'sorbs', 'spamcop', 'efnet', 'honeypot',
        'dronebl'
    ], """list of supported dnsbls"""))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例#6
0
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.
    conf.registerPlugin('Fedora', True)


Fedora = conf.registerPlugin('Fedora')
conf.registerGlobalValue(
    Fedora, 'naked_ping_admonition',
    registry.String('https://blogs.gnome.org/markmc/2014/02/20/naked-pings/',
                    """Response to people who use a naked ping in channel."""))
conf.registerGlobalValue(
    Fedora, 'naked_ping_channel_blacklist',
    registry.CommaSeparatedListOfStrings(
        '', 'List of channels where not to admonish naked pings'))


# This is where your configuration variables (if any) should go.  For example:
# conf.registerGlobalValue(Fedora, 'someConfigVariableName',
#     registry.Boolean(False, """Help for someConfigVariableName."""))
conf.registerGroup(Fedora, 'fas')
conf.registerGlobalValue(
    Fedora.fas, 'url',
    registry.String('https://admin.fedoraproject.org/accounts/',
                    """URL for the Fedora Account System"""))
conf.registerGlobalValue(
    Fedora.fas, 'username',
    registry.String('', """Username for the Fedora Account System""",
                    private=True))
conf.registerGlobalValue(
示例#7
0
    "maxLength",
    registry.Integer(
        20,
        _("""Set the maximum character length for text to figlet inputs""")),
)

conf.registerChannelValue(
    TextArt,
    "maxWords",
    registry.Integer(
        4, _("""Set the maximum number of words for text to figlet inputs""")),
)

conf.registerGlobalValue(
    TextArt,
    "userAgents",
    registry.CommaSeparatedListOfStrings(
        [
            "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like"
            " Gecko) Chrome/79.0.3945.130 Safari/537.36",
            "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101"
            " Firefox/73.0",
            "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like"
            " Gecko) Chrome/80.0.3987.122 Safari/537.36",
            "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101"
            " Firefox/74.0",
        ],
        _("""Reported user agent when fetching links"""),
    ),
)
示例#8
0
        """set to True to enable kill and klines, otherwise bot will only report to logChannel"""
    ))

conf.registerGlobalValue(
    Sigyn, 'mainChannel',
    registry.String(
        "#freenode",
        """main channel, where bot stay opped and op staffer on +z"""))

conf.registerGlobalValue(
    Sigyn, 'snoopChannel',
    registry.String("", """channel where services stuff are announced"""))

conf.registerGlobalValue(
    Sigyn, 'mxbl',
    registry.CommaSeparatedListOfStrings([''], """patterns to match"""))

conf.registerGlobalValue(
    Sigyn, 'wordsList',
    registry.CommaSeparatedListOfStrings(
        [''], """paths of files contains one word per line"""))

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',
示例#9
0
    # 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 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('PkgInfo', True)


PkgInfo = conf.registerPlugin('PkgInfo')
conf.registerGlobalValue(
    PkgInfo, 'archs',
    registry.CommaSeparatedListOfStrings(
        ['i386', 'amd64'],
        _("""Defines what architectures the bot will look for in the 'vlist'
       command. Architectures 'all' (arch-independent packages) and 'source'
       (source packages) are implied.""")))
conf.registerGlobalValue(
    PkgInfo, 'verbose',
    registry.Boolean(
        True,
        _("""Determines whether verbose output will be used (show architectures,
     package IDs, etc.).""")))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例#10
0
    Directory('backup', """Determines what directory backup data is put
    into."""))
registerGlobalValue(
    supybot.directories.data, 'tmp',
    DataFilenameDirectory(
        'tmp', """Determines what directory temporary files
    are put into."""))

utils.file.AtomicFile.default.tmpDir = supybot.directories.data.tmp
utils.file.AtomicFile.default.backupDir = supybot.directories.backup

registerGlobalValue(
    supybot.directories, 'plugins',
    registry.CommaSeparatedListOfStrings([], """Determines what directories the
    bot will look for plugins in.  Accepts a comma-separated list of strings.
    This means that to add another directory, you can nest the former value and
    add a new one.  E.g. you can say: bot: 'config supybot.directories.plugins
    [config supybot.directories.plugins], newPluginDirectory'."""))

registerGlobalValue(
    supybot, 'plugins',
    registry.SpaceSeparatedSetOfStrings([],
                                        """Determines what plugins will
    be loaded.""",
                                        orderAlphabetically=True))
registerGlobalValue(
    supybot.plugins, 'alwaysLoadImportant',
    registry.Boolean(
        True, """Determines whether the bot will always load
    important plugins (Admin, Channel, Config, Misc, Owner, and User)
    regardless of what their configured state is.  Generally, if these plugins
示例#11
0
conf.registerGlobalValue(
    Sigyn, 'saslChannel',
    registry.String("", """channel where sasl attempts are send"""))
conf.registerGlobalValue(
    Sigyn, 'saslNick',
    registry.String("", """nick who send sasl informations"""))
conf.registerGlobalValue(
    Sigyn, 'saslReason',
    registry.String(
        "Banned due to too many failed login attempts (SASL https://freenode.net/sasl/) in a short period, email [email protected] when corrected. Thanks!",
        """reason used in dline"""))
conf.registerGlobalValue(Sigyn, 'torServer',
                         registry.String("", """tor listing server"""))
conf.registerChannelValue(
    Sigyn, 'torPorts',
    registry.CommaSeparatedListOfStrings([''], """ports to check"""))
conf.registerChannelValue(
    Sigyn, 'torTarget',
    registry.String("", """ip of the targeted ircd, for tor checks"""))
# dronebl submit

conf.registerGlobalValue(
    Sigyn, 'droneblKey',
    registry.String("", """dronebl key for rpc calls""", private=True))
conf.registerGlobalValue(
    Sigyn, 'droneblHost',
    registry.String("http://dronebl.org/RPC2",
                    """where bot must do rpc calls"""))

# report
conf.registerGlobalValue(Sigyn, 'reportChannel',
示例#12
0

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('Biography', True)


Biography = conf.registerPlugin('Biography')
# This is where your configuration variables (if any) should go.  For example:
# conf.registerGlobalValue(Biography, 'someConfigVariableName',
#     registry.Boolean(False, _("""Help for someConfigVariableName.""")))

conf.registerChannelValue(
    Biography, 'requireCapability',
    registry.String(
        'admin',
        _("""Determines what capability (if any) is required to
    change fields of another user.""")))
conf.registerChannelValue(
    Biography, 'fields',
    registry.CommaSeparatedListOfStrings(
        ['email', 'facebook', 'twitter'],
        _("""Comma-separated list of fields that can be stored.
    Order matters when displayed""")))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例#13
0
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('SpiffyRadio', True)


SpiffyRadio = conf.registerPlugin('SpiffyRadio')

conf.registerGlobalValue(SpiffyRadio, 'icecastAPIURL', 
    registry.String("", _("""Icecast API URL""")))

conf.registerGlobalValue(SpiffyRadio, 'nowPlayingTemplate', 
    registry.String("Now playing $artist - $title ($listeners listeners) :: Tune in: $listenurl", _("""Template used for np command""")))

conf.registerGlobalValue(SpiffyRadio, 'autoAnnounceChannels', 
    registry.CommaSeparatedListOfStrings([], _("""Auto announce new tracks to these channels""")))

conf.registerGlobalValue(SpiffyRadio, 'autoAnnounceNewTracks', 
    registry.Boolean(False, _("""Whether to announce new tracks when detected. Use in conjunction with pollingIntervalInSeconds.""")))

conf.registerGlobalValue(SpiffyRadio, 'pollingIntervalInSeconds', 
    registry.PositiveInteger (30, _("""Interval in seconds to poll the API for track changes""")))

conf.registerGlobalValue(SpiffyRadio, 'errorMessage', 
    registry.String("Error retrieving current track.", _("""This message is used if there is a problem reaching the API""")))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
示例#14
0
class SafeLevels(registry.OnlySomeStrings):
    validStrings = ('high', 'medium', 'off')

class EngineAPI(registry.OnlySomeStrings):
    validStrings = ('cse', 'legacy')

GoogleCSE = conf.registerPlugin('GoogleCSE')
# This is where your configuration variables (if any) should go.  For example:
# conf.registerGlobalValue(GoogleCSE, 'someConfigVariableName',
#     registry.Boolean(False, _("""Help for someConfigVariableName.""")))
conf.registerGlobalValue(GoogleCSE, 'apikey',
    registry.String('', _("""API key provided by google for API access"""),
        private=True))
conf.registerGlobalValue(GoogleCSE, 'engines',
    registry.CommaSeparatedListOfStrings('', _("""List of available Custom
        Search Engines.""")))
conf.registerChannelValue(GoogleCSE, 'defaultEngine',
    registry.String('', _("""Default Custom Search Engine for channel."""),
        private=True))
conf.registerChannelValue(GoogleCSE, 'maxPageResults',
    registry.Integer(10, _("""Maximum number of page results to fetch.""")))
conf.registerChannelValue(GoogleCSE, 'maxPages',
    registry.Integer(1, _("""Maximum number of page results to fetch.""")))
conf.registerChannelValue(GoogleCSE, 'maxDisplayResults',
    registry.Integer(5, _("""Maximum number of page results to display.""")))
conf.registerChannelValue(GoogleCSE, 'includeSnippet',
    registry.Boolean(False, _("""Display search result snippet in the output.""")))
conf.registerChannelValue(GoogleCSE, 'safeLevel',
    SafeLevels('medium', _("""Search results safe level. Default: medium.""")))
conf.registerChannelValue(GoogleCSE, 'engineAPI',
    EngineAPI('cse', _("""Select google engine mode. \"legacy\" sets the
示例#15
0
# per channel settings

conf.registerChannelValue(ChanTracker, 'useAccountBanIfPossible',
    registry.Boolean(False, """bot will choose account bans when user is identified, only works for b,q,e,I,note commands not automated bans"""))

conf.registerChannelValue(ChanTracker, 'avoidOverlap',   
    registry.Boolean(False, """avoid overlap between items, bot will try to use existing items against users, some limitations with extended bans"""))

conf.registerChannelValue(ChanTracker, 'useIpForGateway',   
    registry.Boolean(False, """use *!*@*ip bans instead of *!ident@gateway/* when gateways cloak is found and ends with ip.*"""))

conf.registerChannelValue(ChanTracker, 'opCommand',
    registry.String("PRIVMSG ChanServ :OP $channel $nick", """command used to obtain channel operator mode"""), opSettable=False)

conf.registerChannelValue(ChanTracker, 'modesToAsk',
    registry.CommaSeparatedListOfStrings(['b','q'], """list of channel modes to sync into the bot's tracking database when it joins the channel"""))
    
conf.registerChannelValue(ChanTracker, 'modesToAskWhenOpped',
    registry.CommaSeparatedListOfStrings(['e','I'], """list of channel modes to sync into the bot's tracking database when it is opped"""))

# related to ban tracking

conf.registerChannelValue(ChanTracker, 'autoExpire',
    registry.Integer(-1, """default expiration time for newly placed bans; -1 disables auto-expiration, otherwise it's in seconds"""))

# announces related to logChannel
    
conf.registerChannelValue(ChanTracker, 'logChannel',
    registry.String("", """where bot announces op's actions; it is highly recommended to set an appropriate operator's channel to receive the various useful messages, nick can be used"""),opSettable=False)

conf.registerChannelValue(ChanTracker, 'useColorForAnnounces',
示例#16
0
    SpiffyTitles, 'dailymotionVideoTitleTemplate',
    registry.String(
        "^ [{{ownerscreenname}}] {{title}} :: Duration: {{duration}} :: {{views_total}} views",
        _("""Template used for Vimeo title responses""")))

conf.registerChannelValue(
    SpiffyTitles, 'dailymotionHandlerEnabled',
    registry.Boolean(
        True, _("""Enable additional information about dailymotion videos""")))

# User agents
conf.registerGlobalValue(
    SpiffyTitles, 'userAgents',
    registry.CommaSeparatedListOfStrings([
        "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.60 Safari/537.36",
        "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0",
        "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko"
    ], _("""Reported user agent when fetching links""")))

# Mime Types
conf.registerGlobalValue(
    SpiffyTitles, 'mimeTypes',
    registry.CommaSeparatedListOfStrings(
        ["text/html"], _("""Acceptable mime types for displaying titles""")))

# Ignored domain pattern
conf.registerChannelValue(
    SpiffyTitles, 'ignoredDomainPattern',
    registry.Regexp("",
                    _("""Domains matching this patterns will be ignored""")))
示例#17
0
                    _("""Domains matching this patterns will be ignored""")),
)

# Whitelist domain pattern
conf.registerChannelValue(
    SpiffyTitles,
    "whitelistDomainPattern",
    registry.Regexp(
        "", _("""Domains not matching this patterns will be ignored""")),
)

# Channel whitelist
conf.registerGlobalValue(
    SpiffyTitles,
    "channelWhitelist",
    registry.CommaSeparatedListOfStrings(
        [], _("""Only show titles on these channels, or all if empty""")),
)

# Channel blacklist
conf.registerGlobalValue(
    SpiffyTitles,
    "channelBlacklist",
    registry.CommaSeparatedListOfStrings(
        [], _("""Never show titles on these channels""")),
)

# Link cache lifetime
conf.registerGlobalValue(
    SpiffyTitles,
    "cacheLifetime",
    registry.Integer(600, _("""Link cache lifetime in seconds""")),
示例#18
0
conf.registerChannelValue(
    HuntNFish,
    "huntTargets",
    registry.CommaSeparatedListOfStrings(
        [
            "bear",
            "gopher",
            "rabbit",
            "hunter",
            "deer",
            "fox",
            "duck",
            "moose",
            "park ranger",
            "Yogi Bear",
            "Boo Boo Bear",
            "dog named Benji",
            "cow",
            "raccoon",
            "koala bear",
            "camper",
            "channel lurker",
            "your mother",
            "lion",
            "ocelot",
            "house cat",
        ],
        _("""List of hunting tagets"""),
    ),
)
conf.registerChannelValue(
    HuntNFish,
示例#19
0
#     registry.Boolean(False, _("""Help for someConfigVariableName.""")))

conf.registerGroup(Apt, 'cache')
conf.registerGlobalValue(
    Apt.cache, 'updateInterval',
    registry.NonNegativeInteger(
        3600 * 24,
        _("""Minimum interval before an
    automatic update of the cache, in seconds. Set to 0 to disable automatic
    updates.""")))

conf.registerGroup(Apt, 'defaults')
conf.registerChannelValue(
    Apt.defaults, 'archs',
    registry.CommaSeparatedListOfStrings([],
                                         _("""Default value of --archs
    for commands that accept it. Comma-separated list of CPU architectures 
    ("arm64", "amd64", "i386", ...). """)))
conf.registerChannelValue(
    Apt.defaults, 'distribs',
    registry.CommaSeparatedListOfStrings([],
                                         _("""Default value of --distribs
    for commands that accept it. Comma-separated list of distributions
    ("Ubuntu", "Debian", "Debian Backports", ...). """)))
conf.registerChannelValue(
    Apt.defaults, 'releases',
    registry.CommaSeparatedListOfStrings([],
                                         _("""Default value of --releases
    for commands that accept it. Comma-separated list of releases ("buster",
    "bionic", "stretch", "stretch-backports", ...). """)))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: