Basic Admin Essentials Webhook Logging

Hello! As you all may know, there is an available plugin for logging basic admin logs. I am curious to know, how would I be able to modify it so that instead of changing the webhook’s name, it will just type the player’s username beside the command.

This is the code from the plugin:

	
	 ____                                   
	/\  _`\                    __           
	\ \ \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

This logs it in a way that the webhook name changes to the player’s username. Instead, I would like it to just send the player’s username beside it. It should look something like this:

xSimplyCool: -command-

I am not very familiar with scripting BAE Plugins.

3 Likes

According to what I see, Data[1] is equal to the player who executed the command.

This line modifies the content of the message sent via the webhook. If you want the name of the player, then the command, it will look something like this:

Output:

Volieb - :fly me

Code:

Table['content'] = (Data[1].Name or Data[1]).." - "..(Data[2] or "nil")

Thank you! It works now. I also edited the ‘username’ part to display the name of the webhook so it no longer displays the username of the player.

Hello, I know that this has already been solved but I have a quick question about how do you log the player’s Admin Level? What I am trying to do is make it have the Username, Command, and Admin Level in the logs.

Would be a cool thing but i have no idea.

is there a way to make the username bold?

Add “**” before and after the username.

where?

Table[‘content’] = (Data[1].Name or Data[1]) …" : "…(Data[2] or “nil”)

On that line, use the following:

Table["content"] = "**"..(Data[1].Name or Data[1]).."**".." : "..(Data[2] or "nil")

Thanks so much really helped. (: