irc2/config.lua

68 lines
2.7 KiB
Lua
Raw Normal View History

2013-04-29 15:07:44 -07:00
-- This file is licensed under the terms of the BSD 2-clause license.
-- See LICENSE.txt for details.
2019-07-24 18:53:22 -07:00
irc2.config = {}
2014-02-01 14:03:44 -08:00
local function setting(stype, name, default, required)
2014-02-01 14:03:44 -08:00
local value
2019-07-24 19:04:45 -07:00
if minetest.settings and minetest.settings.get and minetest.settings.get_bool then
if stype == "bool" then
value = minetest.settings:get_bool("irc2."..name)
elseif stype == "string" then
value = minetest.settings:get("irc2."..name)
elseif stype == "number" then
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
2014-02-01 14:03:44 -08:00
end
if value == nil then
if required then
2019-07-24 18:53:22 -07:00
error("Required configuration option irc2."..
name.." missing.")
end
2014-02-01 14:03:44 -08:00
value = default
end
2019-07-24 18:53:22 -07:00
irc2.config[name] = value
2014-02-01 14:03:44 -08:00
end
2013-04-29 15:07:44 -07:00
-------------------------
-- BASIC USER SETTINGS --
-------------------------
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
2014-02-01 14:03:44 -08:00
setting("string", "NSPass") -- NickServ password
2019-07-24 18:53:22 -07:00
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
setting("string", "channel", nil, true) -- Channel to join
2014-02-01 14:03:44 -08:00
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
2012-12-14 14:33:44 -08:00
2013-04-29 15:07:44 -07:00
-----------------------
-- ADVANCED SETTINGS --
-----------------------
2012-12-14 14:33:44 -08:00
2014-02-01 14:03:44 -08:00
setting("string", "password") -- Server password
setting("bool", "secure", false) -- Enable a TLS connection, requires LuaSEC
setting("number", "timeout", 60) -- Underlying socket timeout in seconds.
setting("number", "reconnect", 600) -- Time between reconnection attempts, in seconds.
2014-02-01 14:03:44 -08:00
setting("string", "command_prefix") -- Prefix to use for bot commands
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
2019-07-24 18:42:23 -07:00