Raptor6872 Posted May 31, 2020 Posted May 31, 2020 Greetings All, I've been working to try and create a LUA script that I can run in order to send data from the game to a Discord "webhook". I do not have a lot of knowledge on the topic but have been trying to learn more. It seems that LUASocket and JSON are all integrated in DCS thankfully, but I am not sure how to exactly make this work. So far I've come up with the following, but it does not work, any ideas? Just a post to provoke thought and ideas since I've not found any decent resources. (e.g. Have a trigger cause a msg. to send to Discord WebHook) ------------------------------------------------------- -- Discord Bot (Hook) Test ------------------------- ------------------------------------------------------- package.path = package.path..";.\\LuaSocket\\?.lua;" package.cpath = package.cpath..";.\\LuaSocket\\?.dll;" local JSON = loadfile("Scripts\\JSON.lua")() local http = require("http") local siteurl = "YourWebHookURL" local payload = "Test" local respback = { } local res, code, response_headers, status = http.request { url = siteurl, method = "POST", headers = { ["Content-Type"] = "application/json", ["Content-Length"] = payload:len() }, source = ltn12.source.string(payload), sink = ltn12.sink.table(respback) } ------------------------------------------------------- DRAGON 1-3 | Raptor [i7-7700K OC 5 GHz CPU | 32 GB DDR4 RAM | RTX 2070S GPU w/ 4GB]
Pikey Posted May 31, 2020 Posted May 31, 2020 THere's a working example here you can check out and learn from. https://aggressors.ca/hypemanii/ ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
davidp57 Posted June 2, 2020 Posted June 2, 2020 Thanks Pikey, interesting. Gives me ideas ^^ Zip - VEAF :pilotfly: If you want to learn, talk and fly with french-speaking friends, the Virtual European Air Force is here for you ! Meet us on our Discord and our forum If you're a mission creator, you may want to check the VEAF Mission Creation Tools (and its GitHub repository) a set of open-source scripts and tools that make creating a dynamic mission a breeze !
Raptor6872 Posted June 13, 2020 Author Posted June 13, 2020 Thanks a ton! I appreciate the info and for saving me the development time! DRAGON 1-3 | Raptor [i7-7700K OC 5 GHz CPU | 32 GB DDR4 RAM | RTX 2070S GPU w/ 4GB]
Recommended Posts