1
0
forked from MTSR/telegram

Add command to get active players

This commit is contained in:
neko259 2019-01-16 21:03:03 +02:00
parent 20bbdbfa49
commit 3ddcc0df3c

View File

@ -87,6 +87,13 @@ function telegram.on_text_receive(msg)
telegram.send_message(msg.chat.id, "Pong!") telegram.send_message(msg.chat.id, "Pong!")
elseif msg.text == "groupid" then elseif msg.text == "groupid" then
telegram.send_message(msg.chat.id, "Group id: " .. msg.chat.id) telegram.send_message(msg.chat.id, "Group id: " .. msg.chat.id)
elseif msg.text == "players" then
local players = ""
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
players = players .. player:get_player_name() .. ", "
end
telegram.send_message(msg.chat.id, "Active players: " .. players)
else else
minetest.chat_send_all("<" .. msg.from.first_name .. "@TG> " .. msg.text) minetest.chat_send_all("<" .. msg.from.first_name .. "@TG> " .. msg.text)
end end