Discovery
Developing myself
Hello dears,
Im working in a webhook in LUA script, but I have two things on my mind because I dont finded anything related by that issue in Otland posts
- Have native socket in LUA? If yes, exist example/sample about it?
- I remember existing something in a older TFS version checking a external link (blacklist.xml) with a C++.h lib.
Somebody tried something like that?
Because I dont know if I need install a new lib in my source, or have a optional lib installed about it.
*I searched in the "OTHire" sources, and I dont know if exist this possibility and lib.lua dependencies.
Regards,
Discovery.
Post-topic:
miss ~~ like metatable:responder in TFS 1.3 #sad
Im working in a webhook in LUA script, but I have two things on my mind because I dont finded anything related by that issue in Otland posts
- Have native socket in LUA? If yes, exist example/sample about it?
- I remember existing something in a older TFS version checking a external link (blacklist.xml) with a C++.h lib.
Lua:
function onSay(cid, words, param)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to type the parameter.")
return false
end
local http=require("socket.http");
local request_body = [[content=test&username=BOT&avatar_url]]
local response_body = {}
local res, code, response_headers = http.request{
url = "https://discordapp.com/api/webhooks/455742330390183957/AmDojr51rtpi6F8hMfxBe5LJWcvzk4A0982c0EzlZuYIWXfZKbDvHN6Sc1vDsMoQ367M",
method = "POST",
headers =
{
["Content-Type"] = "application/x-www-form-urlencoded";
["Content-Length"] = #request_body;
},
source = ltn12.source.string(request_body),
sink = ltn12.sink.table(response_body),
}
print(res)
print(code)
if type(response_headers) == "table" then
for k, v in pairs(response_headers) do
print(k, v)
end
end
print("Response body:")
if type(response_body) == "table" then
print(table.concat(response_body))
else
print("Not a table:", type(response_body))
end
return false
end
Somebody tried something like that?
Because I dont know if I need install a new lib in my source, or have a optional lib installed about it.
*I searched in the "OTHire" sources, and I dont know if exist this possibility and lib.lua dependencies.
Regards,
Discovery.
Post-topic:
miss ~~ like metatable:responder in TFS 1.3 #sad
Last edited: