Hey! I’m trying to send a webhook after a chat command. I have already made numerous webhooks in a similiar way, so I quite don’t know why it doesn’t work (the others do work).
I know that Discord directly doesn’t support HTTP requests for Webhooks from Roblox, that’s why I’m using an external Proxy which makes this be possible.
ModuleScript
local module = {}
local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")
local ServerStorage = game:GetService("ServerStorage")
local URL = "https://webhook.lewisakura.moe/api/webhooks/YOU DONT NEED THIS"
module.SendWebhookBlacklist = function(contentTable)
local data = {
["content"] = ":no_entry: __**New blacklist**__";
["embeds"] = {{
["description"] = "";
["color"] = tonumber(0x000000);
["fields"] = {
{
["name"] = "Blacklisted User:";
["value"] = "@"..tostring(contentTable[1]).."]".."(https://www.roblox.com/users/"..tostring(contentTable[2]).."/profile)";
["inline"] = false;
};
{
["name"] = "Blacklisted By:";
["value"] = "@"..tostring(contentTable[3]).."]".."(https://www.roblox.com/users/"..tostring(contentTable[4]).."/profile)";
["inline"] = false;
};
{
["name"] = "Server ID";
["value"] = tostring(ServerStorage.JoinCode.Value);
["inline"] = false;
};
};
["footer"] = {
["icon_url"] = "https://media.discordapp.net/attachments/1216404569089769472/1216408777201418320/police-officer-head.png?ex=660047f4&is=65edd2f4&hm=9dda42e26e380c195e36dfdb7311f0e2c161b460ae856a13328dc5a3574b6416&=&format=webp&quality=lossless";
["text"] = "FBI Logs Blacklists"
}
}}
}
HttpService:PostAsync(URL, HttpService:JSONEncode(data))
end
module.SendWebhookUnblacklist = function(contentTable)
local data = {
["content"] = ":white_check_mark: __**New unblacklist**__";
["embeds"] = {{
["description"] = "";
["color"] = tonumber(0xffffff);
["fields"] = {
{
["name"] = "Unblacklisted User:";
["value"] = "@"..tostring(contentTable[2]).."]".."(https://www.roblox.com/users/"..tostring(contentTable[4]).."/profile)";
["inline"] = false;
};
{
["name"] = "Unblacklisted By:";
["value"] = "@"..tostring(contentTable[1]).."]".."(https://www.roblox.com/users/"..tostring(contentTable[5]).."/profile)";
["inline"] = false;
};
{
["name"] = "Server ID";
["value"] = tostring(ServerStorage.JoinCode.Value);
["inline"] = false;
};
};
["footer"] = {
["icon_url"] = "https://media.discordapp.net/attachments/1216404569089769472/1216408777201418320/police-officer-head.png?ex=660047f4&is=65edd2f4&hm=9dda42e26e380c195e36dfdb7311f0e2c161b460ae856a13328dc5a3574b6416&=&format=webp&quality=lossless";
["text"] = "FBI Logs Blacklists"
}
}}
}
HttpService:PostAsync(URL, HttpService:JSONEncode(data))
end
return module
ServerScript
Player.Chatted:Connect(function(Message)
local Words = string.split(Message, " ")
if Words[1] == "!logsblacklist" then
if Player:GetRankInGroup(10928983) >= 249 then
local NameOfPlayerToBlacklist = Words[2]
local BlacklistPlayerID = Players:GetUserIdFromNameAsync(NameOfPlayerToBlacklist)
local success, errormessage = pcall(function()
gameDataStore:SetAsync(BlacklistPlayerID, true)
end)
if success then
print("Player's access has been succesfully removed!")
Event:FireClient(Player, NameOfPlayerToBlacklist, "blacklist")
BlacklistModule.SendWebhookBlacklist(
{
NameOfPlayerToBlacklist;
BlacklistPlayerID;
Player.Name;
Players:GetUserIdFromNameAsync(Player.Name);
}
)
end
else
print("You're not allowed to use this command!")
end
elseif Words[1] == "!logsunblacklist" then
if Player:GetRankInGroup(10928983) >= 249 then
local NameOfPlayerToUnblacklist = Words[2]
local UnblacklistPlayerID = Players:GetUserIdFromNameAsync(NameOfPlayerToUnblacklist)
local success, errormessage = pcall(function()
gameDataStore:SetAsync(UnblacklistPlayerID, false)
end)
if success then
print("Player's access has been succesfully regained!")
Event:FireClient(Player, NameOfPlayerToUnblacklist, "unblacklist")
BlacklistModule.SendWebhookUnblacklist(
{
NameOfPlayerToUnblacklist;
UnblacklistPlayerID;
Player.Name;
Players:GetUserIdFromNameAsync(Player.Name);
}
)
end
else
print("You're not allowed to use this command!")
end
end
end)