diff --git a/chatcmds.lua b/chatcmds.lua index b0a0048..7360788 100644 --- a/chatcmds.lua +++ b/chatcmds.lua @@ -119,3 +119,16 @@ minetest.chatcommands["me"].func = function(name, param, ...) return oldme(name, param, ...) end +if irc.config.send_kicks and minetest.chatcommands["kick"] then + local oldkick = minetest.chatcommands["kick"].func + -- luacheck: ignore + minetest.chatcommands["kick"].func = function(name, param, ...) + local plname, reason = param:match("^(%S+)%s*(.*)$") + if not plname then + return false, "Usage: /kick player [reason]" + end + irc:say(("*** Kicked %s.%s"):format(name, + reason~="" and " Reason: "..reason or "")) + return oldkick(name, param, ...) + end +end diff --git a/config.lua b/config.lua index c264d16..f0775d9 100644 --- a/config.lua +++ b/config.lua @@ -36,6 +36,7 @@ setting("string", "sasl.pass") -- SASL password setting("string", "channel", nil, true) -- Channel to join setting("string", "key") -- Key for the channel setting("bool", "send_join_part", true) -- Whether to send player join and part messages to the channel +setting("bool", "send_kicks", false) -- Whether to send player kicked messages to the channel ----------------------- -- ADVANCED SETTINGS -- diff --git a/settingtypes.txt b/settingtypes.txt index daebf20..0814167 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -53,6 +53,9 @@ irc.sasl.pass (SASL password) string # or leave the game server. irc.send_join_part (Send join and part messages) bool true +# Enable this to make the bot send messages when players are kicked. +irc.send_kicks (Send kick messages) bool false + # Underlying socket timeout in seconds. irc.timeout (Timeout) int 60 1