From 3740ccc4974efb14cc8086479fcce738a50a7213 Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Sun, 7 Aug 2016 17:52:57 +0200 Subject: [PATCH] - AFK: Antworte nur, wenn Keyboard aktiv ist - Post_Photo: send_typing --- otouto/plugins/afk.lua | 15 ++++++++++++--- otouto/plugins/post_photo.lua | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/otouto/plugins/afk.lua b/otouto/plugins/afk.lua index 66d2b8c..aa6b3d9 100644 --- a/otouto/plugins/afk.lua +++ b/otouto/plugins/afk.lua @@ -68,7 +68,7 @@ function afk:pre_process(msg, self) local user_id = msg.from.id local chat_id = msg.chat.id local hash = 'afk:'..chat_id..':'..user_id - + local uhash = 'user:'..user_id if afk:is_offline(hash) then local afk_text = afk:get_afk_text(hash) @@ -80,11 +80,20 @@ function afk:pre_process(msg, self) local duration = makeHumanTime(afk_time) redis:hset(hash, 'afk', false) + local show_afk_keyboard = redis:hget(uhash, 'afk_keyboard') if afk_text then redis:hset(hash, 'afk_text', false) - utilities.send_reply(self, msg, user_name..' ist wieder da (war: '..afk_text..' für '..duration..')!', 'HTML', '{"hide_keyboard":true,"selective":true}') + if show_afk_keyboard == 'true' then + utilities.send_reply(self, msg, user_name..' ist wieder da (war: '..afk_text..' für '..duration..')!', 'HTML', '{"hide_keyboard":true,"selective":true}') + else + utilities.send_message(self, chat_id, user_name..' ist wieder da (war: '..afk_text..' für '..duration..')!', true, nil, 'HTML') + end else - utilities.send_reply(self, msg, user_name..' ist wieder da (war '..duration..' weg)!', nil, '{"hide_keyboard":true,"selective":true}') + if show_afk_keyboard == 'true' then + utilities.send_reply(self, msg, user_name..' ist wieder da (war '..duration..' weg)!', nil, '{"hide_keyboard":true,"selective":true}') + else + utilities.send_message(self, chat_id, user_name..' ist wieder da (war '..duration..' weg)!') + end end end diff --git a/otouto/plugins/post_photo.lua b/otouto/plugins/post_photo.lua index 713a196..bf39102 100644 --- a/otouto/plugins/post_photo.lua +++ b/otouto/plugins/post_photo.lua @@ -19,6 +19,7 @@ function post_photo:pre_process(msg, self, config) return end + utilities.send_typing(self, msg.chat.id, 'upload_photo') -- Saving file to the Telegram Cloud local request = bindings.request(self, 'getFile', { file_id = file_id