Hello there everybody, I was messing around with embeds for my bot in NodeJs today and I had the idea to remake the same API inside of Roblox. So here it is, I present to you all:
EASY-WEBHOOK:
Documentation:
Inbuilt functions:
Module.getFromUrl(Url, Parse) - Gets from Url and if Parse is set to true then it decodes the JSON.
Module.postToUrl(Url, Data) - Posts to Data to Url which is also Encoded in JSON.
Module.toHex(number) - Converts number to hex.
Webhook functions:
Webhook.new(Webhook_Url, Message_Content, Embeds, Username, Avatar_Url) - Posts to Webhook_Url and with the content Message_Content if not nil or “”, adds Embeds if not nil, changes the username of the bot to Username if also not nil and changes the Avatar Icon to Avatar_Url if not nil.
Webhook.richEmbed() - Constructs a new Embed.
Embed functions:
Embed.setTimestamp() - Adds a Timestamp to the embed.
Embed.setColor(Color) - Sets the embed’s color to Color.
Embed.setTitle(Text) - Sets the embed’s title to Text.
Embed.setDescription(Text) - Sets the embed’s description to Text.
Embed.setURL(Url) - Sets the embed’s title’s url to Url.
Embed.setThumbnail(Image_Url) - Sets the embed’s thumbnail to Image_Url.
Embed.setImage(Image_Url) - Sets the embed’s image to Image_Url.
Embed.setFooter(Name, Image_Url) – Sets the embed’s footer’s name to Name and Icon url to Image_Url.
Embed.setAuthor(Name, Image_Url, Url) - Sets the embed’s author Name to Name, Icon to Image_Url and Url to Url
Embed.addField(Name, Value, InLine) - Adds a field to the embed with name Name, value Value and optional boolean InLine
Embed.addFields(…) - Adds passed amount of fields to the embed.
Example Code:
local Webhook = require(workspace.MainModule)
local Embed = Webhook.richEmbed()
Embed.setColor(Color3.new(27, 145, 248))
Embed.setTitle('Some title')
Embed.setURL('https://discord.js.org/')
Embed.setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
Embed.setDescription('Some description here')
Embed.setThumbnail('https://i.imgur.com/wSTFkRM.png')
Embed.addField('Some title here', 'Some value here', false)
Embed.addFields(
{
"Field #1",
"Value #1",
true
},
{
"Field #2",
"Value #2",
true
},
{
"Field #3",
"Value #3",
true
}
)
Embed.setImage('https://i.imgur.com/wSTFkRM.png')
Embed.setTimestamp()
Embed.setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');
Webhook.new("Webhook", "Lorem Ipsum.", Embed, "Discord.js", "https://i.imgur.com/wSTFkRM.png")
Model:
https://www.roblox.com/library/4955339544/Easy-Webhook-API
I am looking forward for suggestions and bug reports, please message me them or reply with them, I’ll try my best to fix or add them as soon as possible.