This module provides functionalities for creating and sending Discord embeds using a webhook URL. It includes functions for building embed objects, setting various properties of the embed, and sending the embed to the specified webhook.
Properties:
-
proxyURL
: A string representing the URL of the proxy server to be used for sending requests.
Functions:
-
EmbedBuilder(options: EmbedObject?) -> table
: Returns an embed builder object used for constructing embeds. Theoptions
parameter is an optional embed object that can be used to initialize the template. -
new(webhookURL: string) -> table
: Creates a new instance of the Core module with the specified webhook URL. Returns a table containing functions for sending embeds to the webhook. -
ConvertColor(color: Color3) -> number
: Converts a Color3 object to its corresponding hexadecimal color value.
Type Definitions:
-
ImageOptions
: Represents options for an image in an embed.-
url
(string): The URL of the image. -
width
(number, optional): The width of the image. -
height
(number, optional): The height of the image.
-
-
AuthorObject
: Represents an author in an embed.-
name
(string): The name of the author. -
url
(string): The URL associated with the author. -
icon_url
(string): The URL of the author’s icon.
-
-
FooterObject
: Represents a footer in an embed.-
text
(string): The text content of the footer. -
icon_url
(string): The URL of the footer’s icon.
-
-
FieldObject
: Represents a field in an embed.-
name
(string): The name or title of the field. -
value
(string): The value or content of the field. -
inline
(boolean): Specifies whether the field should be displayed inline or not.
-
-
SendOptions
: Represents options for sending an embed.-
embeds
(table, optional): A table of embed objects to be sent. -
content
(string, optional): The content or text message to be sent.
-
-
EmbedObject
: Represents an embed object.-
title
(string, optional): The title of the embed. -
description
(string, optional): The description or main content of the embed. -
type
(string): The type of the embed. -
color
(number, optional): The color of the embed in decimal format. -
image
(ImageOptions, optional): Options for an image in the embed. -
thumbnail
(ImageOptions, optional): Options for a thumbnail image in the embed. -
author
(AuthorObject, optional): The author of the embed. -
footer
(FooterObject, optional): The footer of the embed. -
fields
(table, optional): A table of field objects in the embed.
-
Usage:
Below is an example of how to use the module:
local url = "https://discord.com/api/webhooks/xxxxx/xxxxxxx"
local new,EmbedBuilder = module.new,module.EmbedBuilder
local main = new(url)
local embed = EmbedBuilder()
embed.setColor(Color3.fromRGB(65, 147, 255))
embed.setTitle('Hello')
embed.setDescription("This is a test")
local embed2 = EmbedBuilder {
["type"] = "rich";
["title"] = "hello bro";
["color"] = module.ConvertColor(Color3.fromRGB(255, 134, 28));
["description"] = "Hello bro this is desc"
}
main:Send({
content = "Works.";
embeds = {embed,embed2};
})
Output:
Another example using full embeds
local url = "https://discord.com/api/webhooks/976204314743820338/8PR3awHSLBiQxAW8JJwiUQPURpiLwxWQhlcQVj67pI1N1sR8UkABAfy2NGxaRHALEMD8"
local new,EmbedBuilder = module.new,module.EmbedBuilder
local main = new(url)
local embed = EmbedBuilder()
embed.setColor(Color3.fromRGB(65, 147, 255))
embed.setTitle('Hello')
embed.setDescription("This is a test")
embed.addFields(
{
name = "one";
value = "test";
inline = true;
},
{
name = "two";
value = "test2";
inline = true;
},
{
name = "three";
value = "test3";
}
)
embed.setImage(
{
url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Blue_question_mark_icon.svg/2048px-Blue_question_mark_icon.svg.png";
width = 150; height = 150;
}
)
embed.setThumbnail(
{
url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Blue_question_mark_icon.svg/2048px-Blue_question_mark_icon.svg.png";
width = 150; height = 150;
}
)
embed.setAuthor(
{
name = "Author_name";
icon_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Blue_question_mark_icon.svg/2048px-Blue_question_mark_icon.svg.png";
url = "https://roblox.com"
}
)
embed.setFooter(
{
text = "This is a footer.";
icon_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Blue_question_mark_icon.svg/2048px-Blue_question_mark_icon.svg.png"
}
)
main:Send({
embeds = {embed};
})
Output:
I’ve used https://webhook.lewisakura.moe as a default proxy, you can change it in the module. devforum
Module:
(dont worry about the webhook url provided above, its already deleted)