diff options
Diffstat (limited to 'config.py')
| -rw-r--r-- | config.py | 111 |
1 files changed, 107 insertions, 4 deletions
@@ -1,5 +1,5 @@ ### -# Copyright (c) 2021, mogad0n +# Copyright (c) 2021, mogad0n and Georg Pfuetzenreuter <georg@lysergic.dev> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ ### -from supybot import conf, registry +from supybot import conf, registry, ircutils try: from supybot.i18n import PluginInternationalization _ = PluginInternationalization('SnoParser') @@ -37,6 +37,12 @@ except: # without the i18n module _ = lambda x: x +#class ValidChannel(registry.string): +# """Value must be a valid channel""" +# def setValue(self, v): +# if not (ircutils.isChannel(v)): +# self.error() +# registry.String.setValue(self, v) def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -52,8 +58,11 @@ SnoParser = conf.registerPlugin('SnoParser') # conf.registerGlobalValue(SnoParser, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) -conf.registerGlobalValue(SnoParser, 'targetChannel', - registry.String(None, ("""Sends reformatted snolines to the <channel>"""))) +#conf.registerNetworkValue(SnoParser, 'targetChannel', ValidChannel, +# ("", ("""Determines which channel the bot should send snolines"""))) + +conf.registerNetworkValue(SnoParser, 'targetChannel', + registry.String("", ("""Determines which channel the bot should snolines example: `#snotices`"""))) conf.registerGlobalValue(SnoParser, 'AutoVhost', registry.String('libcasa/user/', ("""Configure the vhost eg. libcasa/user/$account"""))) @@ -61,4 +70,98 @@ conf.registerGlobalValue(SnoParser, 'AutoVhost', conf.registerGlobalValue(SnoParser, 'preventHighlight', registry.Boolean(True, ("""Toggles in channel highlights with ZWSP"""))) +conf.registerGlobalValue(SnoParser, 'debug', + registry.Boolean('false', + """ + SnoParser: Verbose output. Note: there is a seperate debug option for the `whois` client. + """ + , private=True +)) + +### +# REDIS related settings below: +### +conf.registerGroup(SnoParser, 'redis') +conf.registerGlobalValue(SnoParser.redis, 'db1', + registry.Integer(1, + """ + Redis: Database number for counting of NICKNAMES. + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.redis, 'db2', + registry.Integer(2, + """ + Redis: Database number for counting of IP ADDRESSES. + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.redis, 'host', + registry.String('127.0.0.1', + """ + Redis: IP address or hostname. + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.redis, 'port', + registry.Integer(6379, + """ + Redis: Port. + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.redis, 'username', + registry.String('', + """ + Redis: Username. This is optional and has not been tested. It is recommended to perform initial tests on a local instance with no username and password. + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.redis, 'password', + registry.String('', + """ + Redis: Password. This is optional and has not been tested. It is recommended to perform initial tests on a local instance with no username and password. + """ +)) +conf.registerGlobalValue(SnoParser.redis, 'timeout', + registry.Integer(5, + """ + Redis: Socket Timeout. The developer does not know what to recommend here, but `5` seems to yield good results. + """ +)) + + +### +## WHOIS related settings below: +### +conf.registerGroup(SnoParser, 'whois') +conf.registerGlobalValue(SnoParser.whois, 'debug', + registry.Boolean('false', + """ + SnoParser: True: Very verbose console output. False: Mostly silent operation. + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.whois, 'sample', + registry.String('', + """ + SnoParser: This allows to set a testing IP address, if the plugin shall be evaluated on i.e. a local network. This will override all IP addresses from SNOTICES! + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.whois, 'ttl', + registry.Integer(3600, + """ + SnoParser: How long to cache WHOIS entries for. + """ + , private=True +)) +conf.registerGroup(SnoParser.whois, 'redis') +conf.registerGlobalValue(SnoParser.whois.redis, 'db', + registry.Integer(0, + """ + Redis: Database number for WHOIS query caching. + """ +)) + # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: |
