Source code for opzet.plugins.cfg

# opzet/plugins/cfg.py
#
#

""" cfg command. """

from opzet.cfg import cfg

## CMNDS

[docs]def docfg(bot, event): obj = cfg if bot.type != "CLI": botcfg = bot.last("cfg", bot.type.lower()) if not botcfg or "owner" not in botcfg or event.origin != botcfg.owner: bot.announce("EOWNER %s" % event.origin) ; return if event.args: ctype = event.args[0] obj = bot.last("cfg", ctype) if not obj: obj = maincfg.get(ctype, None) try: key = event.args[1] value = event.args[2] if key in obj: obj[key] = value ; obj.prefix = "cfg" ; obj.sync() except IndexError: pass if obj: bot.announce("\n".join(obj.show()))
[docs]def register(bot): bot.cmnds.register("cfg", docfg)