Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Specific functions documentation
- syn.request:
- (very epic function btw)
- Standard example:
- local Response = syn.request(
- {
- Url = "ExampleURL";
- Method = "POST";
- Headers = {
- ["Content-Type"] = "application/json"; -- When sending JSON, add this!
- };
- Body = game:GetService("HttpService"):JSONEncode({hello = "world"});
- )
- for i, v in pairs(Response) do
- print(i, v)
- if type(v) == "table" then
- for i2, v2 in pairs(v) do
- warn(i2, v2)
- end
- end
- end
- Discord Webhook example:
- local Data = {
- ["username"] = "Cool Webhook";
- ["content"] = "This is a super cool webhook!";
- }
- Data = game:GetService("HttpService"):JSONEncode(Data)
- local Response = nil
- Response = syn.request(
- {
- Url = "WebhookURLhere";
- Method = "POST";
- Headers = {
- ["Content-Type"] = "application/json";
- };
- Body = Data;
- }
- )
- repeat wait() until Response ~= nil
- if Response.Success then
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = "Epic!";
- Text = "Sent the webhook shit!";
- })
- elseif not Response.Success then
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = "Oof!";
- Text = "Failed to send the webhook shit!";
- })
- end
Add Comment
Please, Sign In to add comment