I’m trying to get my web hook to send but it keeps giving me an “HTTP 400 (Bad Request)” error
it’s supposed to be sending a web hook to my own web hook i had put in my variables
I tried looking on the devforum, reverting my old code that used to work same issue I come across
--[[
- Thigbr
- 03/28/21
]]
-- // Services
local http = game:GetService("HttpService")
-- // Configuration
local DiscordWebhook = "https://discord.com/api/webhooks/825962296354275328/zpUZ_Ve5aLDXoJ0WkEQ1fX5T9EInJyBCgAWPWwfl2g4YtgPfDLsCELp_JYYSW_"
-- //
local module = {}
module.__index = module
function getRealTime(Time)
local ExactTime = os.date("!*t",Time)
local Hr, min, sec, day, mnth, year = ExactTime.hour, ExactTime.min, ExactTime.sec, ExactTime.day, ExactTime.month, ExactTime.year
return ("%0.0f-%0.0f-%0.0fT%0.0f:%0.0f:%0.0fZ"):format(year, mnth, day, Hr, min, sec)
end
function module.GetTable(plr, refunder, amount)
local self = setmetatable({
Player = plr.Name,
PlayerUserId = plr.UserId,
Refunder = refunder.Name,
RefunderUserId = refunder.UserId,
Amount = amount
}, module)
return self
end
function module:SendInfo()
local data = {
embeds = {
{
author = {name = "Player Refunded!"},
title = "Server: "..game.JobId,
description = self.Player..":"..self.PlayerUserId.." Has refunded ".."**"..self.Amount.."$**".." to Player "..self.Refunder..":"..self.RefunderUserId,
timestamp = getRealTime(tick()),
color = "2053964",
type = "rich",
}
}
}
local newdata = http:JSONEncode(data)
http:PostAsync(DiscordWebhook,newdata)
end
function module:SendError()
local data = {
embeds = {
{
author = {name = "An error occured!"},
title = "Server: "..game.JobId,
description = "Xd",
timestamp = getRealTime(tick()),
color = "15417151",
type = "rich"
}
}
}
local newdata = http:JSONEncode(data)
http:PostAsync(DiscordWebhook,newdata)
end
return module