]> jfr.im git - erebus.git/commitdiff
admin_config - add !getconfig, remove some unused functions main
authorJohn Runyon <redacted>
Thu, 9 May 2024 22:11:01 +0000 (16:11 -0600)
committerJohn Runyon <redacted>
Thu, 9 May 2024 22:11:01 +0000 (16:11 -0600)
modules/admin_config.py

index a698e4c86310f0de90a724656f2820e02e575380..4f7ef9015533572b7f8726b38244bb2a7e0dab33 100644 (file)
@@ -25,23 +25,16 @@ modstop = lib.modstop
 
 # module code
 
-def _resolve_user(s):
-       if s.startswith("#"):
-               return lib.parent.User(s, s[1:])
+@lib.hook(needchan=False, glevel=lib.OWNER)
+@lib.help('<section> <key>', 'gets a current config file setting')
+@lib.argsEQ(2)
+def getconfig(bot, user, chan, realtarget, *args):
+       section, key = args[0], args[1]
+       value = bot.parent.cfg.get(section, key)
+       if value is not None:
+               user.msg('[%s] %s: %s' % (section, key, value))
        else:
-               return lib.parent.user(s, create=False)
-
-def _resolve_level(s):
-       try:
-               i = int(s)
-               return i
-       except ValueError:
-               su = s.upper()
-               if su == "ANYONE":
-                       su = "AUTHED" # resolve to 0 instead of -1
-               if su in lib.glevs:
-                       return lib.glevs[su]
-       return None
+               user.msg('That option is not set ([%s] %s)' % (section, key))
 
 @lib.hook(needchan=False, glevel=lib.OWNER)
 @lib.help('<section> <key> <value>', 'sets a config file setting to a new value')