I see this but i don’t think this is the problem:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HttpService = game:GetService("HttpService")
local webhookUrl = "https://discord.com/api/webhooks/1277242436296376392/0JRnq2sFPNkvG-s3BDt4cBbGIvWSal4CmN7zOKPbqWcMj3KHbZBidHFxxY30rrLKqb4K"
local defaultAvatarUrl = "https://tr.rbxcdn.com/30DAY-AvatarHeadshot-310966282D3529E36976BF6B07B1DC90-Png/420/420/AvatarHeadshot/Png/noFilter"
local cooldownTime = 600
local lastLoggedTime = {}
local function checkForSpecificPhrases(message)
local lowerMessage = string.lower(message)
local phrasesToCheck = {
"daiplayz is an nn skid",
"renderintents.xyz",
"you're bad, just use render",
"render is undetectable, untouchable and unpatchable",
"this game hasn't fixed their anticheat :sob:",
"Was i supposed to get lagbacked?",
"Oh ye when anticheat?",
}
for _, phrase in ipairs(phrasesToCheck) do
if string.find(lowerMessage, phrase) then
return true, phrase
end
end
return false, nil
end
local function getPlayerAvatarUrl(userId)
local url = "https://api-thumbreqs.daiplayzroblox.workers.dev/?userIds=" .. tostring(userId)
local success, response = pcall(function()
return HttpService:GetAsync(url)
end)
if success then
local data
local successDecode, result = pcall(function()
return HttpService:JSONDecode(response)
end)
if successDecode then
if result and result.imageUrl then
return result.imageUrl
else
return defaultAvatarUrl
end
else
return defaultAvatarUrl
end
else
return defaultAvatarUrl
end
end
local function logToDiscord(player, detectedPhrase, message)
local playerName = player.DisplayName .. " (@" .. player.Name .. ")"
local userId = tostring(player.UserId)
local avatarUrl = getPlayerAvatarUrl(userId)
local placeId = tostring(game.PlaceId)
local gameInstanceId = tostring(game.JobId)
local joinLink = "https://auth-join.daiplayzroblox.workers.dev/?placeId=" .. placeId .. "&gameInstanceId=" .. gameInstanceId
local embed = {
title = "**Possible AutoToxic Detected (note: trolls can happen)**",
color = 16711680,
fields = {
{name = "Player", value = playerName, inline = false},
{name = "User ID", value = userId, inline = false},
{name = "Phrase Detected", value = detectedPhrase, inline = false},
{name = "Full Message", value = message, inline = false},
{name = "Join Link", value = "[Join](" .. joinLink .. ")", inline = false}
},
thumbnail = {
url = avatarUrl
},
footer = {
text = "Automated Moderation System",
},
timestamp = os.date("!%Y-%m-%dT%H:%M:%SZ")
}
local payload = HttpService:JSONEncode({
username = "Moderation Bot",
embeds = {embed}
})
pcall(function()
HttpService:PostAsync(webhookUrl, payload, Enum.HttpContentType.ApplicationJson)
end)
end
local function onMessageReceived(player, message)
local currentTime = os.time()
if lastLoggedTime[player.UserId] and (currentTime - lastLoggedTime[player.UserId] < cooldownTime) then
return
end
local isPhraseDetected, detectedPhrase = checkForSpecificPhrases(message)
if isPhraseDetected then
logToDiscord(player, detectedPhrase, message)
lastLoggedTime[player.UserId] = currentTime
end
end
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
onMessageReceived(player, message)
end)
end)
for _, player in pairs(Players:GetPlayers()) do
player.Chatted:Connect(function(message)
onMessageReceived(player, message)
end)
end
local defaultChatSystem = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents", 10)
if defaultChatSystem then
local sayMessageRequest = defaultChatSystem:WaitForChild("SayMessageRequest", 10)
if sayMessageRequest then
sayMessageRequest.OnServerEvent:Connect(function(player, message, recipient)
onMessageReceived(player, message)
end)
end
end