From b6a21990be0e09b2c0179e65421938d8770fce3e Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Thu, 29 Sep 2016 10:18:29 +0100 Subject: [PATCH] Command to toggle dryrun. --- bot.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 05b1c13..7af9c0f 100755 --- a/bot.py +++ b/bot.py @@ -317,6 +317,21 @@ def do_commands(message, command, raw, non_admin): yield from client.purge_from(message.channel, *args, limit = limit) return + elif command == 'dryrun': + # dryrun + m = re.match(r'\bdryrun\s+(o(?:ff|n))\b', raw.lower()) + if m is None: + yield from say(message.channel, 'Sorry!') + return + + arg = m.group(1) + if arg == 'on': + print('DRYRUN mode') + dryrun = True + elif arg == 'off': + print('Live mode') + dryrun = False + elif command == 'rss': # rss m = re.match(r'\brss\s+(\d+)\b', raw.lower()) @@ -496,7 +511,7 @@ modules = { 'admin': { 'fn': do_commands, 'args': [False], - 'commands': ['avatar', 'debug', 'delete', 'rss'] + 'commands': ['avatar', 'debug', 'delete', 'dryrun', 'rss'] }, 'any': { 'fn': do_commands, -- 2.7.4