From e384d8b09dc61ece94a853b71b592fdc1a8faf50 Mon Sep 17 00:00:00 2001 From: AliasAlreadyTaken Date: Fri, 25 Feb 2022 04:33:55 +0100 Subject: [PATCH] Finale --- init.lua | 2 -- internal.lua | 37 ------------------------------------- 2 files changed, 39 deletions(-) delete mode 100644 internal.lua diff --git a/init.lua b/init.lua index dea0f1e..4e24517 100644 --- a/init.lua +++ b/init.lua @@ -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() diff --git a/internal.lua b/internal.lua deleted file mode 100644 index 81e3cc3..0000000 --- a/internal.lua +++ /dev/null @@ -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 -) \ No newline at end of file