Lua Discord Webhook Class (Based off of Discord.js)

This is a simple Discord webhook class I made based on discord.js’s MessageEmbed Class for Roblox since I noticed how hard it is to craft a nice looking embed from pure JSON for new users.

  • .setAuthor(Name, ImageUrl, Hyperlink)
  • .setTitle(Title)
  • .setUrl(Hyperlink)
  • .setDescription(Description)
  • .setFooter(Footer, ImageUrl)
  • .setTimestamp(osTimeDate, parser?)
  • .addField(Name, Value, Inline?)
  • .setColor(HexColor)
  • .setThumbnail(ImageUrl, Width, Height)
  • .setImage(ImageUrl, Width, Height)

Example Script

local Classes = script.Classes;
local DiscordEmbed = require(Classes.Embed);
local Webhook = require(Classes.WebhookClient);

local TestWebhook = Webhook("LINK");

TestWebhook.send(
	DiscordEmbed()
	.setUrl("https://roblox.com")
	.setColor("#ffaa00")
	
	.setAuthor('ROBLOX', 'https://tr.rbxcdn.com/c3ee609e91804ee2f15c6375355a381a/150/150/AvatarHeadshot/Png')
	.setTitle("Example Embed")
	.setDescription('This is the embed\'s description!')
	
	
	.addField("Inline Test", "This is an inline field", true)
	.addField("Inline Test #2", "This is another inline field", true)
	.addField("Normal Test", "This is a normal field", false)
	
	.setThumbnail('https://tr.rbxcdn.com/36aad500015617f31470126e48573cbe/150/150/AvatarHeadshot/Png')
	.setImage('https://blog.roblox.com/wp-content/uploads/2017/01/Roblox_Logo_Square_Image.jpg')
	
	.setTimestamp(os.date("!*t"), true)
	.setFooter("Sent from Lua Ingame")
	
)

14 Likes

Very useful! nice open source tho. :+1:

1 Like

And what exactly is this webhook supposed to do? (Out of curiosity)

1 Like

It sends embedded messages to Discord, you can use it for various utilities and getting information from inside a game server. What you use it for is up to you.

Alright. Thanks for the info! :wine_glass: Cheers!

1 Like

damnnn that’s cool. might use this later on. thanks! :slight_smile:

2 Likes

Wow! This is very useful, I was attempting to create this on my own but came upon this. All it takes is a few steps to set it up with whatever event you want to use it with and it works! Thank you for this release :slight_smile:

1 Like