From f6ba2d9e19f1bf77fa57585038b2291bd0547620 Mon Sep 17 00:00:00 2001 From: Adrian Lopez Date: Thu, 22 Oct 2015 11:17:17 +0200 Subject: [PATCH] Add SKYPE_CHATID env variable. Useful to answer to the same chat in commands that last more than timeout --- sevabot/bot/modules.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sevabot/bot/modules.py b/sevabot/bot/modules.py index e518657..f0e90d8 100644 --- a/sevabot/bot/modules.py +++ b/sevabot/bot/modules.py @@ -16,7 +16,7 @@ import settings -from sevabot.utils import fail_safe, ensure_unicode +from sevabot.utils import fail_safe, ensure_unicode, get_chat_id logger = logging.getLogger("sevabot") @@ -51,6 +51,7 @@ def run(self, msg, args, callback): username = ensure_unicode(msg.Sender.Handle) full_name = ensure_unicode(msg.Sender.FullName) chat_name = ensure_unicode(msg.ChatName) + chat_id = ensure_unicode(get_chat_id(msg.Chat)) #timeout(execute_module, name, args, callback, default=) def threaded_run(): @@ -62,6 +63,7 @@ def threaded_run(): env["SKYPE_USERNAME"] = username.encode("utf-8") env["SKYPE_FULLNAME"] = full_name.encode("utf-8") env["SKYPE_CHATNAME"] = chat_name.encode("utf-8") + env["SKYPE_CHATID"] = chat_id.encode("utf-8") process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, env=env) out = process.communicate()[0]