-
Notifications
You must be signed in to change notification settings - Fork 0
addcommand
AddCommand is the function you use to add triggers to your bot. The structure of addCommand is this:
addCommand(text,function,permission,length)
This is basically the command name. Do not include the prefix in this. (example: "hi")
This is the function that will get triggered when the command is spoken. Note: Do NOT include parentheses or quotes when writing the function name.
You have three choices: "all","admins", or "owner". For more about permissions, check the Wiki page.
In parseinfo, arguments are split into pieces. With length you have to define the minimum amount of arguments for your function to execute correctly. The absolute minimum of length will always be 1 (the one which triggered the command in the first place). If, for example, you have a command that asks for a name, length will be 2 (the trigger word and the name). The reason this is in place is to prevent the bot from crashing when you don't give it enough arguments.
Example:
bot.addCommand("admin",admin,"admins",2)