-
Notifications
You must be signed in to change notification settings - Fork 3
Adding New Commands
Magno Oliveira edited this page Jul 5, 2019
·
1 revision
If it is necessary to add new commands, simply add the constant in slack.go, in the group of global constants
const (
yourCommand = "SlacklikeCommand"
)After that, still in slack.go, look for the handleMessageEvent function to go to the end of the function, see that it will have a condition structure chair (IfElse), add another else if () {} with the following rules:
else if strings.HasPrefix(message, yourCommand) {
funcProcessCommand()
}After that, add your command to commands.go, inside the slice called Commands. Note: This step is optional, if not put, your command will not appear in the command list, however, it will work.
Commands = append(Commands, Command{
Cmd: yourCommand,
Description: "Description of your command, explaining what it is for",
Usage: "As your command will be used (we recommend that you refer to the command as 'command', because when the command listing method is called, it will be replaced by the command itself)",
Lint: "If your command receives arguments or you want to leave any tips on the command, put it here",
IsActive: true , // Keep true. Its a possible feature.
})SlackBot Jeremias
Magno Oliveira
|
Cayo Hollanda