Localize settings
This commit is contained in:
parent
e384d8b09d
commit
9c26bb8670
11
config.lua
11
config.lua
@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
-- Setting a configuration, switch the order in which the settings shall take precedence. First valid one taken.
|
|
||||||
|
|
||||||
yl_matterbridge.address = minetest.settings:get("yl_matterbridge.address") or "error"
|
|
||||||
yl_matterbridge.port = minetest.settings:get("yl_matterbridge.port") or "error"
|
|
||||||
yl_matterbridge.gateway = minetest.settings:get("yl_matterbridge.gateway") or "error"
|
|
||||||
yl_matterbridge.token = minetest.settings:get("yl_matterbridge.token") or "error"
|
|
||||||
|
|
||||||
--yl_matterbridge.save_path = "yl_matterbridge" or minetest.settings:get("yl_matterbridge.save_path") or "default"
|
|
||||||
|
|
||||||
--yl_matterbridge.admin_priv = "admin_priv" or minetest.settings:get("yl_matterbridge.admin_priv") or "server"
|
|
11
init.lua
11
init.lua
@ -20,18 +20,21 @@ yl_matterbridge.information.license = "MIT"
|
|||||||
yl_matterbridge.information.name = "yl_matterbridge"
|
yl_matterbridge.information.name = "yl_matterbridge"
|
||||||
yl_matterbridge.information.additional = "Additional information"
|
yl_matterbridge.information.additional = "Additional information"
|
||||||
|
|
||||||
dofile(yl_matterbridge.modpath .. "config.lua")
|
local address = minetest.settings:get("yl_matterbridge.address") or false
|
||||||
|
local port = minetest.settings:get("yl_matterbridge.port") or false
|
||||||
|
local gateway = minetest.settings:get("yl_matterbridge.gateway") or false
|
||||||
|
local token = minetest.settings:get("yl_matterbridge.token") or ""
|
||||||
|
|
||||||
local http = minetest.request_http_api()
|
local http = minetest.request_http_api()
|
||||||
|
|
||||||
function send(user_name, message_text)
|
function send(user_name, message_text)
|
||||||
local url = "http://" .. yl_matterbridge.address .. ":" .. yl_matterbridge.port .. "/api/message"
|
local url = "http://" .. address .. ":" .. port .. "/api/message"
|
||||||
local post_headers = {"Content-Type: application/json"}
|
local post_headers = {"Content-Type: application/json"}
|
||||||
local timeout = 10
|
local timeout = 10
|
||||||
local data = {
|
local data = {
|
||||||
text = message_text,
|
text = message_text,
|
||||||
username = user_name,
|
username = user_name,
|
||||||
gateway = yl_matterbridge.gateway
|
gateway = gateway
|
||||||
}
|
}
|
||||||
|
|
||||||
http.fetch(
|
http.fetch(
|
||||||
@ -61,7 +64,7 @@ minetest.register_on_chat_message(
|
|||||||
)
|
)
|
||||||
|
|
||||||
local gs = function(dtime)
|
local gs = function(dtime)
|
||||||
local url = "http://" .. yl_matterbridge.address .. ":" .. yl_matterbridge.port .. "/api/messages"
|
local url = "http://" .. address .. ":" .. port .. "/api/messages"
|
||||||
local timeout = 0
|
local timeout = 0
|
||||||
|
|
||||||
http.fetch(
|
http.fetch(
|
||||||
|
Loading…
Reference in New Issue
Block a user