Compare commits
No commits in common. "master" and "master" have entirely different histories.
42
.gitignore
vendored
42
.gitignore
vendored
@ -1,42 +0,0 @@
|
||||
# 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
|
||||
|
23
init.lua
23
init.lua
@ -10,7 +10,7 @@ telegram = {}
|
||||
local token = minetest.settings:get("telegram.token")
|
||||
local chat_id = minetest.settings:get("telegram.chatid")
|
||||
local updates_timeout = tonumber(minetest.settings:get("telegram.timeout"))
|
||||
local message_thread_id = tonumber(minetest.settings:get("telegram.message_thread_id"))
|
||||
local message_thread_id = minetest.settings:get("telegram.message_thread_id")
|
||||
|
||||
if not updates_timeout then
|
||||
updates_timeout = 1
|
||||
@ -121,18 +121,6 @@ function telegram.on_text_receive(msg)
|
||||
if command then
|
||||
command(msg)
|
||||
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
|
||||
if msg.reply_to_message and msg.reply_to_message.text then
|
||||
message_text = ">>" .. msg.reply_to_message.text .. "\n" .. message_text
|
||||
@ -177,9 +165,7 @@ end)
|
||||
-- Don't send messages from MT to telegram if we don't know where to
|
||||
if chat_id then
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
if minetest.check_player_privs(name, {shout=true}) then
|
||||
telegram.send_message(chat_id, "<" .. name .. "> " .. message)
|
||||
end
|
||||
return false
|
||||
end)
|
||||
|
||||
@ -199,12 +185,5 @@ if chat_id then
|
||||
end)
|
||||
end
|
||||
end
|
||||
minetest.register_on_mods_loaded(function()
|
||||
telegram.send_message(chat_id, "The server has started")
|
||||
end)
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
telegram.send_message(chat_id, "Server shutdown")
|
||||
end)
|
||||
|
||||
dofile(modpath .. "/commands.lua")
|
||||
|
Loading…
Reference in New Issue
Block a user