Compare commits
12 Commits
ceb40e2bb3
...
3d162344f3
Author | SHA1 | Date |
---|---|---|
luk3yx | 3d162344f3 | |
flux | db801fb81b | |
flux | db3b43a635 | |
SmallJoker | 7fbbfd6cdb | |
Andrey Kozlovskiy | cc78f12a4c | |
David Leal | 7f86747ece | |
flux | 4aeb01a9bd | |
flux | 68d6f88900 | |
flux | 305cd1188a | |
flux | ba8d4f2d7d | |
flux | 8507a9b80f | |
flux | 68db07eeb8 |
|
@ -8,4 +8,4 @@ jobs:
|
|||
- name: lint
|
||||
uses: Roang-zero1/factorio-mod-luacheck@master
|
||||
with:
|
||||
luacheckrc_url: https://raw.githubusercontent.com/minetest-mods/irc/master/.luacheckrc
|
||||
luacheckrc_url: https://raw.githubusercontent.com/BlockySurvival/irc2/master/.luacheckrc
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[submodule "src/LuaIRC"]
|
||||
path = irc
|
||||
url = https://github.com/ShadowNinja/LuaIRC.git
|
||||
url = https://github.com/BlockySurvival/LuaIRC2.git
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
allow_defined_top = true
|
||||
|
||||
read_globals = {
|
||||
"minetest"
|
||||
"minetest", "core",
|
||||
"cloaking",
|
||||
}
|
||||
|
||||
exclude_files = {
|
||||
|
|
53
botcmds.lua
53
botcmds.lua
|
@ -1,5 +1,5 @@
|
|||
|
||||
irc.bot_commands = {}
|
||||
irc2.bot_commands = {}
|
||||
|
||||
-- From RFC1459:
|
||||
-- "Because of IRC’s scandanavian origin, the characters {}| are
|
||||
|
@ -15,9 +15,9 @@ local function nickequals(nick1, nick2)
|
|||
return irclower(nick1) == irclower(nick2)
|
||||
end
|
||||
|
||||
function irc.check_botcmd(msg)
|
||||
local prefix = irc.config.command_prefix
|
||||
local nick = irc.conn.nick
|
||||
function irc2.check_botcmd(msg)
|
||||
local prefix = irc2.config.command_prefix
|
||||
local nick = irc2.conn.nick
|
||||
local text = msg.args[2]
|
||||
local nickpart = text:sub(1, #nick)
|
||||
local suffix = text:sub(#nick+1, #nick+2)
|
||||
|
@ -25,18 +25,18 @@ function irc.check_botcmd(msg)
|
|||
-- First check for a nick prefix
|
||||
if nickequals(nickpart, nick)
|
||||
and (suffix == ": " or suffix == ", ") then
|
||||
irc.bot_command(msg, text:sub(#nick + 3))
|
||||
irc2.bot_command(msg, text:sub(#nick + 3))
|
||||
return true
|
||||
-- Then check for the configured prefix
|
||||
elseif prefix and text:sub(1, #prefix):lower() == prefix:lower() then
|
||||
irc.bot_command(msg, text:sub(#prefix + 1))
|
||||
irc2.bot_command(msg, text:sub(#prefix + 1))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
function irc.bot_command(msg, text)
|
||||
function irc2.bot_command(msg, text)
|
||||
-- Remove leading whitespace
|
||||
text = text:match("^%s*(.*)")
|
||||
if text:sub(1, 1) == "@" then
|
||||
|
@ -44,16 +44,15 @@ function irc.bot_command(msg, text)
|
|||
if not player_to then
|
||||
return
|
||||
elseif not minetest.get_player_by_name(player_to) then
|
||||
irc.reply("User '"..player_to.."' is not in the game.")
|
||||
irc2.reply("User '"..player_to.."' is not in the game.")
|
||||
return
|
||||
elseif not irc.joined_players[player_to] then
|
||||
irc.reply("User '"..player_to.."' is not using IRC.")
|
||||
elseif not irc2.joined_players[player_to] then
|
||||
irc2.reply("User '"..player_to.."' is not using IRC.")
|
||||
return
|
||||
end
|
||||
minetest.chat_send_player(player_to,
|
||||
minetest.colorize(irc.config.pm_color,
|
||||
"PM from "..msg.user.nick.."@IRC: "..message, false))
|
||||
irc.reply("Message sent!")
|
||||
"PM from "..msg.user.nick.."@IRC: "..message, false)
|
||||
irc2.reply("Message sent!")
|
||||
return
|
||||
end
|
||||
local pos = text:find(" ", 1, true)
|
||||
|
@ -66,36 +65,36 @@ function irc.bot_command(msg, text)
|
|||
args = ""
|
||||
end
|
||||
|
||||
if not irc.bot_commands[cmd] then
|
||||
irc.reply("Unknown command '"..cmd.."'. Try 'help'."
|
||||
if not irc2.bot_commands[cmd] then
|
||||
irc2.reply("Unknown command '"..cmd.."'. Try 'help'."
|
||||
.." Or use @playername <message> to send a private message")
|
||||
return
|
||||
end
|
||||
|
||||
local _, message = irc.bot_commands[cmd].func(msg.user, args)
|
||||
local _, message = irc2.bot_commands[cmd].func(msg.user, args)
|
||||
if message then
|
||||
irc.reply(message)
|
||||
irc2.reply(message)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function irc.register_bot_command(name, def)
|
||||
function irc2.register_bot_command(name, def)
|
||||
if (not def.func) or (type(def.func) ~= "function") then
|
||||
error("Erroneous bot command definition. def.func missing.", 2)
|
||||
elseif name:sub(1, 1) == "@" then
|
||||
error("Erroneous bot command name. Command name begins with '@'.", 2)
|
||||
end
|
||||
irc.bot_commands[name] = def
|
||||
irc2.bot_commands[name] = def
|
||||
end
|
||||
|
||||
|
||||
irc.register_bot_command("help", {
|
||||
irc2.register_bot_command("help", {
|
||||
params = "<command>",
|
||||
description = "Get help about a command",
|
||||
func = function(_, args)
|
||||
if args == "" then
|
||||
local cmdlist = { }
|
||||
for name in pairs(irc.bot_commands) do
|
||||
for name in pairs(irc2.bot_commands) do
|
||||
cmdlist[#cmdlist+1] = name
|
||||
end
|
||||
return true, "Available commands: "..table.concat(cmdlist, ", ")
|
||||
|
@ -103,13 +102,13 @@ irc.register_bot_command("help", {
|
|||
.." help about a specific command."
|
||||
end
|
||||
|
||||
local cmd = irc.bot_commands[args]
|
||||
local cmd = irc2.bot_commands[args]
|
||||
if not cmd then
|
||||
return false, "Unknown command '"..args.."'."
|
||||
end
|
||||
|
||||
return true, ("Usage: %s%s %s -- %s"):format(
|
||||
irc.config.command_prefix or "",
|
||||
irc2.config.command_prefix or "",
|
||||
args,
|
||||
cmd.params or "<no parameters>",
|
||||
cmd.description or "<no description>")
|
||||
|
@ -117,7 +116,7 @@ irc.register_bot_command("help", {
|
|||
})
|
||||
|
||||
|
||||
irc.register_bot_command("list", {
|
||||
irc2.register_bot_command("list", {
|
||||
params = "",
|
||||
description = "List available commands.",
|
||||
func = function()
|
||||
|
@ -127,7 +126,7 @@ irc.register_bot_command("list", {
|
|||
})
|
||||
|
||||
|
||||
irc.register_bot_command("whereis", {
|
||||
irc2.register_bot_command("whereis", {
|
||||
params = "<player>",
|
||||
description = "Tell the location of <player>",
|
||||
func = function(_, args)
|
||||
|
@ -146,7 +145,7 @@ irc.register_bot_command("whereis", {
|
|||
|
||||
|
||||
local starttime = os.time()
|
||||
irc.register_bot_command("uptime", {
|
||||
irc2.register_bot_command("uptime", {
|
||||
description = "Tell how much time the server has been up",
|
||||
func = function()
|
||||
local cur_time = os.time()
|
||||
|
@ -161,7 +160,7 @@ irc.register_bot_command("uptime", {
|
|||
})
|
||||
|
||||
|
||||
irc.register_bot_command("players", {
|
||||
irc2.register_bot_command("players", {
|
||||
description = "List the players on the server",
|
||||
func = function()
|
||||
local players = minetest.get_connected_players()
|
||||
|
|
16
callback.lua
16
callback.lua
|
@ -4,26 +4,26 @@
|
|||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
if irc.connected and irc.config.send_join_part then
|
||||
irc.say("*** "..name.." joined the game")
|
||||
if irc2.connected and irc2.config.send_join_part then
|
||||
irc2.say("*** "..name.." joined the game")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_on_leaveplayer(function(player, timed_out)
|
||||
local name = player:get_player_name()
|
||||
if irc.connected and irc.config.send_join_part then
|
||||
irc.say("*** "..name.." left the game"..
|
||||
if irc2.connected and irc2.config.send_join_part then
|
||||
irc2.say("*** "..name.." left the game"..
|
||||
(timed_out and " (Timed out)" or ""))
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
if not irc.connected
|
||||
if not irc2.connected
|
||||
or message:sub(1, 1) == "/"
|
||||
or message:sub(1, 5) == "[off]"
|
||||
or not irc.joined_players[name]
|
||||
or not irc2.joined_players[name]
|
||||
or (not minetest.check_player_privs(name, {shout=true})) then
|
||||
return
|
||||
end
|
||||
|
@ -31,11 +31,11 @@ minetest.register_on_chat_message(function(name, message)
|
|||
if nl then
|
||||
message = message:sub(1, nl - 1)
|
||||
end
|
||||
irc.say(irc.playerMessage(name, core.strip_colors(message)))
|
||||
irc2.say(irc2.playerMessage(name, minetest.strip_colors(message)))
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
irc.disconnect("Game shutting down.")
|
||||
irc2.disconnect("Game shutting down.")
|
||||
end)
|
||||
|
||||
|
|
82
chatcmds.lua
82
chatcmds.lua
|
@ -5,22 +5,22 @@
|
|||
-- Feature-specific commands (like /join) are in their own files.
|
||||
|
||||
|
||||
minetest.register_chatcommand("irc_msg", {
|
||||
minetest.register_chatcommand("irc2_msg", {
|
||||
params = "<name> <message>",
|
||||
description = "Send a private message to an IRC user",
|
||||
description = "Send a private message to a Libera Chat (IRC) user",
|
||||
privs = {shout=true},
|
||||
func = function(name, param)
|
||||
if not irc.connected then
|
||||
return false, "Not connected to IRC. Use /irc_connect to connect."
|
||||
if not irc2.connected then
|
||||
return false, "Not connected to Libera IRC. Use /irc2_connect to connect."
|
||||
end
|
||||
local found, _, toname, message = param:find("^([^%s]+)%s(.+)")
|
||||
if not found then
|
||||
return false, "Invalid usage, see /help irc_msg."
|
||||
return false, "Invalid usage, see /help irc2_msg."
|
||||
end
|
||||
local toname_l = toname:lower()
|
||||
local validNick = false
|
||||
local hint = "They have to be in the channel"
|
||||
for nick in pairs(irc.conn.channels[irc.config.channel].users) do
|
||||
for nick in pairs(irc2.conn.channels[irc2.config.channel].users) do
|
||||
if nick:lower() == toname_l then
|
||||
validNick = true
|
||||
break
|
||||
|
@ -33,80 +33,80 @@ minetest.register_chatcommand("irc_msg", {
|
|||
if not validNick then
|
||||
return false, "You can not message that user. ("..hint..")"
|
||||
end
|
||||
irc.say(toname, irc.playerMessage(name, message))
|
||||
irc2.say(toname, irc2.playerMessage(name, message))
|
||||
return true, "Message sent!"
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_chatcommand("irc_names", {
|
||||
minetest.register_chatcommand("irc2_names", {
|
||||
params = "",
|
||||
description = "List the users in IRC.",
|
||||
description = "List the users in Libera IRC.",
|
||||
func = function()
|
||||
if not irc.connected then
|
||||
return false, "Not connected to IRC. Use /irc_connect to connect."
|
||||
if not irc2.connected then
|
||||
return false, "Not connected to Libera IRC. Use /irc2_connect to connect."
|
||||
end
|
||||
local users = { }
|
||||
for nick in pairs(irc.conn.channels[irc.config.channel].users) do
|
||||
for nick in pairs(irc2.conn.channels[irc2.config.channel].users) do
|
||||
table.insert(users, nick)
|
||||
end
|
||||
return true, "Users in IRC: "..table.concat(users, ", ")
|
||||
return true, "Users in Libera IRC: "..table.concat(users, ", ")
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_chatcommand("irc_connect", {
|
||||
description = "Connect to the IRC server.",
|
||||
privs = {irc_admin=true},
|
||||
minetest.register_chatcommand("irc2_connect", {
|
||||
description = "Connect to the Libera IRC server.",
|
||||
privs = {irc2_admin=true},
|
||||
func = function(name)
|
||||
if irc.connected then
|
||||
return false, "You are already connected to IRC."
|
||||
if irc2.connected then
|
||||
return false, "You are already connected to Libera IRC."
|
||||
end
|
||||
minetest.chat_send_player(name, "IRC: Connecting...")
|
||||
irc.connect()
|
||||
irc2.connect()
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_chatcommand("irc_disconnect", {
|
||||
minetest.register_chatcommand("irc2_disconnect", {
|
||||
params = "[message]",
|
||||
description = "Disconnect from the IRC server.",
|
||||
privs = {irc_admin=true},
|
||||
description = "Disconnect from Libera IRC.",
|
||||
privs = {irc2_admin=true},
|
||||
func = function(name, param)
|
||||
if not irc.connected then
|
||||
return false, "Not connected to IRC. Use /irc_connect to connect."
|
||||
if not irc2.connected then
|
||||
return false, "Not connected to Libera IRC. Use /irc2_connect to connect."
|
||||
end
|
||||
if param == "" then
|
||||
param = "Manual disconnect by "..name
|
||||
end
|
||||
irc.disconnect(param)
|
||||
irc2.disconnect(param)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_chatcommand("irc_reconnect", {
|
||||
description = "Reconnect to the IRC server.",
|
||||
privs = {irc_admin=true},
|
||||
minetest.register_chatcommand("irc2_reconnect", {
|
||||
description = "Reconnect to Libera IRC.",
|
||||
privs = {irc2_admin=true},
|
||||
func = function(name)
|
||||
if not irc.connected then
|
||||
return false, "Not connected to IRC. Use /irc_connect to connect."
|
||||
if not irc2.connected then
|
||||
return false, "Not connected to Libera IRC. Use /irc2_connect to connect."
|
||||
end
|
||||
minetest.chat_send_player(name, "IRC: Reconnecting...")
|
||||
irc.disconnect("Reconnecting...")
|
||||
irc.connect()
|
||||
irc2.disconnect("Reconnecting...")
|
||||
irc2.connect()
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_chatcommand("irc_quote", {
|
||||
minetest.register_chatcommand("irc2_quote", {
|
||||
params = "<command>",
|
||||
description = "Send a raw command to the IRC server.",
|
||||
privs = {irc_admin=true},
|
||||
description = "Send a raw command Libera IRC.",
|
||||
privs = {irc2_admin=true},
|
||||
func = function(name, param)
|
||||
if not irc.connected then
|
||||
return false, "Not connected to IRC. Use /irc_connect to connect."
|
||||
if not irc2.connected then
|
||||
return false, "Not connected to Libera IRC. Use /irc2_connect to connect."
|
||||
end
|
||||
irc.queue(param)
|
||||
irc2.queue(param)
|
||||
minetest.chat_send_player(name, "Command sent!")
|
||||
end
|
||||
})
|
||||
|
@ -115,11 +115,11 @@ minetest.register_chatcommand("irc_quote", {
|
|||
local oldme = minetest.chatcommands["me"].func
|
||||
-- luacheck: ignore
|
||||
minetest.chatcommands["me"].func = function(name, param, ...)
|
||||
irc.say(("* %s %s"):format(name, param))
|
||||
irc2.say(("* %s %s"):format(name, param))
|
||||
return oldme(name, param, ...)
|
||||
end
|
||||
|
||||
if irc.config.send_kicks and minetest.chatcommands["kick"] then
|
||||
if irc2.config.send_kicks and minetest.chatcommands["kick"] then
|
||||
local oldkick = minetest.chatcommands["kick"].func
|
||||
-- luacheck: ignore
|
||||
minetest.chatcommands["kick"].func = function(name, param, ...)
|
||||
|
@ -127,7 +127,7 @@ if irc.config.send_kicks and minetest.chatcommands["kick"] then
|
|||
if not plname then
|
||||
return false, "Usage: /kick player [reason]"
|
||||
end
|
||||
irc.say(("*** Kicked %s.%s"):format(name,
|
||||
irc2.say(("*** Kicked %s.%s"):format(name,
|
||||
reason~="" and " Reason: "..reason or ""))
|
||||
return oldkick(name, param, ...)
|
||||
end
|
||||
|
|
26
config.lua
26
config.lua
|
@ -2,27 +2,36 @@
|
|||
-- See LICENSE.txt for details.
|
||||
|
||||
|
||||
irc.config = {}
|
||||
irc2.config = {}
|
||||
|
||||
local function setting(stype, name, default, required)
|
||||
local value
|
||||
if minetest.settings and minetest.settings.get and minetest.settings.get_bool then
|
||||
if stype == "bool" then
|
||||
value = minetest.settings:get_bool("irc."..name)
|
||||
value = minetest.settings:get_bool("irc2."..name)
|
||||
elseif stype == "string" then
|
||||
value = minetest.settings:get("irc."..name)
|
||||
value = minetest.settings:get("irc2."..name)
|
||||
elseif stype == "number" then
|
||||
value = tonumber(minetest.settings:get("irc."..name))
|
||||
value = tonumber(minetest.settings:get("irc2."..name))
|
||||
end
|
||||
else
|
||||
-- The old methods for getting settings for backward compatibility. Deprecated on 0.4.16+
|
||||
if stype == "bool" then
|
||||
value = minetest.setting_getbool("irc2."..name)
|
||||
elseif stype == "string" then
|
||||
value = minetest.setting_get("irc2."..name)
|
||||
elseif stype == "number" then
|
||||
value = tonumber(minetest.setting_get("irc2."..name))
|
||||
end
|
||||
end
|
||||
if value == nil then
|
||||
if required then
|
||||
error("Required configuration option irc."..
|
||||
error("Required configuration option irc2."..
|
||||
name.." missing.")
|
||||
end
|
||||
value = default
|
||||
end
|
||||
irc.config[name] = value
|
||||
irc2.config[name] = value
|
||||
end
|
||||
|
||||
-------------------------
|
||||
|
@ -33,7 +42,7 @@ setting("string", "nick", nil, true) -- Nickname
|
|||
setting("string", "server", nil, true) -- Server address to connect to
|
||||
setting("number", "port", 6667) -- Server port to connect to
|
||||
setting("string", "NSPass") -- NickServ password
|
||||
setting("string", "sasl.user", irc.config.nick) -- SASL username
|
||||
setting("string", "sasl.user", irc2.config.nick) -- SASL username
|
||||
setting("string", "username", "Minetest") -- Username/ident
|
||||
setting("string", "realname", "Minetest") -- Real name/GECOS
|
||||
setting("string", "sasl.pass") -- SASL password
|
||||
|
@ -55,5 +64,4 @@ setting("bool", "debug", false) -- Enable debug output
|
|||
setting("bool", "enable_player_part", true) -- Whether to enable players joining and parting the channel
|
||||
setting("bool", "auto_join", true) -- Whether to automatically show players in the channel when they join
|
||||
setting("bool", "auto_connect", true) -- Whether to automatically connect to the server on mod load
|
||||
setting("string", "chat_color", "#339933") -- Color of IRC chat in-game, green by default
|
||||
setting("string", "pm_color", "#8800AA") -- Color of IRC PMs in-game, purple by default
|
||||
|
||||
|
|
152
hooks.lua
152
hooks.lua
|
@ -6,8 +6,8 @@ local ie = ...
|
|||
-- MIME is part of LuaSocket
|
||||
local b64e = ie.require("mime").b64
|
||||
|
||||
irc.hooks = {}
|
||||
irc.registered_hooks = {}
|
||||
irc2.hooks = {}
|
||||
irc2.registered_hooks = {}
|
||||
|
||||
|
||||
local stripped_chars = "[\2\31]"
|
||||
|
@ -20,8 +20,8 @@ local function normalize(text)
|
|||
end
|
||||
|
||||
|
||||
function irc.doHook(conn)
|
||||
for name, hook in pairs(irc.registered_hooks) do
|
||||
function irc2.doHook(conn)
|
||||
for name, hook in pairs(irc2.registered_hooks) do
|
||||
for _, func in pairs(hook) do
|
||||
conn:hook(name, func)
|
||||
end
|
||||
|
@ -29,39 +29,39 @@ function irc.doHook(conn)
|
|||
end
|
||||
|
||||
|
||||
function irc.register_hook(name, func)
|
||||
irc.registered_hooks[name] = irc.registered_hooks[name] or {}
|
||||
table.insert(irc.registered_hooks[name], func)
|
||||
function irc2.register_hook(name, func)
|
||||
irc2.registered_hooks[name] = irc2.registered_hooks[name] or {}
|
||||
table.insert(irc2.registered_hooks[name], func)
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.raw(line)
|
||||
if irc.config.debug then
|
||||
function irc2.hooks.raw(line)
|
||||
if irc2.config.debug then
|
||||
print("RECV: "..line)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.send(line)
|
||||
if irc.config.debug then
|
||||
function irc2.hooks.send(line)
|
||||
if irc2.config.debug then
|
||||
print("SEND: "..line)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.chat(msg)
|
||||
function irc2.hooks.chat(msg)
|
||||
local channel, text = msg.args[1], msg.args[2]
|
||||
if text:sub(1, 1) == string.char(1) then
|
||||
irc.conn:invoke("OnCTCP", msg)
|
||||
irc2.conn:invoke("OnCTCP", msg)
|
||||
return
|
||||
end
|
||||
|
||||
if channel == irc.conn.nick then
|
||||
irc.last_from = msg.user.nick
|
||||
irc.conn:invoke("PrivateMessage", msg)
|
||||
if channel == irc2.conn.nick then
|
||||
irc2.last_from = msg.user.nick
|
||||
irc2.conn:invoke("PrivateMessage", msg)
|
||||
else
|
||||
irc.last_from = channel
|
||||
irc.conn:invoke("OnChannelChat", msg)
|
||||
irc2.last_from = channel
|
||||
irc2.conn:invoke("OnChannelChat", msg)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -74,22 +74,22 @@ local function get_core_version()
|
|||
end
|
||||
|
||||
|
||||
function irc.hooks.ctcp(msg)
|
||||
function irc2.hooks.ctcp(msg)
|
||||
local text = msg.args[2]:sub(2, -2) -- Remove ^C
|
||||
local args = text:split(' ')
|
||||
local command = args[1]:upper()
|
||||
|
||||
local function reply(s)
|
||||
irc.queue(irc.msgs.notice(msg.user.nick,
|
||||
irc2.queue(irc2.msgs.notice(msg.user.nick,
|
||||
("\1%s %s\1"):format(command, s)))
|
||||
end
|
||||
|
||||
if command == "ACTION" and msg.args[1] == irc.config.channel then
|
||||
if command == "ACTION" and msg.args[1] == irc2.config.channel then
|
||||
local action = text:sub(8, -1)
|
||||
irc.sendLocal(("* %s@IRC %s"):format(msg.user.nick, action))
|
||||
irc2.sendLocal(("* %s@Libera %s"):format(msg.user.nick, action))
|
||||
elseif command == "VERSION" then
|
||||
reply(("Minetest version %s, IRC mod version %s.")
|
||||
:format(get_core_version(), irc.version))
|
||||
:format(get_core_version(), irc2.version))
|
||||
elseif command == "PING" then
|
||||
reply(args[2])
|
||||
elseif command == "TIME" then
|
||||
|
@ -98,15 +98,17 @@ function irc.hooks.ctcp(msg)
|
|||
end
|
||||
|
||||
|
||||
function irc.hooks.channelChat(msg)
|
||||
function irc2.hooks.channelChat(msg)
|
||||
local text = normalize(msg.args[2])
|
||||
|
||||
irc.check_botcmd(msg)
|
||||
irc2.check_botcmd(msg)
|
||||
|
||||
-- Don't let a user impersonate someone else by using the nick "IRC"
|
||||
local fake = msg.user.nick:lower():match("^[il|]rc$")
|
||||
if fake then
|
||||
irc.sendLocal("<"..msg.user.nick.."@IRC> "..text)
|
||||
irc2.sendLocal("<"..msg.user.nick.."@Libera> "..text)
|
||||
return
|
||||
elseif msg.user.nick == "BlockyRelay" then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -128,56 +130,56 @@ function irc.hooks.channelChat(msg)
|
|||
if text:sub(1, 5) == "[off]" then
|
||||
return
|
||||
elseif foundchat then
|
||||
irc.sendLocal(("<%s@%s> %s")
|
||||
irc2.sendLocal(("<%s@%s> %s")
|
||||
:format(chatnick, msg.user.nick, chatmessage))
|
||||
elseif foundjoin then
|
||||
irc.sendLocal(("*** %s joined %s")
|
||||
irc2.sendLocal(("*** %s joined %s")
|
||||
:format(joinnick, msg.user.nick))
|
||||
elseif foundleave then
|
||||
irc.sendLocal(("*** %s left %s")
|
||||
irc2.sendLocal(("*** %s left %s")
|
||||
:format(leavenick, msg.user.nick))
|
||||
elseif foundtimedout then
|
||||
irc.sendLocal(("*** %s left %s (Timed out)")
|
||||
irc2.sendLocal(("*** %s left %s (Timed out)")
|
||||
:format(timedoutnick, msg.user.nick))
|
||||
elseif foundaction then
|
||||
irc.sendLocal(("* %s@%s %s")
|
||||
irc2.sendLocal(("* %s@%s %s")
|
||||
:format(actionnick, msg.user.nick, actionmessage))
|
||||
else
|
||||
irc.sendLocal(("<%s@IRC> %s"):format(msg.user.nick, text))
|
||||
irc2.sendLocal(("<%s@Libera> %s"):format(msg.user.nick, text))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.pm(msg)
|
||||
function irc2.hooks.pm(msg)
|
||||
-- Trim prefix if it is found
|
||||
local text = msg.args[2]
|
||||
local prefix = irc.config.command_prefix
|
||||
local prefix = irc2.config.command_prefix
|
||||
if prefix and text:sub(1, #prefix) == prefix then
|
||||
text = text:sub(#prefix + 1)
|
||||
end
|
||||
irc.bot_command(msg, text)
|
||||
irc2.bot_command(msg, text)
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.kick(channel, target, prefix, reason)
|
||||
if target == irc.conn.nick then
|
||||
minetest.chat_send_all("IRC: kicked from "..channel.." by "..prefix.nick..".")
|
||||
irc.disconnect("Kicked")
|
||||
function irc2.hooks.kick(channel, target, prefix, reason)
|
||||
if target == irc2.conn.nick then
|
||||
minetest.chat_send_all("IRC: kicked from "..channel.." (Libera) by "..prefix.nick..".")
|
||||
irc2.disconnect("Kicked")
|
||||
else
|
||||
irc.sendLocal(("-!- %s was kicked from %s by %s [%s]")
|
||||
irc2.sendLocal(("-!- %s was kicked from %s (Libera) by %s [%s]")
|
||||
:format(target, channel, prefix.nick, reason))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.notice(user, target, message)
|
||||
if user.nick and target == irc.config.channel then
|
||||
irc.sendLocal("-"..user.nick.."@IRC- "..message)
|
||||
function irc2.hooks.notice(user, target, message)
|
||||
if user.nick and target == irc2.config.channel then
|
||||
irc2.sendLocal("-"..user.nick.."@Libera- "..message)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.mode(user, target, modes, ...)
|
||||
function irc2.hooks.mode(user, target, modes, ...)
|
||||
local by = ""
|
||||
if user.nick then
|
||||
by = " by "..user.nick
|
||||
|
@ -192,37 +194,37 @@ function irc.hooks.mode(user, target, modes, ...)
|
|||
end
|
||||
|
||||
|
||||
function irc.hooks.nick(user, newNick)
|
||||
irc.sendLocal(("-!- %s is now known as %s")
|
||||
function irc2.hooks.nick(user, newNick)
|
||||
irc2.sendLocal(("-!- %s is now known as %s")
|
||||
:format(user.nick, newNick))
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.join(user, channel)
|
||||
irc.sendLocal(("-!- %s joined %s")
|
||||
function irc2.hooks.join(user, channel)
|
||||
irc2.sendLocal(("-!- %s joined %s (Libera)")
|
||||
:format(user.nick, channel))
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.part(user, channel, reason)
|
||||
function irc2.hooks.part(user, channel, reason)
|
||||
reason = reason or ""
|
||||
irc.sendLocal(("-!- %s has left %s [%s]")
|
||||
irc2.sendLocal(("-!- %s has left %s (Libera) [%s]")
|
||||
:format(user.nick, channel, reason))
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.quit(user, reason)
|
||||
irc.sendLocal(("-!- %s has quit [%s]")
|
||||
function irc2.hooks.quit(user, reason)
|
||||
irc2.sendLocal(("-!- %s has quit Libera [%s]")
|
||||
:format(user.nick, reason))
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.disconnect(_, isError)
|
||||
irc.connected = false
|
||||
function irc2.hooks.disconnect(_, isError)
|
||||
irc2.connected = false
|
||||
if isError then
|
||||
minetest.log("error", "IRC: Error: Disconnected, reconnecting in one minute.")
|
||||
minetest.chat_send_all("IRC: Error: Disconnected, reconnecting in one minute.")
|
||||
minetest.after(60, irc.connect, irc)
|
||||
minetest.after(60, irc2.connect, irc2)
|
||||
else
|
||||
minetest.log("action", "IRC: Disconnected.")
|
||||
minetest.chat_send_all("IRC: Disconnected.")
|
||||
|
@ -230,13 +232,13 @@ function irc.hooks.disconnect(_, isError)
|
|||
end
|
||||
|
||||
|
||||
function irc.hooks.preregister(conn)
|
||||
if not (irc.config["sasl.user"] and irc.config["sasl.pass"]) then return end
|
||||
function irc2.hooks.preregister(conn)
|
||||
if not (irc2.config["sasl.user"] and irc2.config["sasl.pass"]) then return end
|
||||
local authString = b64e(
|
||||
("%s\x00%s\x00%s"):format(
|
||||
irc.config["sasl.user"],
|
||||
irc.config["sasl.user"],
|
||||
irc.config["sasl.pass"])
|
||||
irc2.config["sasl.user"],
|
||||
irc2.config["sasl.user"],
|
||||
irc2.config["sasl.pass"])
|
||||
)
|
||||
conn:send("CAP REQ sasl")
|
||||
conn:send("AUTHENTICATE PLAIN")
|
||||
|
@ -245,19 +247,19 @@ function irc.hooks.preregister(conn)
|
|||
end
|
||||
|
||||
|
||||
irc.register_hook("PreRegister", irc.hooks.preregister)
|
||||
irc.register_hook("OnRaw", irc.hooks.raw)
|
||||
irc.register_hook("OnSend", irc.hooks.send)
|
||||
irc.register_hook("DoPrivmsg", irc.hooks.chat)
|
||||
irc.register_hook("OnPart", irc.hooks.part)
|
||||
irc.register_hook("OnKick", irc.hooks.kick)
|
||||
irc.register_hook("OnJoin", irc.hooks.join)
|
||||
irc.register_hook("OnQuit", irc.hooks.quit)
|
||||
irc.register_hook("NickChange", irc.hooks.nick)
|
||||
irc.register_hook("OnCTCP", irc.hooks.ctcp)
|
||||
irc.register_hook("PrivateMessage", irc.hooks.pm)
|
||||
irc.register_hook("OnNotice", irc.hooks.notice)
|
||||
irc.register_hook("OnChannelChat", irc.hooks.channelChat)
|
||||
irc.register_hook("OnModeChange", irc.hooks.mode)
|
||||
irc.register_hook("OnDisconnect", irc.hooks.disconnect)
|
||||
irc2.register_hook("PreRegister", irc2.hooks.preregister)
|
||||
irc2.register_hook("OnRaw", irc2.hooks.raw)
|
||||
irc2.register_hook("OnSend", irc2.hooks.send)
|
||||
irc2.register_hook("DoPrivmsg", irc2.hooks.chat)
|
||||
irc2.register_hook("OnPart", irc2.hooks.part)
|
||||
irc2.register_hook("OnKick", irc2.hooks.kick)
|
||||
irc2.register_hook("OnJoin", irc2.hooks.join)
|
||||
irc2.register_hook("OnQuit", irc2.hooks.quit)
|
||||
irc2.register_hook("NickChange", irc2.hooks.nick)
|
||||
irc2.register_hook("OnCTCP", irc2.hooks.ctcp)
|
||||
irc2.register_hook("PrivateMessage", irc2.hooks.pm)
|
||||
irc2.register_hook("OnNotice", irc2.hooks.notice)
|
||||
irc2.register_hook("OnChannelChat", irc2.hooks.channelChat)
|
||||
irc2.register_hook("OnModeChange", irc2.hooks.mode)
|
||||
irc2.register_hook("OnDisconnect", irc2.hooks.disconnect)
|
||||
|
||||
|
|
115
init.lua
115
init.lua
|
@ -23,18 +23,14 @@ ie.package.path =
|
|||
-- /usr/local/share and /usr/local/lib but LuaSocket is often installed under
|
||||
-- /usr/share and /usr/lib.
|
||||
if not rawget(_G, "jit") and package.config:sub(1, 1) == "/" then
|
||||
|
||||
ie.package.path = ie.package.path..
|
||||
";/usr/share/lua/5.1/?.lua"..
|
||||
";/usr/share/lua/5.1/?/init.lua"
|
||||
|
||||
ie.package.cpath = ie.package.cpath..
|
||||
";/usr/lib/lua/5.1/?.so"..
|
||||
";/usr/lib64/lua/5.1/?.so"
|
||||
|
||||
ie.package.cpath = "/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;"..ie.package.cpath
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- Temporarily set require so that LuaIRC can access it
|
||||
|
@ -47,7 +43,7 @@ rawset(_G, "module", ie.module)
|
|||
|
||||
local lib = ie.require("irc")
|
||||
|
||||
irc = {
|
||||
irc2 = {
|
||||
version = "0.2.0",
|
||||
connected = false,
|
||||
cur_time = 0,
|
||||
|
@ -59,7 +55,7 @@ irc = {
|
|||
}
|
||||
|
||||
-- Compatibility
|
||||
rawset(_G, "mt_irc", irc)
|
||||
rawset(_G, "mt_irc2", irc2)
|
||||
|
||||
local getinfo = debug.getinfo
|
||||
local warned = { }
|
||||
|
@ -75,7 +71,7 @@ local function warn_deprecated(k)
|
|||
end
|
||||
|
||||
-- This is a hack.
|
||||
setmetatable(irc, {
|
||||
setmetatable(irc2, {
|
||||
__newindex = function(t, k, v)
|
||||
if type(v) == "function" then
|
||||
local f = v
|
||||
|
@ -103,34 +99,28 @@ dofile(modpath.."/botcmds.lua")
|
|||
require = old_require
|
||||
rawset(_G, "module", old_module)
|
||||
|
||||
if irc.config.enable_player_part then
|
||||
if irc2.config.enable_player_part then
|
||||
dofile(modpath.."/player_part.lua")
|
||||
else
|
||||
setmetatable(irc.joined_players, {__index = function() return true end})
|
||||
setmetatable(irc2.joined_players, {__index = function() return true end})
|
||||
end
|
||||
|
||||
minetest.register_privilege("irc_admin", {
|
||||
description = "Allow IRC administrative tasks to be performed.",
|
||||
give_to_singleplayer = true,
|
||||
give_to_admin = true,
|
||||
})
|
||||
|
||||
local stepnum = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime) return irc.step(dtime) end)
|
||||
minetest.register_globalstep(function(dtime) return irc2.step(dtime) end)
|
||||
|
||||
function irc.step()
|
||||
function irc2.step()
|
||||
if stepnum == 3 then
|
||||
if irc.config.auto_connect then
|
||||
irc.connect()
|
||||
if irc2.config.auto_connect then
|
||||
irc2.connect()
|
||||
end
|
||||
end
|
||||
stepnum = stepnum + 1
|
||||
|
||||
if not irc.connected then return end
|
||||
if not irc2.connected then return end
|
||||
|
||||
-- Hooks will manage incoming messages and errors
|
||||
local good, err = xpcall(function() irc.conn:think() end, debug.traceback)
|
||||
local good, err = xpcall(function() irc2.conn:think() end, debug.traceback)
|
||||
if not good then
|
||||
print(err)
|
||||
return
|
||||
|
@ -138,17 +128,17 @@ function irc.step()
|
|||
end
|
||||
|
||||
|
||||
function irc.connect()
|
||||
if irc.connected then
|
||||
function irc2.connect()
|
||||
if irc2.connected then
|
||||
minetest.log("error", "IRC: Ignoring attempt to connect when already connected.")
|
||||
return
|
||||
end
|
||||
irc.conn = irc.lib.new({
|
||||
nick = irc.config.nick,
|
||||
username = irc.config.username,
|
||||
realname = irc.config.realname,
|
||||
irc2.conn = irc2.lib.new({
|
||||
nick = irc2.config.nick,
|
||||
username = irc2.config.username,
|
||||
realname = irc2.config.realname,
|
||||
})
|
||||
irc.doHook(irc.conn)
|
||||
irc2.doHook(irc2.conn)
|
||||
|
||||
-- We need to swap the `require` function again since
|
||||
-- LuaIRC `require`s `ssl` if `irc.secure` is true.
|
||||
|
@ -156,13 +146,13 @@ function irc.connect()
|
|||
require = ie.require
|
||||
|
||||
local good, message = pcall(function()
|
||||
irc.conn:connect({
|
||||
host = irc.config.server,
|
||||
port = irc.config.port,
|
||||
password = irc.config.password,
|
||||
timeout = irc.config.timeout,
|
||||
reconnect = irc.config.reconnect,
|
||||
secure = irc.config.secure
|
||||
irc2.conn:connect({
|
||||
host = irc2.config.server,
|
||||
port = irc2.config.port,
|
||||
password = irc2.config.password,
|
||||
timeout = irc2.config.timeout,
|
||||
reconnect = irc2.config.reconnect,
|
||||
secure = irc2.config.secure
|
||||
})
|
||||
end)
|
||||
|
||||
|
@ -170,57 +160,66 @@ function irc.connect()
|
|||
|
||||
if not good then
|
||||
minetest.log("error", ("IRC: Connection error: %s: %s -- Reconnecting in %d seconds...")
|
||||
:format(irc.config.server, message, irc.config.reconnect))
|
||||
minetest.after(irc.config.reconnect, function() irc.connect() end)
|
||||
:format(irc2.config.server, message, irc2.config.reconnect))
|
||||
minetest.after(irc2.config.reconnect, function() irc2.connect() end)
|
||||
return
|
||||
end
|
||||
|
||||
if irc.config.NSPass then
|
||||
irc.conn:queue(irc.msgs.privmsg(
|
||||
"NickServ", "IDENTIFY "..irc.config.NSPass))
|
||||
if irc2.config.NSPass then
|
||||
irc2.conn:queue(irc2.msgs.privmsg(
|
||||
"NickServ", "IDENTIFY "..irc2.config.NSPass))
|
||||
end
|
||||
|
||||
irc.conn:join(irc.config.channel, irc.config.key)
|
||||
irc.connected = true
|
||||
irc2.conn:join(irc2.config.channel, irc2.config.key)
|
||||
irc2.connected = true
|
||||
minetest.log("action", "IRC: Connected!")
|
||||
minetest.chat_send_all("IRC: Connected!")
|
||||
end
|
||||
|
||||
|
||||
function irc.disconnect(message)
|
||||
if irc.connected then
|
||||
function irc2.disconnect(message)
|
||||
if irc2.connected then
|
||||
--The OnDisconnect hook will clear irc.connected and print a disconnect message
|
||||
irc.conn:disconnect(message)
|
||||
irc2.conn:disconnect(message)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function irc.say(to, message)
|
||||
function irc2.say(to, message)
|
||||
if not message then
|
||||
message = to
|
||||
to = irc.config.channel
|
||||
to = irc2.config.channel
|
||||
end
|
||||
to = to or irc.config.channel
|
||||
to = to or irc2.config.channel
|
||||
|
||||
irc.queue(irc.msgs.privmsg(to, message))
|
||||
irc2.queue(irc2.msgs.privmsg(to, message))
|
||||
end
|
||||
|
||||
|
||||
function irc.reply(message)
|
||||
if not irc.last_from then
|
||||
function irc2.reply(message)
|
||||
if not irc2.last_from then
|
||||
return
|
||||
end
|
||||
message = message:gsub("[\r\n%z]", " \\n ")
|
||||
irc.say(irc.last_from, message)
|
||||
irc2.say(irc2.last_from, message)
|
||||
end
|
||||
|
||||
function irc.send(msg)
|
||||
if not irc.connected then return end
|
||||
irc.conn:send(msg)
|
||||
function irc2.send(msg)
|
||||
if not irc2.connected then return end
|
||||
irc2.conn:send(msg)
|
||||
end
|
||||
|
||||
function irc.queue(msg)
|
||||
if not irc.connected then return end
|
||||
irc.conn:queue(msg)
|
||||
function irc2.queue(msg)
|
||||
if not irc2.connected then return end
|
||||
irc2.conn:queue(msg)
|
||||
end
|
||||
|
||||
-- Cloaking fix
|
||||
local irc_sendLocal = irc2.sendLocal
|
||||
|
||||
function irc2.sendLocal(msg)
|
||||
for _, player in ipairs(cloaking.get_cloaked_players()) do
|
||||
minetest.chat_send_player(player, msg)
|
||||
end
|
||||
return irc_sendLocal(msg)
|
||||
end
|
||||
|
|
2
irc
2
irc
|
@ -1 +1 @@
|
|||
Subproject commit e49a52ede1a58ddd94854657bc5098b0ac5d0677
|
||||
Subproject commit 3baffb6bd3821b3e45b74a78e3564a9e7063b931
|
12
messages.lua
12
messages.lua
|
@ -1,17 +1,17 @@
|
|||
-- This file is licensed under the terms of the BSD 2-clause license.
|
||||
-- See LICENSE.txt for details.
|
||||
|
||||
irc.msgs = irc.lib.msgs
|
||||
irc2.msgs = irc2.lib.msgs
|
||||
|
||||
function irc.logChat(message)
|
||||
function irc2.logChat(message)
|
||||
minetest.log("action", "IRC CHAT: "..message)
|
||||
end
|
||||
|
||||
function irc.sendLocal(message)
|
||||
minetest.chat_send_all(minetest.colorize(irc.config.chat_color, message))
|
||||
irc.logChat(message)
|
||||
function irc2.sendLocal(message)
|
||||
minetest.chat_send_all(message)
|
||||
irc2.logChat(message)
|
||||
end
|
||||
|
||||
function irc.playerMessage(name, message)
|
||||
function irc2.playerMessage(name, message)
|
||||
return ("<%s> %s"):format(name, message)
|
||||
end
|
||||
|
|
2
mod.conf
2
mod.conf
|
@ -1,4 +1,4 @@
|
|||
name = irc
|
||||
name = irc2
|
||||
description = """
|
||||
This mod is just a glue between IRC and Minetest.
|
||||
It provides two-way communication between the in-game chat, and an arbitrary IRC channel.
|
||||
|
|
|
@ -2,21 +2,19 @@
|
|||
-- See LICENSE.txt for details.
|
||||
|
||||
|
||||
function irc.player_part(name)
|
||||
if not irc.joined_players[name] then
|
||||
function irc2.player_part(name)
|
||||
if not irc2.joined_players[name] then
|
||||
return false, "You are not in the channel"
|
||||
end
|
||||
irc.joined_players[name] = nil
|
||||
irc2.joined_players[name] = nil
|
||||
return true, "You left the channel"
|
||||
end
|
||||
|
||||
function irc.player_join(name)
|
||||
if irc.joined_players[name] then
|
||||
function irc2.player_join(name)
|
||||
if irc2.joined_players[name] then
|
||||
return false, "You are already in the channel"
|
||||
elseif not minetest.get_player_by_name(name) then
|
||||
return false, "You need to be in-game to join the channel"
|
||||
end
|
||||
irc.joined_players[name] = true
|
||||
irc2.joined_players[name] = true
|
||||
return true, "You joined the channel"
|
||||
end
|
||||
|
||||
|
@ -25,7 +23,7 @@ minetest.register_chatcommand("join", {
|
|||
description = "Join the IRC channel",
|
||||
privs = {shout=true},
|
||||
func = function(name)
|
||||
return irc.player_join(name)
|
||||
return irc2.player_join(name)
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -33,7 +31,7 @@ minetest.register_chatcommand("part", {
|
|||
description = "Part the IRC channel",
|
||||
privs = {shout=true},
|
||||
func = function(name)
|
||||
return irc.player_part(name)
|
||||
return irc2.player_part(name)
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -42,31 +40,30 @@ minetest.register_chatcommand("who", {
|
|||
privs = {},
|
||||
func = function()
|
||||
local out, n = { }, 0
|
||||
for plname in pairs(irc.joined_players) do
|
||||
for plname in pairs(irc2.joined_players) do
|
||||
n = n + 1
|
||||
out[n] = plname
|
||||
end
|
||||
table.sort(out)
|
||||
return true, "Players in channel: "..table.concat(out, ", ")
|
||||
return true, n.." player(s) in channel: "..table.concat(out, ", ")
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
irc.joined_players[name] = irc.config.auto_join
|
||||
irc2.joined_players[name] = irc2.config.auto_join
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
irc.joined_players[name] = nil
|
||||
irc2.joined_players[name] = nil
|
||||
end)
|
||||
|
||||
function irc.sendLocal(message)
|
||||
for name, _ in pairs(irc.joined_players) do
|
||||
minetest.chat_send_player(name,
|
||||
minetest.colorize(irc.config.chat_color, message))
|
||||
function irc2.sendLocal(message)
|
||||
for name, _ in pairs(irc2.joined_players) do
|
||||
minetest.chat_send_player(name, message)
|
||||
end
|
||||
irc.logChat(message)
|
||||
irc2.logChat(message)
|
||||
end
|
||||
|
|
|
@ -3,73 +3,73 @@
|
|||
|
||||
# Whether to automatically connect to the server on mod load.
|
||||
# If false, you must use /irc_connect to connect.
|
||||
irc.auto_connect (Auto-connect on load) bool true
|
||||
irc2.auto_connect (Auto-connect on load) bool true
|
||||
|
||||
# Nickname for the bot. May only contain characters A-Z, 0-9
|
||||
# '{', '}', '[', ']', '|', '^', '-', or '_'.
|
||||
irc.nick (Bot nickname) string Minetest
|
||||
irc2.nick (Bot nickname) string Minetest
|
||||
|
||||
# Server to connect to.
|
||||
irc.server (IRC server) string irc.freenode.net
|
||||
irc2.server (IRC server) string irc.libera.chat
|
||||
|
||||
# Server port.
|
||||
# The standard IRC protocol port is 6667 for regular servers,
|
||||
# or 6697 for SSL-enabled servers.
|
||||
# If unsure, leave at 6667.
|
||||
irc.port (IRC server port) int 6667 1 65535
|
||||
irc2.port (IRC server port) int 6667 1 65535
|
||||
|
||||
# Channel the bot joins after connecting.
|
||||
irc.channel (Channel to join) string ##mt-irc-mod
|
||||
irc2.channel (Channel to join) string ##mt-irc-mod
|
||||
|
||||
[Authentication]
|
||||
|
||||
# Password for authenticating to NickServ.
|
||||
# Leave empty to not authenticate with NickServ.
|
||||
irc.NSPass (NickServ password) string
|
||||
irc2.NSPass (NickServ password) string
|
||||
|
||||
# IRC server password.
|
||||
# Leave empty for no password.
|
||||
irc.password (Server password) string
|
||||
irc2.password (Server password) string
|
||||
|
||||
# Password for joining the channel.
|
||||
# Leave empty if your channel is not protected.
|
||||
irc.key (Channel key) string
|
||||
irc2.key (Channel key) string
|
||||
|
||||
# Enable TLS connection.
|
||||
# Requires LuaSEC <https://github.com/brunoos/luasec>.
|
||||
irc.secure (Use TLS) bool false
|
||||
irc2.secure (Use TLS) bool false
|
||||
|
||||
# Username for SASL authentication.
|
||||
# Leave empty to use the nickname.
|
||||
irc.sasl.user (SASL username) string
|
||||
irc2.sasl.user (SASL username) string
|
||||
|
||||
# Password for SASL authentication.
|
||||
# Leave empty to not authenticate via SASL.
|
||||
irc.sasl.pass (SASL password) string
|
||||
irc2.sasl.pass (SASL password) string
|
||||
|
||||
[Advanced]
|
||||
|
||||
# Enable this to make the bot send messages when players join
|
||||
# or leave the game server.
|
||||
irc.send_join_part (Send join and part messages) bool true
|
||||
irc2.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
|
||||
irc2.send_kicks (Send kick messages) bool false
|
||||
|
||||
# Underlying socket timeout in seconds.
|
||||
irc.timeout (Timeout) int 60 1
|
||||
irc2.timeout (Timeout) int 60 1
|
||||
|
||||
# Time between reconnection attempts, in seconds.
|
||||
irc.reconnect (Reconnect delay) int 600 1
|
||||
irc2.reconnect (Reconnect delay) int 600 1
|
||||
|
||||
# Prefix to use for bot commands.
|
||||
irc.command_prefix (Command prefix) string
|
||||
irc2.command_prefix (Command prefix) string
|
||||
|
||||
# Enable debug output.
|
||||
irc.debug (Debug mode) bool false
|
||||
irc2.debug (Debug mode) bool false
|
||||
|
||||
# Whether to enable players joining and parting the channel.
|
||||
irc.enable_player_part (Allow player join/part) bool true
|
||||
irc2.enable_player_part (Allow player join/part) bool true
|
||||
|
||||
# Whether to automatically show players in the channel when they join.
|
||||
irc.auto_join (Auto join players) bool true
|
||||
irc2.auto_join (Auto join players) bool true
|
||||
|
|
Loading…
Reference in New Issue