So, basically I want to make it so every admin log from Basic Admin Essentials will also be webhooked to a channel on my discord server so we have admin logs. I have no idea how to webhook or anything to do with it, can someone please help?
1 Like
You can use HttpService
.
local Plugin = function(...)
local Data = {...}
local returnPermissions = Data[1][3]
local pluginEvent = Data[1][9]
local tostring = tostring
local httpService = game:GetService('HttpService')
local Configuration = {
{
Log = "Logs",
Webhook_Url = "INSERT WEBHOOK HERE",
},
}
pluginEvent.Event:connect(function(Type,Data)
for _,Config in next,Configuration do
if Type == Config.Log then
local Succ,Msg
repeat
Succ,Msg = pcall(function()
local Table = {}
Table['username'] = (Data[1].Name or Data[1])
Table['content'] = (Data[2] or "nil")
local JSONTable = httpService:JSONEncode(Table)
httpService:PostAsync(Config.Webhook_Url, JSONTable)
end)
wait(1)
until Succ and not Msg
end
end
end)
return
end
return Plugin
Not sure if this will work, but it should.
1 Like
so i just paste this into plugins
You need to paste this into a module script and under the plugins folder.
module script? as in the new script that pops up when you make a new one?
thats weird… for me its a model
OHHH do i make a new script called logs under it? sorry im not great at scripting or studio in general
You make a module script, call it whatever you want and then paste that code into the module script.
1 Like
Yes, exactly like you’ve done.
do i paste it into the quotation marks? i pasted into the quote marks and it isnt sending in the channel
its enabled maybe theirs an issue with my webhook?
Send a screenshot of the code you pasted.
and also this