arciCZ Posted November 13, 2019 Share Posted November 13, 2019 Hello, i need help i now trying to make Discord Webhook Embeds, but when i do it i only get response code 400 and Response data: " {"embeds": ["0"]} " sendOptions={ formFields = { embeds = { title = "Hi", description = " S6066 authored & committed", fields={ {name="1",value="2"}, {name="3",value="4"} }, footer = { text = "Woah! So cool! :smirk:", icon_url = "https://i.imgur.com/fKL31aD.jpg" } } } } fetchRemote(Webhook1URL, sendOptions,callback) And Response with Iprint is --Response Data: {"embeds": ["0"]} --Errno { headers = { ["Alt-Svc"] = "clear", ["CF-Cache-Status"] = "DYNAMIC", ["CF-RAY"] = "53535a16ba733e0c-PRG", Connection = "keep-alive", ["Content-Length"] = "17", ["Content-Type"] = "application/json", Date = "Wed, 13 Nov 2019 20:03:56 GMT", ["Expect-CT"] = 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', Server = "cloudflare", ["Set-Cookie"] = "__cfduid=da477b12fac9e577fb9c4965f1d100e001573675436; expires=Thu, 12-Nov-20 20:03:56 GMT; path=/; domain=.discordapp.com; HttpOnly", ["Strict-Transport-Security"] = "max-age=31536000; includeSubDomains", Via = "1.1 google", ["X-RateLimit-Bucket"] = "3cd1f278bd0ecaf11e0d2391374c011d", ["X-RateLimit-Limit"] = "5", ["X-RateLimit-Remaining"] = "4", ["X-RateLimit-Reset"] = "1573675439", ["X-RateLimit-Reset-After"] = "2" }, statusCode = 400, success = false } Link to comment
MIKI785 Posted November 14, 2019 Share Posted November 14, 2019 400 is a Bad Request. So maybe the webhook expects JSON? Most APIs do. But even if form data is accepted, you're passing a table as the form data, but it's supposed to be a string. See fetchRemote. Link to comment
savour Posted November 16, 2019 Share Posted November 16, 2019 Well, in "embeds" you can embed more than one embed, so you have to put it on another table (table per embed) embeds = { { -- This is embed number 1 title = "Hi", description = " S6066 authored & committed", fields={ {name="1",value="2"}, {name="3",value="4"} }, footer = { text = "Woah! So cool! :smirk:", icon_url = "https://i.imgur.com/fKL31aD.jpg" } } } Link to comment
arciCZ Posted November 17, 2019 Author Share Posted November 17, 2019 (edited) @savour Still same response data. @MIKI785 can you send me please some example because when i try: embeds = toJSON(...) then it have same response data. Edited November 17, 2019 by arciCZ Link to comment
savour Posted November 18, 2019 Share Posted November 18, 2019 @arciCZ In that case remove the formFields and replace it with postData (convert the table to json) Link to comment
FernandoMTA Posted February 14, 2023 Share Posted February 14, 2023 Example on how to achieve this: https://github.com/Fernando-A-Rocha/mta-discord-webhooks/blob/e279b2cc221cac378b68c455714b68ed21776b35/discord_webhooks/system.lua#L84 1 Link to comment
FLUSHBICEPS Posted February 15, 2023 Share Posted February 15, 2023 3 hours ago, FernandoMTA said: Example on how to achieve this: https://github.com/Fernando-A-Rocha/mta-discord-webhooks/blob/e279b2cc221cac378b68c455714b68ed21776b35/discord_webhooks/system.lua#L84 Lmao that’s a thread from 2019 1 Link to comment
FernandoMTA Posted February 15, 2023 Share Posted February 15, 2023 6 hours ago, FLUSHBICEPS said: Lmao that’s a thread from 2019 never too late mta forum threads show up on Google all the time whether they're old or not Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now