TerraOceanPlugin/GoBot/discord/modules/help.go

36 lines
789 B
Go

package modules
import (
"TerraOceanBot/discord/config"
"TerraOceanBot/discord/message"
"github.com/bwmarrin/discordgo"
)
var embed *discordgo.MessageEmbed
//GenerateHelpEmbed sets up the embed variable above to be used to display the !help command.
func GenerateHelpEmbed() {
emb := message.NewEmbed().
SetTitle(config.HelpTitle).
SetColour(config.HelpColour).
SetDescription(config.HelpDescription)
for _, cmd := range Commands {
usage := cmd.Usage
if usage == "" {
usage = "No usage provided"
}
emb.AddField(cmd.Name, usage)
}
embed = emb.Build()
}
func showHelp(s *discordgo.Session, m *discordgo.MessageCreate, commands []string) {
_, err := s.ChannelMessageSendEmbed(m.ChannelID, embed)
if err != nil {
message.AuditError(s, m.ChannelID, err)
}
}