forked from MTSR/telegram
Added filtering of messages by chat topic
This commit is contained in:
parent
d99eecd773
commit
1000540ef9
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Compiled Lua sources
|
||||||
|
luac.out
|
||||||
|
|
||||||
|
# luarocks build files
|
||||||
|
*.src.rock
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.os
|
||||||
|
*.ko
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
*.def
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
.idea
|
||||||
|
*.iml
|
||||||
|
|
14
init.lua
14
init.lua
@ -10,7 +10,7 @@ telegram = {}
|
|||||||
local token = minetest.settings:get("telegram.token")
|
local token = minetest.settings:get("telegram.token")
|
||||||
local chat_id = minetest.settings:get("telegram.chatid")
|
local chat_id = minetest.settings:get("telegram.chatid")
|
||||||
local updates_timeout = tonumber(minetest.settings:get("telegram.timeout"))
|
local updates_timeout = tonumber(minetest.settings:get("telegram.timeout"))
|
||||||
local message_thread_id = minetest.settings:get("telegram.message_thread_id")
|
local message_thread_id = tonumber(minetest.settings:get("telegram.message_thread_id"))
|
||||||
|
|
||||||
if not updates_timeout then
|
if not updates_timeout then
|
||||||
updates_timeout = 1
|
updates_timeout = 1
|
||||||
@ -121,6 +121,18 @@ function telegram.on_text_receive(msg)
|
|||||||
if command then
|
if command then
|
||||||
command(msg)
|
command(msg)
|
||||||
else
|
else
|
||||||
|
if message_thread_id then
|
||||||
|
if msg.message_thread_id == nil then
|
||||||
|
minetest.log("action", "telegram: message_thread_id not equal 'nil'")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if msg.message_thread_id ~= message_thread_id then
|
||||||
|
minetest.log("action", "telegram: message_thread_id not equal " .. msg.message_thread_id)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local message_text = msg.text
|
local message_text = msg.text
|
||||||
if msg.reply_to_message and msg.reply_to_message.text then
|
if msg.reply_to_message and msg.reply_to_message.text then
|
||||||
message_text = ">>" .. msg.reply_to_message.text .. "\n" .. message_text
|
message_text = ">>" .. msg.reply_to_message.text .. "\n" .. message_text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user