Documentation
¶
Index ¶
- Constants
- func CreateEmbed(color discord.Color, title string, bodyText string, footerText string) discord.Embed
- func ListPlayers(state *state.State, cmd DiscordCommand) error
- func ParseConfigCommand(state *state.State, cmd DiscordCommand) error
- func RemoveEmbed(state *state.State, channelID discord.ChannelID, ...) error
- func SendCommandEmbed(state *state.State, cmd DiscordCommand, embed discord.Embed) error
- func SendMissingPermsEmbed(state *state.State, channelID discord.ChannelID, messageID discord.MessageID) error
- func ShowHelp(state *state.State, cmd DiscordCommand) error
- type Cmd
- type DiscordCommand
- type Handler
- type Parser
Constants ¶
const ( ErrorColor = 0xcc0000 InfoColor = 0x0099ff SuccessColor = 0x4CAF50 WarnColor = 0xff9800 )
Color code for embed colors.
Variables ¶
This section is empty.
Functions ¶
func CreateEmbed ¶
func CreateEmbed(color discord.Color, title string, bodyText string, footerText string) discord.Embed
CreateEmbed makes a new Discord embed with the given parameters.
func ListPlayers ¶
func ListPlayers(state *state.State, cmd DiscordCommand) error
ListPlayers sends an RCON command to the Minecraft server to list all online players.
func ParseConfigCommand ¶
func ParseConfigCommand(state *state.State, cmd DiscordCommand) error
ParseConfigCommand checks if the config option specified is valid, and updates the config accordingly.
func RemoveEmbed ¶
func RemoveEmbed(state *state.State, channelID discord.ChannelID, commandID, embedID discord.MessageID) error
RemoveEmbed attempts to remove an embed after 30 seconds. If a message is unable to be deleted, an error is returned.
func SendCommandEmbed ¶
SendCommandEmbed sends the given embed to the specified Discord channel, and removes it after 30 seconds. If there was an error sending or removing the embed, an error is returned.
func SendMissingPermsEmbed ¶
func SendMissingPermsEmbed(state *state.State, channelID discord.ChannelID, messageID discord.MessageID) error
SendMissingPermsEmbed creates a new embed for a player missing a permission. This embed is then sent to the channel, and the command and embed are removed after 30 seconds.
Types ¶
type DiscordCommand ¶
type DiscordCommand struct {
Sender discord.User
Command string
Args []string
GuildID discord.GuildID
ChannelID discord.ChannelID
MessageID discord.MessageID
}
DiscordCommand is a command sent by a user in Discord to be parsed and handled.
type Handler ¶
type Handler struct {
Name string
Desc string
Run func(state *state.State, cmd DiscordCommand) error
}
Handler is the interface the each Discord command handler implements.