Log non-text messages to the game chat, but without contents (like "sticker was sent")
This commit is contained in:
parent
f67191ca37
commit
bf832e684c
17
init.lua
17
init.lua
@ -58,8 +58,9 @@ local function process_updates(response)
|
|||||||
for key, update in pairs(updates.result) do
|
for key, update in pairs(updates.result) do
|
||||||
if update.message then
|
if update.message then
|
||||||
if update.message.text then
|
if update.message.text then
|
||||||
--print(update.message.text)
|
|
||||||
telegram.on_text_receive(update.message)
|
telegram.on_text_receive(update.message)
|
||||||
|
else
|
||||||
|
telegram.notify_non_text_receive(update.message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- TODO Other types of messages
|
-- TODO Other types of messages
|
||||||
@ -116,6 +117,20 @@ function telegram.on_text_receive(msg)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function telegram.notify_non_text_receive(message)
|
||||||
|
local payload = 'something'
|
||||||
|
|
||||||
|
if message.photo then
|
||||||
|
payload = 'photo'
|
||||||
|
elseif message.voice then
|
||||||
|
payload = 'voice message'
|
||||||
|
elseif message.sticker then
|
||||||
|
payload = 'sticker'
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.chat_send_all(message.from.first_name .. "@TG sent " .. payload)
|
||||||
|
end
|
||||||
|
|
||||||
local timer = 0
|
local timer = 0
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
timer = timer + dtime
|
timer = timer + dtime
|
||||||
|
Loading…
Reference in New Issue
Block a user