Adonis Custom Commands

I don’t know how the Plugin function works but I want it so for an example if I said !error It would use the :message command to display a set message? Can some Adonis genius please help me? Thanks!
Adonis Example Plugin Script

	SERVER PLUGINS' NAMES MUST START WITH "Server: "
	CLIENT PLUGINS' NAMES MUST START WITH "Client: "
	
	Plugins have full access to the server/client tables and most variables.
	
	You can use the MakePluginEvent to use the script instead of setting up an event.
	PlayerChatted will get chats from the custom chat and nil players. 
	PlayerJoined will fire after the player finishes initial loading
	CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.
	
	service.HookEvent('PlayerChatted',function(msg,plr) 
		print(msg..' from '..plr.Name..' Example Plugin')
	end)
	
	service.HookEvent('PlayerJoined',function(p) 
		print(p.Name..' Joined! Example Plugin') 
	end)
	
	service.HookEvent('CharacterAdded',function(plr) 
		server.RunCommand('name',plr.Name,'BobTest Example Plugin') 
	end)
	
--]]

server = nil -- Mutes warnings about unknown globals
service = nil
return function()
	server.Commands.ExampleCommand = {
		Prefix = server.Settings.Prefix;	-- Prefix to use for command
		Commands = {"example"};	-- Commands
		Args = {"arg1"};	-- Command arguments
		Description = "Example command";	-- Command Description
		Hidden = true; -- Is it hidden from the command list?
		Fun = false;	-- Is it fun?
		AdminLevel = "Players";	    -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
		Function = function(plr,args)    -- Function to run for command
			print("HELLO WORLD FROM AN EXAMPLE COMMAND :)")
			print("Player supplied args[1] "..tostring(args[1]))
		end
	}
end```
2 Likes

I’m one of these so called “Adonis Genuises”. Here you go.

-- All plugins have a function being returned
server = nil
service = nil

return function()
	server.Commands.ScriptingSupport = { -- adds new key to commands
		Prefix = server.Settings.Prefix; -- ":" prefix
		Commands = {"examplecommand"}; -- list of aliases
		Args = {"player"}; -- list of the arguments ":example arg1 arg2" used in the function
		Description = "Example"; -- description
		Hidden = false; -- is it hidden?
		Fun = false; -- is it fun?
		AdminLevel = "Mods"; -- The admin level, must have an "s" at the end of the rank (Players, Mods, Admins, Owners, Creators)
		Function = function(pl, args) -- pl = the command executor (me/the player who runs the command), args = argument
			for _, player in pairs(service.GetPlayers(pl, args[1])) do -- this function does all the "me/others/all" stuff
				...
			end
		end,
	}
end

Watch this video if you’re confused:

If you want the
MainModule then you can have it, look at the commands if you want a reference.
https://www.roblox.com/library/2373501710/Adonis-MainModule

9 Likes

I want it so for an example if I said !error It would use the :message command to display a set message

1 Like

@mobyboyy ^^^^^^^^^^^^^^^^^^^^^

I believe there is a server.RunCommand() function. Just ctrl+f and search “Runcommand” in the commands module to see its uses.

For your use case youll want to listen to the Chatted event, check the message and then use RunCommand. Again, see command module for usage or the API (if its there.)

2 Likes