ChatLogger Issue

Description

This script isn’t working and I think it should, I’m unsure why and I’m asking for help here. It is supposed to send a message to Discord in a web hook way.

Organization

image


Code

local URL = https://hooks.hyra.io/api/webhooks/1056584400508289046/Z-zpMAPtrfWm3VG7q1s_a7rMCqwleXAl01iJ8Mju7FuRxIz-zgj30mbdSncJSPlVe__X
local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")

local function postMessage(player, index)
	local teamValue
	pcall(function()
		if not player.Team then
			teamValue = "Player"
		else
			teamValue = player.Team.Name
		end
	end)
	local data = {
		["content"] = "";
		["embeds"] = {{
			["author"] = {
				["name"] = player.Name;
				["icon_url"] = "https:www.roblox.com/headshot-thumbnail/image?userId="..player.UserId.."&width=150&height=150&format=png";
			};
			["description"] = "Said **"..index.."**",
			["color"] = tonumber(0xffffff);
			["fields"] = {
				["name"] = "Identifier";
				["value"] = player.UserId;
				["inline"] = true
			};
			{
				["name"] = "Existance";
				["value"] = player.AccountAge.." days";
				["inline"] = true
			};
			{
				["name"] = "Team";
				["value"] = teamValue;
				["inline"] = true
			};
			{
				["footer"] = {
					["icon_url"] = "https://www.roblox.com/library/5890405543/Images-NokoCafe";
					["text"] = "Nokó System 2023™"
				}
			};
		}}
	}
	local finalizedData = HttpService:JSONEncode(data)
	HttpService:PostAsync(URL, finalizedData)
end

local function PlayerAdded (Player)
	Player.Chatted:Connect(function(Message)
		postMessage(Player, Message)
	end)
end

for _, Player in ipairs(Players:GetPlayers()) do
	PlayerAdded(Player)
end

Players.PlayerAdded:Connect(PlayerAdded)

Thank you for your collaboration.

There is a chance that the API is not working, would you mind telling me what your exact goal is? Because I think that your trying to send messages to discord.

Exactly. I am using a Roblox > Hyra > Discord because Discord doesn’t like Roblox API requests

Now, I would not really suggest you try to send it to discord, via webhooks as there is a high probability
that discord blocks this, and the person making the webhook would be banned.

How do I send the content then? I have done it before and there wasn’t any issue.

I have done something like this using Hyra, and I was warned on discord, but let me try to find something that just might work.

1 Like

This is because discord started to block a few API’s a few months ago

Roblox owns a discord like platform called Guilded, try using that.

But I want to use Discord, not Guilded. All of our systems and things work in Discord and it complies totally with Discord and Roblox Terms of Service and other policies.

Try using a discord webhook spammer, it does the same thing but I don’t know if theres a api request thing for these types of websites. (eg Discord Webhook Sender)

1 Like

You must use a proxy for discord (or create your own) and the URL must be a string.