If no players are on server, show a separate message instead of reporting an empty list
This commit is contained in:
parent
c00d1e340a
commit
f67191ca37
14
commands.lua
14
commands.lua
@ -8,11 +8,17 @@ end)
|
|||||||
|
|
||||||
telegram.register_command("players", function(msg)
|
telegram.register_command("players", function(msg)
|
||||||
local players = ""
|
local players = ""
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
|
||||||
local name = player:get_player_name()
|
local player_list = minetest.get_connected_players()
|
||||||
players = players .. player:get_player_name() .. ", "
|
if #player_list > 0 then
|
||||||
|
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
|
||||||
|
telegram.send_message(msg.chat.id, "No active players detected." .. players)
|
||||||
end
|
end
|
||||||
telegram.send_message(msg.chat.id, "Active players: " .. players)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
telegram.register_command("status", function(msg)
|
telegram.register_command("status", function(msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user