add bitbotctl reload
command to reload all modules
This commit is contained in:
parent
99b4663ce7
commit
88ffa421c1
2 changed files with 9 additions and 1 deletions
|
@ -21,7 +21,7 @@ def _die(s):
|
||||||
if args.command == "log":
|
if args.command == "log":
|
||||||
arg_parser.add_argument("--level", "-l", help="Log level",
|
arg_parser.add_argument("--level", "-l", help="Log level",
|
||||||
default="INFO")
|
default="INFO")
|
||||||
elif args.command == "rehash":
|
elif args.command in ["rehash", "reload"]:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
_die("Unknown command '%s'" % args.command)
|
_die("Unknown command '%s'" % args.command)
|
||||||
|
@ -52,6 +52,8 @@ if args.command == "log":
|
||||||
_send("1 log %s" % args.level)
|
_send("1 log %s" % args.level)
|
||||||
elif args.command == "rehash":
|
elif args.command == "rehash":
|
||||||
_send("1 rehash")
|
_send("1 rehash")
|
||||||
|
elif args.command == "reload":
|
||||||
|
_send("1 reload")
|
||||||
|
|
||||||
read_buffer = b""
|
read_buffer = b""
|
||||||
|
|
||||||
|
@ -67,3 +69,5 @@ while True:
|
||||||
line = json.loads(line)
|
line = json.loads(line)
|
||||||
if line["action"] == "log":
|
if line["action"] == "log":
|
||||||
print(line["data"])
|
print(line["data"])
|
||||||
|
elif line["action"] == "ack" and line["data"]:
|
||||||
|
print(line["data"])
|
||||||
|
|
|
@ -98,6 +98,10 @@ class Control(PollSource.PollSource):
|
||||||
self._bot.config.load()
|
self._bot.config.load()
|
||||||
self._bot.log.info("Reloaded config file")
|
self._bot.log.info("Reloaded config file")
|
||||||
keepalive = False
|
keepalive = False
|
||||||
|
elif command == "reload":
|
||||||
|
result = self._bot.try_reload_modules()
|
||||||
|
response_data = result.message
|
||||||
|
keepalive = False
|
||||||
|
|
||||||
self._send_action(client, response_action, response_data, id)
|
self._send_action(client, response_action, response_data, id)
|
||||||
if not keepalive:
|
if not keepalive:
|
||||||
|
|
Loading…
Reference in a new issue