forked from minetest-mods/irc
Rename !who to !players and make it list all players
This commit is contained in:
parent
290082760b
commit
85b4ba3f8f
@ -104,3 +104,17 @@ mt_irc:register_bot_command("uptime", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
mt_irc:register_bot_command("players", {
|
||||||
|
description = "List the players on the server",
|
||||||
|
func = function(user, args)
|
||||||
|
local players = minetest.get_connected_players()
|
||||||
|
local names = {}
|
||||||
|
for _, player in pairs(players) do
|
||||||
|
table.insert(names, player:get_player_name())
|
||||||
|
end
|
||||||
|
mt_irc:say(user.nick, "Connected players: "
|
||||||
|
..table.concat(names))
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
@ -2,10 +2,8 @@
|
|||||||
-- See LICENSE.txt for details.
|
-- See LICENSE.txt for details.
|
||||||
|
|
||||||
|
|
||||||
if not mt_irc.sendLocal then
|
function mt_irc:sendLocal(message)
|
||||||
function mt_irc:sendLocal(message)
|
minetest.chat_send_all(message)
|
||||||
minetest.chat_send_all(message)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function mt_irc:queueMsg(message)
|
function mt_irc:queueMsg(message)
|
||||||
|
@ -49,19 +49,6 @@ minetest.register_chatcommand("who", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mt_irc:register_bot_command("who", {
|
|
||||||
description = "Tell who is playing",
|
|
||||||
func = function(user, args)
|
|
||||||
local s = ""
|
|
||||||
for name, _ in pairs(mt_irc.joined_players) do
|
|
||||||
s = s.." "..name
|
|
||||||
end
|
|
||||||
mt_irc:say(user.nick, "Players On Channel:"..s)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
Loading…
Reference in New Issue
Block a user