commandhandler

package
v0.0.0-...-d3c4c7c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commands = map[string]Command{
	"calc": Command{
		Exec:        commands.CalcCommand,
		Name:        "calc",
		Aliases:     []string{"math"},
		Description: "Calcula uma expressão matemática",
		Example:     "1 + 1",
		OwnerOnly:   false,
	},
	"google": Command{
		Exec:        commands.GoogleCommand,
		Name:        "google",
		Aliases:     []string{"g"},
		Description: "Faz uma pesquisa no Google e retorna o primeiro resultado",
		Example:     "Never gonna give you up",
		OwnerOnly:   false,
	},
	"eval": Command{
		Exec:        commands.EvalCommand,
		Name:        "eval",
		Aliases:     []string{"js"},
		Description: "Executa uma expressão JavaScript",
		Example:     "console.log('1, 2, 3')",
		OwnerOnly:   true,
	},
	"avatar": Command{
		Exec:        commands.AvatarCommand,
		Name:        "avatar",
		Aliases:     []string{},
		Description: "Mostra a foto de um usuário em toda sua glória",
		Example:     "@Usuário",
		OwnerOnly:   false,
	},
}

Commands Lista todos os comandos

Functions

func ExecCommand

func ExecCommand(commandName string, args []string, channel *discordgo.Channel, message *discordgo.MessageCreate, session *discordgo.Session)

ExecCommand Executa um comando a partir do seu nome.

func HelpSpecialCommand

func HelpSpecialCommand(args []string, s *discordgo.Session, m *discordgo.MessageCreate, c *discordgo.Channel)

HelpSpecialCommand Comando especial de ajuda

func RegisterAliases

func RegisterAliases()

RegisterAliases Adiciona os nomes de aliases como referências aos comandos.

Types

type Command

type Command struct {
	Exec        func(args []string, s *discordgo.Session, m *discordgo.MessageCreate, c *discordgo.Channel) error
	Name        string
	Aliases     []string
	Description string
	Example     string
	OwnerOnly   bool
}

Command A base para os comandos

func FindCommand

func FindCommand(cmdname string) (Command, bool)

FindCommand Encontra um comando pelo seu nome ou por um alias

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL