Hello!
Any idea why my webhook argument check isn’t working correctly? If I say !help, it keeps getting sent as the SendWebhookCMD argument, therefore it sends the ChatlogsModule.SendWebhook(contentTable, "WebhookCMD")
instead of the HelpRequestModule.
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local ChatlogsModule = require(ServerStorage:WaitForChild("WebhookModules"):WaitForChild("ChatlogsModule"))
local HelpRequestModule = require(ServerStorage:WaitForChild("WebhookModules"):WaitForChild("HelpRequestModule"))
local HttpService = game:GetService("HttpService")
Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(message)
local contentTable = {
plr.DisplayName;
plr.Name;
plr.UserId;
message;
}
local HelpContentTable = {
plr.DisplayName;
plr.Name;
plr.UserId;
}
local Argument = ""
local words = string.split(message, " ")
local prefix = message:sub(1,1)
if prefix == ":" or prefix == "!" or prefix == "/" and words[1] ~= "!help" then -- CLASSIC COMMAND
Argument = "SendWebhookCMD"
elseif prefix == "!" and words[1] == "!help" then -- HELP REQUEST COMMAND
Argument = "HelpRequest"
elseif prefix ~= ":" and prefix ~= "!" and prefix ~= "/" and words[1] ~= "!help" then -- NORMAL MESSAGE
Argument = "SendWebhook"
end
if not plr then return end
if Argument == "" then return end
if plr and Argument == "SendWebhook" and contentTable ~= nil then
ChatlogsModule.SendWebhook(contentTable, "Webhook")
elseif plr and Argument == "SendWebhookCMD" and contentTable ~= nil then
ChatlogsModule.SendWebhook(contentTable, "WebhookCMD")
elseif plr and Argument == "HelpRequest" and HelpContentTable ~= nil then
HelpRequestModule.SendWebhook(HelpContentTable)
end
end)
end)