-
Notifications
You must be signed in to change notification settings - Fork 2
/
helpCommand.go
24 lines (21 loc) · 931 Bytes
/
helpCommand.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
package main
import (
"fmt"
"strings"
"github.com/bwmarrin/discordgo"
)
func helpCommand(s *discordgo.Session, m *discordgo.MessageCreate) { // Help command... Yeah
if len(splitMsgLowered) == 1 { // If it's just `$Help`, then do this
s.ChannelMessageSendEmbed(m.ChannelID, &discordgo.MessageEmbed{
Title: "Commands:",
Description: fmt.Sprintf("%s", helpMsg)})
} else { // Otherwise, do this (like `+Help roleAddCommand`)
if splitMsgLowered[1] == strings.ToLower(commMap[splitMsgLowered[1]].name) { // If the second word (looking for the command, like `+Help role`)
s.ChannelMessageSendEmbed(m.ChannelID, &discordgo.MessageEmbed{
Title: fmt.Sprintf("%s Help:", splitMsgLowered[1]),
Description: commMap[splitMsgLowered[1]].description})
} else { // If it doesn't match a command
s.ChannelMessageSendEmbed(m.ChannelID, &discordgo.MessageEmbed{Title: "Command does not exist!"})
}
}
}