I’ve recently been experimenting with the Cmdr Admin system. It’s a fully customizable, advanced admin system designed for experienced developers.
I’ve created a lot of commands so far, but now I’m wondering: how can I log executed commands to a Discord webhook? Cmdr doesn’t have a logging system built in by default.
That’s what I love about Cmdr, it’s up to the developer to figure out to do these things. But while I’m not going to spoon-feed you I will give you two things, a snippet of code and the API Page.
To start off with is inside your “types” folder create a new module with the name “Logging” or whatever suites your preference and inside that you can paste the snippet of code in. The rest is up to you.
local RunService = game:GetService("RunService")
return function(Registry)
-- Preventing Client from having this event added since it's not needed.
if RunService:IsClient() then return end
-- Where you'd wanna add the AfterRun Hook.
Registry:AddHook("AfterRun", function(context)
-- Where you would add your logging functionality, you typically want to always return nil as if you return an actual value such as a string it will return that as the response to the command.
end)
end