Documentation ¶
Index ¶
- Constants
- Variables
- func Boot()
- func Builder() *commandBuilder
- func HandlePlayerCommandText(player natives.Player, cmdtext string) bool
- func RegisterCommand(command *Command) (bool, error)
- func RegisterInterceptor(commandName string, interceptor CommandInterceptorHandler)
- func SetConfig(notFoundChat *chat.ChatBuilder, similarFoundMsg string)
- type ArgHandler
- type Command
- type CommandContext
- type CommandHandler
- type CommandInterceptorContext
- type CommandInterceptorHandler
- type TPlayer
Constants ¶
View Source
const ( MustPlayerConnected = iota MustNickIs )
Variables ¶
View Source
var NotFoundChat *chat.ChatBuilder
View Source
var SimiularFoundMSG *string
Functions ¶
func HandlePlayerCommandText ¶
Função que deve ser chamada na callback "OnPlayerCommand"
func RegisterCommand ¶
func RegisterInterceptor ¶
func RegisterInterceptor(commandName string, interceptor CommandInterceptorHandler)
func SetConfig ¶
func SetConfig(notFoundChat *chat.ChatBuilder, similarFoundMsg string)
seta as mensagens que são executadas qunado um comando similar é encontrado, ou quando nenhum é encontrado.
Exemplo: ¶
cb := chat.builder()
cb.Message("nenhum comando encontrado")
similarFound := "comando similar"
SetConfig(cb, similarFound)
# Resultado: ¶
*Jogador digita "/command", mas não existe:
> chat: nenhum comando foi encontrado
*Jogador digita "/aujad", e similar foi encontrado: "ajuda"
> chat: comando similar: ajuda
Types ¶
type ArgHandler ¶
type ArgHandler struct {
// contains filtered or unexported fields
}
func (*ArgHandler) GetInput ¶
func (self *ArgHandler) GetInput() *string
func (*ArgHandler) Next ¶
func (self *ArgHandler) Next(defaultValues ...string) *string
func (*ArgHandler) NextFloat ¶
func (self *ArgHandler) NextFloat(defaultValues ...float64) *float64
func (*ArgHandler) NextInt ¶
func (self *ArgHandler) NextInt(defaultValues ...int) *int
func (*ArgHandler) Restore ¶
func (self *ArgHandler) Restore()
type Command ¶
type Command struct { Name string Handler CommandHandler Interceptors []CommandInterceptorHandler Description string RequireLogin bool Aliases []string Roles []string // contains filtered or unexported fields }
func SearchCommand ¶
type CommandContext ¶
type CommandContext struct { Player *natives.Player ArgHandler *ArgHandler }
type CommandHandler ¶
type CommandHandler func(context *CommandContext)
type CommandInterceptorContext ¶
type CommandInterceptorContext struct { Player *natives.Player ArgHandler *ArgHandler // contains filtered or unexported fields }
func (*CommandInterceptorContext) Next ¶
func (self *CommandInterceptorContext) Next()
type CommandInterceptorHandler ¶
type CommandInterceptorHandler func(context *CommandInterceptorContext)
type TPlayer ¶
type TPlayer struct {
// contains filtered or unexported fields
}
func (*TPlayer) EndConditionals ¶
func (tp *TPlayer) EndConditionals() *commandBuilder
func (*TPlayer) MustConnected ¶
func (*TPlayer) MustNickIs ¶
Click to show internal directories.
Click to hide internal directories.