This repository has been archived on 2022-10-02. You can view files and clone it, but cannot push or open issues or pull requests.
dcbot-old/discord/commands.go

37 lines
907 B
Go

package discord
import (
"strings"
)
type Command string
var (
HelpCommand Command = "help"
AddCommand Command = "add"
ListCommand Command = "list"
DeleteCommand Command = "delete"
LostVillagesCommand Command = "lostvillages"
ConqueredVillagesCommand Command = "conqueredvillages"
)
func (cmd Command) String() string {
return string(cmd)
}
func (cmd Command) WithPrefix(prefix string) string {
return prefix + cmd.String()
}
func (s *Session) sendHelpMessage(mention, channelID string) {
s.sendMessage(channelID, mention+" zaraz ogarnę help cmd")
}
func (s *Session) sendUnknownCommandError(mention, channelID string, command ...string) {
s.sendMessage(channelID, mention+` Nieznana komenda: `+strings.Join(command, " "))
}
func (s *Session) sendMessage(channelID, message string) {
s.dg.ChannelMessageSend(channelID, message)
}