4 Commits

Author SHA1 Message Date
s20
c088ba4e40 Add number of connected players to players command (#73) 2023-11-04 18:56:07 +01:00
758e9b6361 Fix error caused by ident check notice (#71)
Fixed the error where it cannot find an user at the notice hook. 
It happened when you get the `NOTICE * :*** Looking up your hostname and checking ident`
Because `*` is not in the `<nick>!<ident>@<host>`
2022-03-23 22:13:51 +01:00
7fbbfd6cdb Fix failing luacheck 2020-07-18 18:00:38 +02:00
cc78f12a4c Display total number of players with /who (#65) 2020-07-18 17:57:42 +02:00
7 changed files with 10 additions and 9 deletions

4
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "irc"] [submodule "src/LuaIRC"]
path = irc path = irc
url = https://sys4.fr/gitea/mtcontrib/LuaIRC.git url = https://github.com/ShadowNinja/LuaIRC.git

View File

@ -169,8 +169,10 @@ irc.register_bot_command("players", {
for _, player in pairs(players) do for _, player in pairs(players) do
table.insert(names, player:get_player_name()) table.insert(names, player:get_player_name())
end end
return true, "Connected players: " return true, string.format("%d connected player(s): %s",
..table.concat(names, ", ") #players,
table.concat(names, ", ")
)
end end
}) })

View File

@ -31,7 +31,7 @@ minetest.register_on_chat_message(function(name, message)
if nl then if nl then
message = message:sub(1, nl - 1) message = message:sub(1, nl - 1)
end end
irc.say(irc.playerMessage(name, core.strip_colors(message))) irc.say(irc.playerMessage(name, minetest.strip_colors(message)))
end) end)

View File

@ -171,7 +171,7 @@ end
function irc.hooks.notice(user, target, message) function irc.hooks.notice(user, target, message)
if user.nick and target == irc.config.channel then if user and user.nick and target == irc.config.channel then
irc.sendLocal("-"..user.nick.."@IRC- "..message) irc.sendLocal("-"..user.nick.."@IRC- "..message)
end end
end end

View File

@ -224,4 +224,3 @@ function irc.queue(msg)
irc.conn:queue(msg) irc.conn:queue(msg)
end end
minetest.log("action", "[irc] loaded.")

2
irc

Submodule irc updated: b8d594e651...e49a52ede1

View File

@ -47,7 +47,7 @@ minetest.register_chatcommand("who", {
out[n] = plname out[n] = plname
end end
table.sort(out) table.sort(out)
return true, "Players in channel: "..table.concat(out, ", ") return true, n.." player(s) in channel: "..table.concat(out, ", ")
end end
}) })