Configurable idletime.
authorCMDR furrycat <elite@furrycat.net>
Thu, 29 Sep 2016 10:12:07 +0000 (11:12 +0100)
committerCMDR furrycat <elite@furrycat.net>
Thu, 29 Sep 2016 10:12:07 +0000 (11:12 +0100)
bot.py

diff --git a/bot.py b/bot.py
index 123fbf4..c2ae990 100755 (executable)
--- a/bot.py
+++ b/bot.py
@@ -342,6 +342,15 @@ def do_commands(message, command, raw, non_admin):
       print('Live mode')
       dryrun = False
 
+  elif command == 'idle':
+    # idle
+    m = re.match(r'\bidle\s+(\d+)\b', raw.lower())
+    if m is None:
+      yield from say(message.channel, 'Sorry!')
+      return
+
+    idletime = int(m.group(1))
+
   elif command == 'rss':
     # rss
     m = re.match(r'\brss\s+(\d+)\b', raw.lower())
@@ -521,7 +530,7 @@ modules = {
   'admin': {
     'fn': do_commands,
     'args': [False],
-    'commands': ['avatar', 'debug', 'delete', 'dryrun', 'rss']
+    'commands': ['avatar', 'debug', 'delete', 'dryrun', 'idle', 'rss']
   },
   'any': {
     'fn': do_commands,