diff --git a/scripts/chatbot.py b/scripts/chatbot.py index 6c6470c8091d88b46ce1afe9f3483f0495208f3f..a0b95acd7c6e78129889e58dd49c198a9395846b 100644 --- a/scripts/chatbot.py +++ b/scripts/chatbot.py @@ -83,6 +83,16 @@ def register_handlers(bot): ['supervisorctl', 'status']).decode('ascii') + "\n```" bot.send_message(status, channel_id) + def supervisorctl(msg, user, channel_id): + if not is_shifter(user) and not is_operator(user): + bot.send_message( + "Sorry @{}, only operators and shifters are allowed to mess " + "with me, sorry...".format(user), channel_id) + return + output = subprocess.check_output(['supervisorctl'] + + msg.split()).decode('ascii') + bot.send_message(output, channel_id) + def shifters(msg, user, channel_id): if channel_id != CHANNEL_ID: print("skipping")