Created
May 4, 2024 02:51
-
-
Save aimbot6120/32176148ec6f966aeb84e6545ebb9931 to your computer and use it in GitHub Desktop.
Lua Quest Generate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function callQuestGeneratorAPI() | |
local url = "https://authdev.xgaming.club/xquest/generate" | |
local data = | |
{ | |
goal = "The player just crash landed on the plant near a cave. He needs to survive", | |
key = "abcd1234", | |
fields = { | |
"verb", | |
"noun" | |
}, | |
n = 1, | |
story = "The player crash landed on Zeloria, a mining plant abandoned long ago due to uncontrolled mutations of its flora and fauna. He finds you, a hunter named Thalion Whisperwind and asks for help. Thalion was a miner who was abandoned and is now a fierce hunter" | |
} | |
local jsonData = HttpService:JSONEncode(data) | |
print("Loaidng Quest") | |
local headers = { | |
["Content-Type"] = "application/json" | |
} | |
local response = HttpService:RequestAsync({ | |
Url = url, | |
Method = "POST", | |
Headers = headers, | |
Body = jsonData | |
}) | |
if response.Success then | |
local responseBody = HttpService:JSONDecode(response.Body) | |
print(responseBody) | |
return responseBody | |
else | |
warn("Failed to call API: " .. response.StatusCode .. " - " .. response.StatusMessage) | |
return nil | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment