This commit is contained in:
AliasAlreadyTaken 2022-02-25 04:33:55 +01:00
parent 62b3444c10
commit e384d8b09d
2 changed files with 0 additions and 39 deletions

View File

@ -21,8 +21,6 @@ yl_matterbridge.information.name = "yl_matterbridge"
yl_matterbridge.information.additional = "Additional information"
dofile(yl_matterbridge.modpath .. "config.lua")
--dofile(yl_matterbridge.modpath .. "internal.lua")
--dofile(yl_matterbridge.modpath .. "globalsteps.lua")
local http = minetest.request_http_api()

View File

@ -1,37 +0,0 @@
local http = minetest.request_http_api()
function yl_matterbridge.send(user_name, message_text)
local url = "http://" .. yl_matterbridge.address .. ":" .. yl_matterbridge.port .. "/api/message"
local post_headers = {"Content-Type: application/json"}
local timeout = 10
local data = {
text = message_text,
username = user_name,
gateway = yl_matterbridge.gateway
}
http.fetch(
{
url = url,
extra_headers = post_headers,
timeout = timeout,
post_data = minetest.write_json(data)
},
function(result)
if result.succeeded then
local data = minetest.parse_json(result.data)
core.log("action", "[MOD] yl_matterbridge : Posted " .. dump(data))
else
minetest.log("error", "[yl_matterbridge] " .. dump(result))
minetest.chat_send_player(user_name, "We were not able to send your text.")
return false
end
end
)
return true
end
minetest.register_on_chat_message(function(name, message)
yl_matterbridge.send(user_name, message_text)
end
)