summaryrefslogtreecommitdiffstats
path: root/config.py
diff options
context:
space:
mode:
authorPratyush Desai2021-09-07 16:33:00 +0200
committerGeorg Pfuetzenreuter2021-09-07 16:33:00 +0200
commitca02bba8c341b00973497e6f37a8ee34d75fcf0a (patch)
tree6f562be70e7b852076d8db07b056dce9655ea3c7 /config.py
parent46596e0b33a9a5dc086028f8e0e023a4b599bc95 (diff)
downloadsnoparser-ca02bba8c341b00973497e6f37a8ee34d75fcf0a.tar.gz
snoparser-ca02bba8c341b00973497e6f37a8ee34d75fcf0a.tar.bz2
snoparser-ca02bba8c341b00973497e6f37a8ee34d75fcf0a.zip
TargetChannel config + requirements.txt (#17)
Added requirements.txt Updated configuration value errors Reviewed-on: https://git.com.de/LimnoriaPlugins/SnoParser/pulls/17 Co-authored-by: Pratyush Desai <pratyush.desai@liberta.casa> Co-committed-by: Pratyush Desai <pratyush.desai@liberta.casa>
Diffstat (limited to 'config.py')
-rw-r--r--config.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/config.py b/config.py
index 5a9ebbd..a585def 100644
--- a/config.py
+++ b/config.py
@@ -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,8 @@ 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.registerGlobalValue(SnoParser, 'AutoVhost',
registry.String('libcasa/user/', ("""Configure the vhost eg. libcasa/user/$account""")))