Basic Admin Essentials how can I use the webhook plugin?

I want to log all bans to a Discord channel and I found a webhook plugin from the creator of the admin. My question is, how can I achieve my goal with this plugin?

Plugin module:

--[[
	
	 ____                                   
	/\  _`\                    __           
	\ \ \L\ \     __      ____/\_\    ___   
	 \ \  _ <'  /'__`\   /',__\/\ \  /'___\ 
	  \ \ \L\ \/\ \L\.\_/\__, `\ \ \/\ \__/ 
	   \ \____/\ \__/.\_\/\____/\ \_\ \____\
	    \/___/  \/__/\/_/\/___/  \/_/\/____/
	                                        
	Place this ModuleScript in the Plugins folder for
	Basic Admin Essentials 2.0	       
	
	Types of Logs:
	Admin Logs
	Kick Logs
	Ban Logs
	Shutdown Logs
	Exploit Logs
	Chat Logs 
	
--]]

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 = "Admin Logs",
			Webhook_Url = "",
		},
	}
	
	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

Hi
Firstly you would need to make & get your webhook url. Then, where it says:

Log = "Admin Logs",

You want to change that to “Ban Logs”

Eg:

Log = "Ban Logs",

When you’ve done that, go to the line where it says:

Webhook_Url = “”,

And just paste your webhook url in the speech marks.

1 Like

Will it log kicks too? I changed the plugin a bit and found a solution actually. I forgot to update this topic.

To log kicks, you want to do add a new line to the configuration eg:

local Configuration = {
		{
			Log = "Admin Logs",
			Webhook_Url = "",
		},
        {
			Log = "Kick Logs",
			Webhook_Url = "",
		},
	}

If that make’s sense, mark this as a solution if it helped you. :grinning:

1 Like