Skip to content

arlowontprogram/ROBLOX-easyWebhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ROBLOX-easyWebhook

GitHub

A new simple way of sending discord webhooks on roblox.

easyWebhook is a ROBLOX based method of creating and posting discord webhooks, in a simpler fashon.

Setup

Initial Setup

First, we need to make sure HTTP requests are enabled.

If you don't know how to setup HTTP requests:

  1. Edit the game you wish to add this to, go into your game settings
  2. Under Security, check the "Allow HTTP Requests" to make sure it is enabled.

Second, if you haven't created your webhook, create it now.

Discord provides a tutorial that helps you create your first webhook.

Setting up the code

Requiring ROBLOX asset

If you don't want to setup with /client, the settings will be defaulted. Skip to Requiring the Main Module

Setting up via /client

in /client

  • copy main.lua and create a ModuleScript inside of ServerScriptService and name it easyWebhook
  • copy easyWebhook Settings.lua and create a ModuleScript inside of easyWebhook (the ModuleScript we created in ServerScriptService) and name it easyWebhook Settings

Your hierarchy should now look like:

  • ServerScriptService
    • easyWebhook
      • easyWebhook Settings

Settings

Your settings will be sent to the easyWebhook loader in your script, it should look like this;

local settings = {
	olddomain = "discord.com",
	maindomain = "hooks.hyra.io",
	HidePrints = false
}

... We are changing discord.com to hooks.hyra.io because ROBLOX now blocks requests going to the discord.com domain. The code will automatically replace discord.com with hooks.hyra.io

Requiring the Main Module

local easyWebhook = require(game.ServerScriptService:WaitForChild("easyWebhook"))

or if you wish to load the module via ROBLOX

local easyWebhook = require(8368541547)

Posting Requests

As we now have required the Main Module, (assuming we have our Webhook's URL) we can now send requests.

With the following example

local settings = {
	olddomain = "discord.com",
	maindomain = "hooks.hyra.io",
	HidePrints = false
}
local webhookurl = "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
local easyWebhook = require(script.Parent.easyWebhook) -- Replace this line with the method you used to require the main module.
local Webhook = easyWebhook(webhookurl, settings)

local Success = Webhook:PostAsync(
	{
		content = "Hello!",
		username = "noob",
		avatar_url="http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username=lua_exception",
		embeds = {
			{
				title = "TITLE",
				author = {
					name = "LOSER",
				},
				description = "noober"
			}
		}
	}
)

if not Success then
	warn("There has been an issue sending the webhook request.")
else
	print("Successfully sent webhook!")
end

... we can send content, username, avatar_url and embeds as easy as this block of text.

image

Useful Links

discord.club for making embeds easier to create

About

simple ROBLOX-Discord webhook wrapper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages