Advanced Webhooks || Easily interact with discord webhooks

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. The options 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:
image

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)

14 Likes

Update v1.1

  • Added enums for proxies
  • Added tts and username option (tts stands for text to speech)

Using enums

local module = require('path.to.module')

module.proxyURL = module.Enums.Proxies.hyra -- Slow
module.proxyURL = module.Enums.Proxies.lewisakura -- default
module.proxyURL = module.Enums.Proxies.discord -- Fast, official discord's website.

local webhookObject = module.new("webhook_url")

Changing username and adding tts

local module = require('path.to.module')
local webhookObject = module.new("webhook_url")

webhookObject:Send({
    content = "Hi",
    username = "oifhwoit284",
    tts = true
})

A basic example:

local main = require("path.to.module")
main.proxyURL = main.Enums.Proxies.discord

game.Players.PlayerAdded:Connect(function(plr)
	local object = main.new("https://discord.com/api/webhooks/976204314743820338/8PR3awHSLBiQxAW8JJwiUQPURpiLwxWQhlcQVj67pI1N1sR8UkABAfy2NGxaRHALEMD8")
	object:Send(
		{
			content = `A new player named {plr.DisplayName} \`@{plr.Name}\` joined the game!`;
			username = `{plr.Name}`;
			tts = true
		}
	)
end)

Output:
image

2 Likes

I do not understand. I thought Discord blocked Roblox from sending info via webhooks

Discord didn’t blocked Roblox, it was actually Cloudflare that blocked Roblox’s access to Discord due to the excessive requests being sent from Roblox’s servers IP to the discord.com domain.

However, my module uses the old domain name of Discord, which is discordapp.com. This means you can still utilize discordapp.com/api/webhooks/XXXXX/XXXXX to make requests to webhooks without any issues.

did you test it in a game

Summary

This text will be hidden

see this post How to send a Discord webhook through Roblox