ZeusXBr Posted June 11, 2021 Share Posted June 11, 2021 function webhookEmbed(url, content, author, icon_url, description) local webhook_url = url sendOptions = { formFields = { content="```"..content.."```" }, author = { "name": author, "icon_url": icon_url, "description": description, }, } fetchRemote(webhook_url, sendOptions) end addEventHandler("onResourceStart", resourceRoot, function(res) resourceName = getResourdiscordName(resourceRoot) url = "WebhookLink" webhookEmbed(url, "Test", "Test", "https://link.jpg", "Test") outputDebugString("["..resourceName.."]: Resource started.", 3, 97, 235, 52) end) addEventHandler("onResourceStop", resourceRoot, function(res) resourceName = getResourceName(resourceRoot) outputDebugString("["..resourceName.."]: Resource stopped.", 3, 255, 0, 0) end) But, the webhook dont works, any help? Link to comment
SpecT Posted June 11, 2021 Share Posted June 11, 2021 Hey, Dunno but "getResourdiscordName" doesn't look to me like a normal function name. 1 Link to comment
Moderators Patrick Posted June 11, 2021 Moderators Share Posted June 11, 2021 Yeah, and there are some other problems. - author subtable's syntax is incorrect, you have to use = instead of : and put index names inside [ ] (or use them withouth " ") - fetchRemote's syntax is incorrect, a callback function is required Don't forget to use /debugscript 3 Here is a tutorial of how to send Discord messages trough webhook: 1 Link to comment
ZeusXBr Posted June 12, 2021 Author Share Posted June 12, 2021 4 hours ago, SpecT said: Hey, Dunno but "getResourdiscordName" doesn't look to me like a normal function name. I see this, thanks! 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