-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefaultcommands.go
37 lines (31 loc) · 1.08 KB
/
defaultcommands.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package singularity
func addDefaultCommands(instance *SlackInstance) {
instance.Commands.registerCommand("test", testCommand) //TODO Get rid of the .
instance.Commands.registerCommand("version", versionCommand)
instance.Commands.registerCommand("setprefix", setCommmandPrefix)
}
func testCommand(command Command) {
message := Message{}
message.Text = "This is a test!"
message.Channel = command.Channel.ID
command.Instance.SendMessage(message)
}
func versionCommand(command Command) {
message := Message{}
message.Text = "version is 0.0.1"
message.Channel = command.Channel.ID
command.Instance.SendMessage(message)
}
func setCommmandPrefix(command Command) {
if len(command.Args) == 0 || command.Args[0] == "" {
message := Message{}
message.Text = "Must specify what to set the prefix to!"
message.Channel = command.Channel.ID
command.Instance.SendMessage(message)
}
command.Instance.Commands.setPrefix(command.Args[0])
message := Message{}
message.Text = "set the prefix to " + command.Args[0]
message.Channel = command.Channel.ID
command.Instance.SendMessage(message)
}