What do you want to achieve? I want to make that chatlogs do not process [at]everyone and [at]here.
What is the issue? The chatlogs do process these two blacklisted words. How can I fix that?
What solutions have you tried so far? I have tried ~= and if not msg == ‘[at] everyone’ then. None of then worked.
Everytime I wrote any of these 2 blacklisted words into the chat, it still got these onto discord.
This is my code:
local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")
local webhook = "https://discordapp.com/api/webhooks/" --Just change this link tot he one generated when setting up the webhook on discord.
local reboot = "https://discordapp.com/api/webhooks/"
Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local data = {
content = msg;
username = plr.Name;
avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..plr.Name
}
if data.content ~= '@everyone' or data.content ~= '@here' then
HttpService:PostAsync(webhook, HttpService:JSONEncode(data))
else
print('it is the everyone or here')
end
end)
end)
Please note that Discord is not meant for chat logging. Coding wise though, there are a few solutions. That only checks if it is just ‘@everyone’ and that alone. If there is any text followed after it, it will not be detected. If you would like to remove that, you can surround your message with grave accents. Here:
content = "`"..msg.."`"
So that pings will not work. Another alternative is to use string.find().
if not string.find(msg,"@everyone") and not string.find(msg,"@here") then
No? If this is user-generated, the user isn’t going to be nice enough to start the message with @everyone for you. He’s trying to avoid the message from having pings in it.
Oh wait I didn’t even read the post I was just looking at the replies, I thought he was just trying to detect if a message had @everyone or @here in it