amebas

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 17 Imported by: 0

README

sdk-go

SDK oficial do bot de sala do Amebas Arena em Go: conecta no WebSocket da sala, entrega os eventos tipados e dá um sistema de comandos de chat pronto (!gols 5) com argumentos, permissão e cooldown.

go get github.com/Amebas-Arena/sdk-go
package main

import (
	"context"
	"fmt"
	"math/rand/v2"
	"os"
	"time"

	amebas "github.com/Amebas-Arena/sdk-go"
)

func main() {
	bot, _ := amebas.New(amebas.Options{BaseURL: "https://SEU-SITE/api", RoomID: "ID_DA_SALA", Key: os.Getenv("AMEBAS_KEY")})

	bot.OnPlayerJoined(func(e amebas.PlayerJoinedEvent) { bot.Say(context.Background(), "Oi, "+e.Player.Nick+"!") })
	bot.Command("regras", amebas.Cmd{}, func(c *amebas.Ctx) error { c.Reply("Sem xingar e joga limpo."); return nil })
	bot.Command("dado", amebas.Cmd{Args: amebas.Args("lados", "int:2..100=6"), Cooldown: 5 * time.Second},
		func(c *amebas.Ctx) error { c.Reply(fmt.Sprint("Tirou ", 1+rand.IntN(c.Int("lados")))); return nil })

	bot.Run(context.Background()) // fica no ar e reconecta sozinho
}

A chave (amb_...) você cria no painel da comunidade, com o escopo rooms:control. O RoomID é o id da sala hospedada. Nunca coloque a chave no código-fonte: use variável de ambiente.

Eventos

bot.On<Evento>(func(<Tipo>)) entrega o evento como struct tipada, gerada do protocolo.

Método Quando
OnReady a auth foi aceita (também depois de reconectar); traz a sala e quem está nela
OnPlayerJoined / OnPlayerLeft alguém entrou / saiu
OnChatMessage mensagem no chat (Player é nil quando é do sistema)
OnMatchStarted / OnMatchEvent / OnMatchEnded partida: começou, lance (gol, cartão...), terminou com a súmula
OnRoomLive / OnRoomOff / OnRoomConfig a sala ligou, desligou ou mudou de config
OnRuleFired / OnScriptLog / OnScriptStopped regras sem código e script da sala
OnEvent qualquer um dos eventos da sala, cru (tipo + JSON)

Os handlers rodam um de cada vez, na ordem em que chegam. Handler que demora segura os próximos.

Comandos da sala

bot.Say(ctx, "Bem-vindos!")                          // atalho do Chat
bot.Kick(ctx, amebas.KickCommand{PlayerID: 7})
bot.Start(ctx, amebas.StartCommand{})
bot.Send(ctx, amebas.PauseCommand{Paused: &paused}) // qualquer comando do protocolo

Todo comando espera a resposta da sala: devolve nil se deu certo e *amebas.Error (Code: permission, invalid, rate_limited...) se foi recusado. Limite: 20 comandos de cara e 5 por segundo.

Comandos de chat (!gols 5)

bot.Command("gols", amebas.Cmd{
	Args:       amebas.Args("n", "int:1..20"),
	Cooldown:   10 * time.Second,
	Permission: amebas.PermissionStaff,
}, func(c *amebas.Ctx) error {
	c.Reply(fmt.Sprintf("Top %d: ...", c.Int("n")))
	return nil
})

Argumento errado, cooldown e permissão respondem sozinhos no chat, sem você escrever nada:

Ana:  !gols 99
Bot:  Valor inválido pra n: um número inteiro de 1 a 20. Uso: !gols <n>
Ana:  !gols 5          (e de novo, 3 s depois)
Bot:  Espere 7s pra usar !gols de novo.
A define (amebas.Cmd)

Um valor simples: guarde numa var e copie.

staff := amebas.Cmd{Permission: amebas.PermissionStaff, Cooldown: 30 * time.Second}
silence := staff                       // cópia
silence.Args = amebas.Args("motivo", "rest?")
bot.Command("silencio", silence, handler)
Campo O que faz
Args os argumentos, em ordem: amebas.Args("nome", "tipo", ...)
Cooldown, RoomCooldown espera por pessoa e da sala (time.Duration); amebas.NoCooldown tira o que veio dos padrões
StaffPays a staff também espera (por padrão é isenta)
Permission PermissionAll (padrão), PermissionStaff, PermissionOwner
Aliases outros nomes: []string{"g", "artilharia"}
Description, Hidden a linha do !ajuda, e tirar do !ajuda
Messages troca as respostas prontas (Usage, Cooldown, Permission)
Parse troca o parser padrão
Tipos de argumento

"tipo[:faixa][?|=padrão]" — o valor sai por c.Int("n"), c.Number, c.Text, c.Bool, c.Team, c.Person, e c.Has("n") diz se um opcional veio.

Escrito Aceita Leitura
"int", "int:1..20", "int:1..", "int:..20" inteiro, com faixa c.Int
"number:0..1" decimal (1,5 ou 1.5) c.Number
"text", "text:3..16" uma palavra (a faixa é o tamanho) c.Text
"rest" o resto da linha (tem que ser o último) c.Text
"bool" sim/não c.Bool
"team" a ou b c.Team
"player" #id, @nick, nick ou começo do nick c.Person
"azul|vermelho" uma das opções c.Text
"int:1..?" opcional c.Has + c.Int
"int:1..20=5" com padrão c.Int

Por extenso, em vez da forma curta: amebas.Arg{Name: "n", Type: "int", Min: &min, Max: &max}.

Padrões pra todos os comandos
bot.SetCommandDefaults(amebas.Defaults{Cooldown: 3 * time.Second, Permission: amebas.PermissionAll})

A define de cada comando sobrescreve o padrão. O !ajuda (também !help e !comandos) já vem pronto e lista só o que a pessoa pode usar; Defaults{NoHelp: true} desliga.

Parser próprio e "não contou"

Parse devolve os args, ou um *amebas.UsageError{Reason: "..."} que vira a resposta de uso (o handler não roda). Do handler, devolver amebas.ErrNotCounted diz "não usou": o cooldown não começa. Tudo isso está especificado em COMANDOS.md, igual nos SDKs de TypeScript e Python.

Quando algo falha

Situação O que acontece
a conexão caiu reconecta sozinho (espera de 1 s dobrando até 30 s)
chave errada, sem escopo, sala de outra comunidade não reconecta: Run devolve *amebas.Error com o Code
comando antes do ready *amebas.Error not_connected: "espere o ready"
erro de define (tipo que não existe, faixa torta) bot.Command dá panic na hora, dizendo o que está errado

Run(ctx) volta com nil quando o ctx termina. Opções: NoReconnect, InitialDelay, MaxDelay, MaxAttempts, CommandTimeout.

Tipos gerados

As structs do protocolo (ChatMessageEvent, KickCommand...) e os métodos On<Evento> e <Comando> são gerados de protocol/bot-protocol.schema.json, o schema do servidor (Amebas-Arena/protocol). Para atualizar: copie o schema novo pra protocol/ e rode go generate ./....

Desenvolvimento

go test -race ./...     # cliente + os casos de conformidade dos comandos

MIT.

Documentation

Overview

Package amebas é o SDK oficial do bot de sala do Amebas Arena: o cliente do WebSocket /v1/rooms/{roomId}/bot, com auth pela primeira mensagem, eventos tipados (OnChatMessage, OnPlayerJoined...), comandos que esperam o result e reconexão com espera crescente. Os tipos saem de protocol/bot-protocol.schema.json (go generate).

Index

Constants

View Source
const (

	// AuthTimeoutMs: sem auth nesse prazo, o servidor fecha com CloseUnauthorized.
	AuthTimeoutMs = 10000
	// RateLimitBurst e RateLimitPerSecond: o balde de comandos por conexão.
	RateLimitBurst     = 20
	RateLimitPerSecond = 5
	CloseInvalidRoom   = 4004
	CloseUnauthorized  = 4001
)

As regras do canal (x-amebas-bot do schema).

View Source
const NoCooldown time.Duration = -1

NoCooldown no Cooldown (ou no RoomCooldown) tira a espera que veio dos padrões. Zero herda o padrão.

Variables

View Source
var ErrNotCounted = errors.New("amebas: comando não contou")

ErrNotCounted: o handler não "usou" o comando, então o cooldown não começa.

Functions

func BotURL

func BotURL(baseURL, roomID string) (string, error)

BotURL monta a URL do WebSocket a partir do endereço da API (http vira ws, https vira wss; o prefixo /api fica).

func FormatWait

func FormatWait(d time.Duration) string

FormatWait: 9s, 1min, 1min 5s (sempre arredondando pra cima: "espere 1s" e não "0s").

Types

type AdminCommand

type AdminCommand struct {
	// Admin corresponds to the JSON schema field "admin".
	Admin bool `json:"admin"`

	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	PlayerID int `json:"playerId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type Arg

type Arg struct {
	Name string
	Spec string

	// por extenso (quando Spec está vazio)
	Type     string // int, number, text, rest, bool, player, team ou choice
	Min, Max *float64
	Choices  []string
	Optional bool
	Default  any
}

Arg é um argumento do comando. O caso simples é A("n", "int:1..20"); o por extenso usa Type, Min, Max...

Forma curta: tipo[:faixa][?|=padrão]. int, int:1..20, int:1.., int:..10, number:0..1, text, text:3..16, rest (o resto da linha, por último), bool, player (#id, @nick, nick ou começo do nick), team (a ou b) e opções como azul|vermelho. "?" deixa opcional (vem nil); "=5" dá o padrão.

func A

func A(name, spec string) Arg

A monta um argumento pela forma curta.

func Args

func Args(pairs ...string) []Arg

Args monta a lista de argumentos em ordem: Args("n", "int:1..20", "motivo", "rest?"). Número ímpar de itens é erro de programação e dá panic com a explicação.

type AuthMessage

type AuthMessage struct {
	// Key corresponds to the JSON schema field "key".
	Key string `json:"key"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type AutoCommand

type AutoCommand struct {
	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type BanCommand

type BanCommand struct {
	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	PlayerID int `json:"playerId"`

	// Scope corresponds to the JSON schema field "scope".
	Scope BanCommandScope `json:"scope,omitempty,omitzero"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type BanCommandScope

type BanCommandScope string
const BanCommandScopeCommunity BanCommandScope = "community"
const BanCommandScopeRoom BanCommandScope = "room"

type Bot

type Bot struct {

	// Commands é o sistema de comandos do chat (!gols...): Command e SetCommandDefaults usam este.
	Commands *Commands
	// contains filtered or unexported fields
}

Bot é a conexão de um bot com uma sala. Os handlers rodam na goroutine de leitura, um de cada vez: handler que demora segura os próximos eventos (mande comandos de outra goroutine se precisar esperar o result).

func New

func New(opts Options) (*Bot, error)

New monta o bot; a conexão abre no Run.

func (*Bot) Admin

func (b *Bot) Admin(ctx context.Context, cmd AdminCommand) error

Admin manda o comando "admin" e espera o result (o Type é preenchido aqui).

func (*Bot) Auto

func (b *Bot) Auto(ctx context.Context, cmd AutoCommand) error

Auto manda o comando "auto" e espera o result (o Type é preenchido aqui).

func (*Bot) Ban

func (b *Bot) Ban(ctx context.Context, cmd BanCommand) error

Ban manda o comando "ban" e espera o result (o Type é preenchido aqui).

func (*Bot) Bot

func (b *Bot) Bot(ctx context.Context, cmd BotCommand) error

Bot manda o comando "bot" e espera o result (o Type é preenchido aqui).

func (*Bot) Bots

func (b *Bot) Bots(ctx context.Context, cmd BotsCommand) error

Bots manda o comando "bots" e espera o result (o Type é preenchido aqui).

func (*Bot) Captain

func (b *Bot) Captain(ctx context.Context, cmd CaptainCommand) error

Captain manda o comando "captain" e espera o result (o Type é preenchido aqui).

func (*Bot) Chat

func (b *Bot) Chat(ctx context.Context, cmd ChatCommand) error

Chat manda o comando "chat" e espera o result (o Type é preenchido aqui).

func (*Bot) Command

func (b *Bot) Command(name string, define Cmd, handler Handler)

Command registra um comando do chat. O caso simples cabe numa linha; arg errado, cooldown e permissão respondem sozinhos:

bot.Command("regras", amebas.Cmd{}, func(c *amebas.Ctx) error { c.Reply("Sem xingar."); return nil })
bot.Command("gols", amebas.Cmd{Args: amebas.Args("n", "int:1..20"), Cooldown: 10 * time.Second, Permission: amebas.PermissionStaff}, ...)

Erro de define (tipo que não existe, faixa torta) dá panic na hora, com o que está errado e o jeito certo.

func (*Bot) Config

func (b *Bot) Config(ctx context.Context, cmd ConfigCommand) error

Config manda o comando "config" e espera o result (o Type é preenchido aqui).

func (*Bot) Confirm

func (b *Bot) Confirm(ctx context.Context, cmd ConfirmCommand) error

Confirm manda o comando "confirm" e espera o result (o Type é preenchido aqui).

func (*Bot) Finish

func (b *Bot) Finish(ctx context.Context, cmd FinishCommand) error

Finish manda o comando "finish" e espera o result (o Type é preenchido aqui).

func (*Bot) Kick

func (b *Bot) Kick(ctx context.Context, cmd KickCommand) error

Kick manda o comando "kick" e espera o result (o Type é preenchido aqui).

func (*Bot) Knockout

func (b *Bot) Knockout(ctx context.Context, cmd KnockoutCommand) error

Knockout manda o comando "knockout" e espera o result (o Type é preenchido aqui).

func (*Bot) Lock

func (b *Bot) Lock(ctx context.Context, cmd LockCommand) error

Lock manda o comando "lock" e espera o result (o Type é preenchido aqui).

func (*Bot) Move

func (b *Bot) Move(ctx context.Context, cmd MoveCommand) error

Move manda o comando "move" e espera o result (o Type é preenchido aqui).

func (*Bot) Mute

func (b *Bot) Mute(ctx context.Context, cmd MuteCommand) error

Mute manda o comando "mute" e espera o result (o Type é preenchido aqui).

func (*Bot) OnChatMessage

func (b *Bot) OnChatMessage(fn func(ChatMessageEvent))

OnChatMessage escuta o evento "chat.message".

func (*Bot) OnError

func (b *Bot) OnError(fn func(ErrorMessage))

OnError escuta o error que o servidor manda (auth recusada, JSON inválido).

func (*Bot) OnEvent

func (b *Bot) OnEvent(fn func(eventType string, raw json.RawMessage))

OnEvent escuta todo evento da sala, cru: o type e o JSON inteiro (os que o SDK ainda não conhece também chegam).

func (*Bot) OnMatchEnded

func (b *Bot) OnMatchEnded(fn func(MatchEndedEvent))

OnMatchEnded escuta o evento "match.ended".

func (*Bot) OnMatchEvent

func (b *Bot) OnMatchEvent(fn func(MatchEventEvent))

OnMatchEvent escuta o evento "match.event".

func (*Bot) OnMatchStarted

func (b *Bot) OnMatchStarted(fn func(MatchStartedEvent))

OnMatchStarted escuta o evento "match.started".

func (*Bot) OnPlayerJoined

func (b *Bot) OnPlayerJoined(fn func(PlayerJoinedEvent))

OnPlayerJoined escuta o evento "player.joined".

func (*Bot) OnPlayerLeft

func (b *Bot) OnPlayerLeft(fn func(PlayerLeftEvent))

OnPlayerLeft escuta o evento "player.left".

func (*Bot) OnReady

func (b *Bot) OnReady(fn func(ReadyMessage))

OnReady escuta a auth aceita (a cada conexão, inclusive depois de reconectar), com a sala e o estado ao vivo.

func (*Bot) OnRoomConfig

func (b *Bot) OnRoomConfig(fn func(RoomConfigEvent))

OnRoomConfig escuta o evento "room.config".

func (*Bot) OnRoomLive

func (b *Bot) OnRoomLive(fn func(RoomLiveEvent))

OnRoomLive escuta o evento "room.live".

func (*Bot) OnRoomOff

func (b *Bot) OnRoomOff(fn func(RoomOffEvent))

OnRoomOff escuta o evento "room.off".

func (*Bot) OnRuleFired

func (b *Bot) OnRuleFired(fn func(RuleFiredEvent))

OnRuleFired escuta o evento "rule.fired".

func (*Bot) OnScriptLog

func (b *Bot) OnScriptLog(fn func(ScriptLogEvent))

OnScriptLog escuta o evento "script.log".

func (*Bot) OnScriptStopped

func (b *Bot) OnScriptStopped(fn func(ScriptStoppedEvent))

OnScriptStopped escuta o evento "script.stopped".

func (*Bot) Pause

func (b *Bot) Pause(ctx context.Context, cmd PauseCommand) error

Pause manda o comando "pause" e espera o result (o Type é preenchido aqui).

func (*Bot) Pick

func (b *Bot) Pick(ctx context.Context, cmd PickCommand) error

Pick manda o comando "pick" e espera o result (o Type é preenchido aqui).

func (*Bot) Ready

func (b *Bot) Ready() bool

Ready diz se a auth já foi aceita nesta conexão (comandos só saem com ela).

func (*Bot) Restart

func (b *Bot) Restart(ctx context.Context, cmd RestartCommand) error

Restart manda o comando "restart" e espera o result (o Type é preenchido aqui).

func (*Bot) Run

func (b *Bot) Run(ctx context.Context) error

Run conecta e fica no ar até o ctx acabar (devolve nil) ou o bot parar de vez: auth recusada, sala inválida ou tentativas esgotadas (devolve o *Error). Caiu por outro motivo, volta sozinho com espera crescente.

func (*Bot) Say

func (b *Bot) Say(ctx context.Context, text string) error

Say manda uma linha no chat da sala (atalho do Chat).

func (*Bot) Send

func (b *Bot) Send(ctx context.Context, cmd any) error

Send manda um comando da sala (qualquer struct XxxCommand, com o Type preenchido) e espera o result: nil com ok, *Error com o code do servidor (invalid, permission, rate_limited...). Os métodos gerados (Chat, Kick...) preenchem o Type.

func (*Bot) SetCommandDefaults

func (b *Bot) SetCommandDefaults(d Defaults)

SetCommandDefaults define os padrões de todos os comandos (a define de cada um sobrescreve).

func (*Bot) Shuffle

func (b *Bot) Shuffle(ctx context.Context, cmd ShuffleCommand) error

Shuffle manda o comando "shuffle" e espera o result (o Type é preenchido aqui).

func (*Bot) Start

func (b *Bot) Start(ctx context.Context, cmd StartCommand) error

Start manda o comando "start" e espera o result (o Type é preenchido aqui).

func (*Bot) Stop

func (b *Bot) Stop(ctx context.Context, cmd StopCommand) error

Stop manda o comando "stop" e espera o result (o Type é preenchido aqui).

func (*Bot) Team

func (b *Bot) Team(ctx context.Context, cmd TeamCommand) error

Team manda o comando "team" e espera o result (o Type é preenchido aqui).

type BotCommand

type BotCommand struct {
	// Delta corresponds to the JSON schema field "delta".
	Delta interface{} `json:"delta"`

	// Slot corresponds to the JSON schema field "slot".
	Slot *int `json:"slot,omitempty,omitzero"`

	// Team corresponds to the JSON schema field "team".
	Team BotCommandTeam `json:"team"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type BotCommandTeam

type BotCommandTeam string
const BotCommandTeamA BotCommandTeam = "a"
const BotCommandTeamB BotCommandTeam = "b"

type BotsCommand

type BotsCommand struct {
	// Action corresponds to the JSON schema field "action".
	Action BotsCommandAction `json:"action"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type BotsCommandAction

type BotsCommandAction string
const BotsCommandActionClear BotsCommandAction = "clear"
const BotsCommandActionFill BotsCommandAction = "fill"

type CaptainCommand

type CaptainCommand struct {
	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	PlayerID int `json:"playerId"`

	// Team corresponds to the JSON schema field "team".
	Team CaptainCommandTeam `json:"team"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type CaptainCommandTeam

type CaptainCommandTeam string
const CaptainCommandTeamA CaptainCommandTeam = "a"
const CaptainCommandTeamB CaptainCommandTeam = "b"

type ChatCommand

type ChatCommand struct {
	// Text corresponds to the JSON schema field "text".
	Text string `json:"text"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type ChatMessageEvent

type ChatMessageEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Player corresponds to the JSON schema field "player".
	Player *ChatMessageEventPlayer `json:"player"`

	// Role corresponds to the JSON schema field "role".
	Role *ChatMessageEventRole `json:"role,omitempty,omitzero"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Text corresponds to the JSON schema field "text".
	Text string `json:"text"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type ChatMessageEventPlayer

type ChatMessageEventPlayer struct {
	// AccountID corresponds to the JSON schema field "accountId".
	AccountID PlayerRefAccountID `json:"accountId"`

	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	ID int `json:"id"`

	// Nick corresponds to the JSON schema field "nick".
	Nick string `json:"nick"`
}

type ChatMessageEventPlayer_0

type ChatMessageEventPlayer_0 = PlayerRef

type ChatMessageEventRole

type ChatMessageEventRole string
const ChatMessageEventRoleOwner ChatMessageEventRole = "owner"
const ChatMessageEventRolePlayer ChatMessageEventRole = "player"
const ChatMessageEventRoleStaff ChatMessageEventRole = "staff"

type ClientMessage

type ClientMessage interface{}

O que o bot manda: a auth (primeira mensagem) e, depois dela, comandos. Todo comando aceita um campo ref (texto até 64), que volta no result dele (x-amebas-bot.commandRef).

type Cmd

type Cmd struct {
	Aliases []string
	// Description é a linha do !ajuda.
	Description string
	// Hidden tira o comando do !ajuda.
	Hidden bool
	Args   []Arg

	Cooldown     time.Duration
	RoomCooldown time.Duration
	StaffPays    bool
	Permission   Permission
	Messages     Messages

	// Parse troca o parser padrão: devolve os args, ou um erro (vira a resposta de uso com o texto do erro).
	Parse func(ParseInput) (map[string]any, error)
}

Cmd é a define de um comando. Um valor simples: dá pra guardar numa var e copiar (staff := Cmd{Permission: PermissionStaff}; c := staff; c.Args = ...).

type CommandPlayer

type CommandPlayer struct {
	Person
	Role Role
}

CommandPlayer é quem mandou o comando: a Person e o papel na sala.

type Commands

type Commands struct {
	// contains filtered or unexported fields
}

Commands guarda os comandos de uma sala (ou de um bot), decide o que cada mensagem é e controla os cooldowns.

func NewCommands

func NewCommands() *Commands

NewCommands cria um sistema de comandos vazio.

func (*Commands) Add

func (c *Commands) Add(name string, define Cmd, handler Handler) error

Add registra um comando; o mesmo nome de novo substitui o anterior. Erro de define volta com o que está errado e o jeito certo.

func (*Commands) Dispatch

func (c *Commands) Dispatch(ctx context.Context, in MatchInput, reply func(string)) (bool, error)

Dispatch roda a mensagem: responde (reply) ou chama o handler do comando e fecha o cooldown. Devolve se era comando. O handler que devolve *UsageError vira a resposta de uso (e não conta); ErrNotCounted devolve o cooldown; outro erro devolve o cooldown e sobe.

func (*Commands) Match

func (c *Commands) Match(in MatchInput) *Decision

Match decide o que a mensagem é: nil = não é comando daqui.

func (*Commands) SetDefaults

func (c *Commands) SetDefaults(d Defaults)

SetDefaults define os padrões de todos os comandos (campos vazios não mudam o que já foi definido).

func (*Commands) Triggers

func (c *Commands) Triggers() []string

Triggers: tudo que dispara um comando daqui, com o prefixo (nomes, atalhos e o !ajuda embutido).

type ConfigCommand

type ConfigCommand struct {
	// Config corresponds to the JSON schema field "config".
	Config HostedRoomConfigInput `json:"config"`

	// IsPublic corresponds to the JSON schema field "isPublic".
	IsPublic *bool `json:"isPublic,omitempty,omitzero"`

	// Name corresponds to the JSON schema field "name".
	Name *string `json:"name,omitempty,omitzero"`

	// Password corresponds to the JSON schema field "password".
	Password interface{} `json:"password,omitempty,omitzero"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type ConfigCommandPassword_0

type ConfigCommandPassword_0 *string

type ConfirmCommand

type ConfirmCommand struct {
	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type Ctx

type Ctx struct {
	Player CommandPlayer
	// Args já convertidos; use os atalhos Int, Number, Text, Bool, Team, Person.
	Args map[string]any
	// Command é o nome registrado (sem o prefixo); Alias, o que a pessoa digitou.
	Command string
	Alias   string
	Words   []string
	Rest    string
	// contains filtered or unexported fields
}

Ctx é o que o handler recebe.

func (*Ctx) Bool

func (c *Ctx) Bool(name string) bool

Bool devolve o argumento sim/não.

func (*Ctx) Has

func (c *Ctx) Has(name string) bool

Has diz se o argumento veio (opcional sem valor não vem).

func (*Ctx) Int

func (c *Ctx) Int(name string) int

Int devolve o argumento inteiro (0 se faltou).

func (*Ctx) Number

func (c *Ctx) Number(name string) float64

Number devolve o argumento numérico (0 se faltou).

func (*Ctx) Person

func (c *Ctx) Person(name string) *Person

Person devolve o jogador do argumento player (nil se faltou).

func (*Ctx) Reply

func (c *Ctx) Reply(text string)

Reply responde pra quem mandou (no bot, é uma linha no chat da sala).

func (*Ctx) Team

func (c *Ctx) Team(name string) string

Team devolve "a" ou "b".

func (*Ctx) Text

func (c *Ctx) Text(name string) string

Text devolve o argumento de texto, rest ou opção ("" se faltou).

type Decision

type Decision struct {
	Replies []string

	// Finish fecha o uso de um comando: counted false devolve o cooldown.
	Finish func(counted bool)
	// contains filtered or unexported fields
}

Decision é o que fazer com a mensagem: rodar um comando, ou responder.

type Defaults

type Defaults struct {
	// Prefix é o que vem antes do nome; padrão "!".
	Prefix       string
	Cooldown     time.Duration
	RoomCooldown time.Duration
	// StaffPays: a staff também espera o cooldown (por padrão é isenta).
	StaffPays  bool
	Permission Permission
	Messages   Messages
	// NoHelp desliga o !ajuda embutido.
	NoHelp bool
}

Defaults são os padrões de todos os comandos; a define de cada comando sobrescreve campo a campo.

type Error

type Error struct {
	Code    string
	Message string
}

Error é o erro de um comando (o code e a mensagem do result) ou do canal.

func (*Error) Error

func (e *Error) Error() string

type ErrorMessage

type ErrorMessage struct {
	// Code corresponds to the JSON schema field "code".
	Code string `json:"code"`

	// Message corresponds to the JSON schema field "message".
	Message string `json:"message"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type FinishCommand

type FinishCommand struct {
	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type Handler

type Handler func(*Ctx) error

Handler é a função do comando. Devolver ErrNotCounted não gasta o cooldown; devolver *UsageError responde o uso com o motivo; outro erro sobe pro dispatch.

type HostBot

type HostBot struct {
	// Afk corresponds to the JSON schema field "afk".
	Afk *HostBotAfk `json:"afk,omitempty,omitzero"`

	// ChatRules corresponds to the JSON schema field "chatRules".
	ChatRules *HostBotChatRules `json:"chatRules,omitempty,omitzero"`

	// Notices corresponds to the JSON schema field "notices".
	Notices *HostBotNotices `json:"notices,omitempty,omitzero"`

	// Welcome corresponds to the JSON schema field "welcome".
	Welcome *HostBotWelcome `json:"welcome,omitempty,omitzero"`
}

type HostBotAfk

type HostBotAfk struct {
	// Action corresponds to the JSON schema field "action".
	Action HostBotAfkAction `json:"action"`

	// Seconds corresponds to the JSON schema field "seconds".
	Seconds int `json:"seconds"`
}

type HostBotAfkAction

type HostBotAfkAction string
const HostBotAfkActionKick HostBotAfkAction = "kick"
const HostBotAfkActionSpectate HostBotAfkAction = "spectate"

type HostBotChatRules

type HostBotChatRules struct {
	// Action corresponds to the JSON schema field "action".
	Action HostBotChatRulesAction `json:"action"`

	// Words corresponds to the JSON schema field "words".
	Words []string `json:"words"`
}

type HostBotChatRulesAction

type HostBotChatRulesAction string
const HostBotChatRulesActionKick HostBotChatRulesAction = "kick"
const HostBotChatRulesActionMute HostBotChatRulesAction = "mute"

type HostBotNotices

type HostBotNotices struct {
	// EveryMinutes corresponds to the JSON schema field "everyMinutes".
	EveryMinutes int `json:"everyMinutes"`

	// Messages corresponds to the JSON schema field "messages".
	Messages []string `json:"messages"`
}

type HostBotWelcome

type HostBotWelcome struct {
	// Text corresponds to the JSON schema field "text".
	Text string `json:"text"`
}

type HostedRoom

type HostedRoom struct {
	// AlwaysOn corresponds to the JSON schema field "alwaysOn".
	AlwaysOn bool `json:"alwaysOn"`

	// Código fixo da sala: o id da comunidade, um hífen e um apelido de 1 a 16 letras
	// minúsculas, números e hífen.
	Code string `json:"code"`

	// Slug da comunidade, definido na criação e imutável depois dela.
	CommunityID string `json:"communityId"`

	// Config corresponds to the JSON schema field "config".
	Config HostedRoomConfig `json:"config"`

	// CreatedAt corresponds to the JSON schema field "createdAt".
	CreatedAt int `json:"createdAt"`

	// Desired corresponds to the JSON schema field "desired".
	Desired HostedRoomDesired `json:"desired"`

	// HasPassword corresponds to the JSON schema field "hasPassword".
	HasPassword bool `json:"hasPassword"`

	// HostBot corresponds to the JSON schema field "hostBot".
	HostBot *HostedRoomHostBot `json:"hostBot,omitempty,omitzero"`

	// ID corresponds to the JSON schema field "id".
	ID string `json:"id"`

	// IsPublic corresponds to the JSON schema field "isPublic".
	IsPublic bool `json:"isPublic"`

	// Live corresponds to the JSON schema field "live".
	Live *HostedRoomLive `json:"live,omitempty,omitzero"`

	// MaxPlayers corresponds to the JSON schema field "maxPlayers".
	MaxPlayers int `json:"maxPlayers"`

	// Name corresponds to the JSON schema field "name".
	Name string `json:"name"`

	// PaidUntil corresponds to the JSON schema field "paidUntil".
	PaidUntil interface{} `json:"paidUntil"`

	// Plan corresponds to the JSON schema field "plan".
	Plan HostedRoomPlan `json:"plan"`

	// Rules corresponds to the JSON schema field "rules".
	Rules *HostedRoomRules `json:"rules,omitempty,omitzero"`

	// Script corresponds to the JSON schema field "script".
	Script *HostedRoomScript `json:"script,omitempty,omitzero"`

	// Status corresponds to the JSON schema field "status".
	Status HostedRoomStatus `json:"status"`

	// Teams corresponds to the JSON schema field "teams".
	Teams *HostedRoomTeams `json:"teams,omitempty,omitzero"`

	// UpdatedAt corresponds to the JSON schema field "updatedAt".
	UpdatedAt int `json:"updatedAt"`
}

type HostedRoomConfig

type HostedRoomConfig struct {
	// Ball corresponds to the JSON schema field "ball".
	Ball *string `json:"ball,omitempty,omitzero"`

	// CommunityMap corresponds to the JSON schema field "communityMap".
	CommunityMap *string `json:"communityMap,omitempty,omitzero"`

	// Format corresponds to the JSON schema field "format".
	Format *HostedRoomConfigFormat `json:"format,omitempty,omitzero"`

	// FormatParams corresponds to the JSON schema field "formatParams".
	FormatParams HostedRoomConfigFormatParams `json:"formatParams,omitempty,omitzero"`

	// Gameplay corresponds to the JSON schema field "gameplay".
	Gameplay *HostedRoomConfigGameplay `json:"gameplay,omitempty,omitzero"`

	// Goalkeeper corresponds to the JSON schema field "goalkeeper".
	Goalkeeper *int `json:"goalkeeper,omitempty,omitzero"`

	// Goals corresponds to the JSON schema field "goals".
	Goals *int `json:"goals,omitempty,omitzero"`

	// Keepers corresponds to the JSON schema field "keepers".
	Keepers *bool `json:"keepers,omitempty,omitzero"`

	// Map corresponds to the JSON schema field "map".
	Map *string `json:"map,omitempty,omitzero"`

	// Mode corresponds to the JSON schema field "mode".
	Mode *HostedRoomConfigMode `json:"mode,omitempty,omitzero"`

	// ModeParams corresponds to the JSON schema field "modeParams".
	ModeParams HostedRoomConfigModeParams `json:"modeParams,omitempty,omitzero"`

	// Preset corresponds to the JSON schema field "preset".
	Preset *string `json:"preset,omitempty,omitzero"`

	// TeamSize corresponds to the JSON schema field "teamSize".
	TeamSize *int `json:"teamSize,omitempty,omitzero"`

	// Time corresponds to the JSON schema field "time".
	Time *int `json:"time,omitempty,omitzero"`
}

type HostedRoomConfigFormat

type HostedRoomConfigFormat string
const HostedRoomConfigFormatEveryone HostedRoomConfigFormat = "everyone"
const HostedRoomConfigFormatKnockout HostedRoomConfigFormat = "knockout"
const HostedRoomConfigFormatManual HostedRoomConfigFormat = "manual"
const HostedRoomConfigFormatOpen HostedRoomConfigFormat = "open"
const HostedRoomConfigFormatQueue HostedRoomConfigFormat = "queue"
const HostedRoomConfigFormatRounds HostedRoomConfigFormat = "rounds"

type HostedRoomConfigFormatParams

type HostedRoomConfigFormatParams map[string]interface{}

type HostedRoomConfigGameplay

type HostedRoomConfigGameplay struct {
	// AccelTime corresponds to the JSON schema field "accelTime".
	AccelTime *float64 `json:"accelTime,omitempty,omitzero"`

	// AimAssist corresponds to the JSON schema field "aimAssist".
	AimAssist *float64 `json:"aimAssist,omitempty,omitzero"`

	// BallAirFriction corresponds to the JSON schema field "ballAirFriction".
	BallAirFriction *float64 `json:"ballAirFriction,omitempty,omitzero"`

	// BallBounce corresponds to the JSON schema field "ballBounce".
	BallBounce *float64 `json:"ballBounce,omitempty,omitzero"`

	// BallFriction corresponds to the JSON schema field "ballFriction".
	BallFriction *float64 `json:"ballFriction,omitempty,omitzero"`

	// BallMass corresponds to the JSON schema field "ballMass".
	BallMass *float64 `json:"ballMass,omitempty,omitzero"`

	// BallSize corresponds to the JSON schema field "ballSize".
	BallSize *float64 `json:"ballSize,omitempty,omitzero"`

	// ControlSpin corresponds to the JSON schema field "controlSpin".
	ControlSpin *float64 `json:"controlSpin,omitempty,omitzero"`

	// Gravity corresponds to the JSON schema field "gravity".
	Gravity *float64 `json:"gravity,omitempty,omitzero"`

	// KickPower corresponds to the JSON schema field "kickPower".
	KickPower *float64 `json:"kickPower,omitempty,omitzero"`

	// MaxSpeed corresponds to the JSON schema field "maxSpeed".
	MaxSpeed *float64 `json:"maxSpeed,omitempty,omitzero"`

	// PlayerSize corresponds to the JSON schema field "playerSize".
	PlayerSize *float64 `json:"playerSize,omitempty,omitzero"`

	// Turning corresponds to the JSON schema field "turning".
	Turning *float64 `json:"turning,omitempty,omitzero"`
}

type HostedRoomConfigInput

type HostedRoomConfigInput struct {
	// Ball corresponds to the JSON schema field "ball".
	Ball *string `json:"ball,omitempty,omitzero"`

	// CommunityMap corresponds to the JSON schema field "communityMap".
	CommunityMap *string `json:"communityMap,omitempty,omitzero"`

	// Format corresponds to the JSON schema field "format".
	Format *HostedRoomConfigInputFormat `json:"format,omitempty,omitzero"`

	// FormatParams corresponds to the JSON schema field "formatParams".
	FormatParams HostedRoomConfigInputFormatParams `json:"formatParams,omitempty,omitzero"`

	// Gameplay corresponds to the JSON schema field "gameplay".
	Gameplay *HostedRoomConfigInputGameplay `json:"gameplay,omitempty,omitzero"`

	// Goalkeeper corresponds to the JSON schema field "goalkeeper".
	Goalkeeper *int `json:"goalkeeper,omitempty,omitzero"`

	// Goals corresponds to the JSON schema field "goals".
	Goals *int `json:"goals,omitempty,omitzero"`

	// Keepers corresponds to the JSON schema field "keepers".
	Keepers *bool `json:"keepers,omitempty,omitzero"`

	// Map corresponds to the JSON schema field "map".
	Map *string `json:"map,omitempty,omitzero"`

	// Mode corresponds to the JSON schema field "mode".
	Mode *HostedRoomConfigInputMode `json:"mode,omitempty,omitzero"`

	// ModeParams corresponds to the JSON schema field "modeParams".
	ModeParams HostedRoomConfigInputModeParams `json:"modeParams,omitempty,omitzero"`

	// Preset corresponds to the JSON schema field "preset".
	Preset *string `json:"preset,omitempty,omitzero"`

	// TeamSize corresponds to the JSON schema field "teamSize".
	TeamSize *int `json:"teamSize,omitempty,omitzero"`

	// Time corresponds to the JSON schema field "time".
	Time *int `json:"time,omitempty,omitzero"`
}

type HostedRoomConfigInputFormat

type HostedRoomConfigInputFormat string
const HostedRoomConfigInputFormatEveryone HostedRoomConfigInputFormat = "everyone"
const HostedRoomConfigInputFormatKnockout HostedRoomConfigInputFormat = "knockout"
const HostedRoomConfigInputFormatManual HostedRoomConfigInputFormat = "manual"
const HostedRoomConfigInputFormatOpen HostedRoomConfigInputFormat = "open"
const HostedRoomConfigInputFormatQueue HostedRoomConfigInputFormat = "queue"
const HostedRoomConfigInputFormatRounds HostedRoomConfigInputFormat = "rounds"

type HostedRoomConfigInputFormatParams

type HostedRoomConfigInputFormatParams map[string]interface{}

type HostedRoomConfigInputGameplay

type HostedRoomConfigInputGameplay struct {
	// AccelTime corresponds to the JSON schema field "accelTime".
	AccelTime *float64 `json:"accelTime,omitempty,omitzero"`

	// AimAssist corresponds to the JSON schema field "aimAssist".
	AimAssist *float64 `json:"aimAssist,omitempty,omitzero"`

	// BallAirFriction corresponds to the JSON schema field "ballAirFriction".
	BallAirFriction *float64 `json:"ballAirFriction,omitempty,omitzero"`

	// BallBounce corresponds to the JSON schema field "ballBounce".
	BallBounce *float64 `json:"ballBounce,omitempty,omitzero"`

	// BallFriction corresponds to the JSON schema field "ballFriction".
	BallFriction *float64 `json:"ballFriction,omitempty,omitzero"`

	// BallMass corresponds to the JSON schema field "ballMass".
	BallMass *float64 `json:"ballMass,omitempty,omitzero"`

	// BallSize corresponds to the JSON schema field "ballSize".
	BallSize *float64 `json:"ballSize,omitempty,omitzero"`

	// ControlSpin corresponds to the JSON schema field "controlSpin".
	ControlSpin *float64 `json:"controlSpin,omitempty,omitzero"`

	// Gravity corresponds to the JSON schema field "gravity".
	Gravity *float64 `json:"gravity,omitempty,omitzero"`

	// KickPower corresponds to the JSON schema field "kickPower".
	KickPower *float64 `json:"kickPower,omitempty,omitzero"`

	// MaxSpeed corresponds to the JSON schema field "maxSpeed".
	MaxSpeed *float64 `json:"maxSpeed,omitempty,omitzero"`

	// PlayerSize corresponds to the JSON schema field "playerSize".
	PlayerSize *float64 `json:"playerSize,omitempty,omitzero"`

	// Turning corresponds to the JSON schema field "turning".
	Turning *float64 `json:"turning,omitempty,omitzero"`
}

type HostedRoomConfigInputMode

type HostedRoomConfigInputMode string
const HostedRoomConfigInputModeCtf HostedRoomConfigInputMode = "ctf"
const HostedRoomConfigInputModeDodgeball HostedRoomConfigInputMode = "dodgeball"
const HostedRoomConfigInputModeFootball HostedRoomConfigInputMode = "football"
const HostedRoomConfigInputModePenalty HostedRoomConfigInputMode = "penalty"
const HostedRoomConfigInputModeRace HostedRoomConfigInputMode = "race"
const HostedRoomConfigInputModeTenman HostedRoomConfigInputMode = "tenman"
const HostedRoomConfigInputModeVolleyball HostedRoomConfigInputMode = "volleyball"

type HostedRoomConfigInputModeParams

type HostedRoomConfigInputModeParams map[string]interface{}

type HostedRoomConfigMode

type HostedRoomConfigMode string
const HostedRoomConfigModeCtf HostedRoomConfigMode = "ctf"
const HostedRoomConfigModeDodgeball HostedRoomConfigMode = "dodgeball"
const HostedRoomConfigModeFootball HostedRoomConfigMode = "football"
const HostedRoomConfigModePenalty HostedRoomConfigMode = "penalty"
const HostedRoomConfigModeRace HostedRoomConfigMode = "race"
const HostedRoomConfigModeTenman HostedRoomConfigMode = "tenman"
const HostedRoomConfigModeVolleyball HostedRoomConfigMode = "volleyball"

type HostedRoomConfigModeParams

type HostedRoomConfigModeParams map[string]interface{}

type HostedRoomDesired

type HostedRoomDesired string
const HostedRoomDesiredOff HostedRoomDesired = "off"
const HostedRoomDesiredOn HostedRoomDesired = "on"

type HostedRoomHostBot

type HostedRoomHostBot struct {
	// Afk corresponds to the JSON schema field "afk".
	Afk *HostBotAfk `json:"afk,omitempty,omitzero"`

	// ChatRules corresponds to the JSON schema field "chatRules".
	ChatRules *HostBotChatRules `json:"chatRules,omitempty,omitzero"`

	// Notices corresponds to the JSON schema field "notices".
	Notices *HostBotNotices `json:"notices,omitempty,omitzero"`

	// Welcome corresponds to the JSON schema field "welcome".
	Welcome *HostBotWelcome `json:"welcome,omitempty,omitzero"`
}

type HostedRoomHostBot_0

type HostedRoomHostBot_0 = HostBot

type HostedRoomLive

type HostedRoomLive struct {
	// Address corresponds to the JSON schema field "address".
	Address HostedRoomLive_0Address `json:"address"`

	// Code corresponds to the JSON schema field "code".
	Code string `json:"code"`

	// Players corresponds to the JSON schema field "players".
	Players int `json:"players"`
}

type HostedRoomLive_0

type HostedRoomLive_0 struct {
	// Address corresponds to the JSON schema field "address".
	Address HostedRoomLive_0Address `json:"address"`

	// Code corresponds to the JSON schema field "code".
	Code string `json:"code"`

	// Players corresponds to the JSON schema field "players".
	Players int `json:"players"`
}

type HostedRoomLive_0Address

type HostedRoomLive_0Address *string

type HostedRoomPaidUntil_0

type HostedRoomPaidUntil_0 *int

type HostedRoomPlan

type HostedRoomPlan string
const HostedRoomPlanFull HostedRoomPlan = "full"
const HostedRoomPlanSimple HostedRoomPlan = "simple"

type HostedRoomRules

type HostedRoomRules []Rule

type HostedRoomRules_0

type HostedRoomRules_0 = RoomRules

type HostedRoomScript

type HostedRoomScript struct {
	// Enabled corresponds to the JSON schema field "enabled".
	Enabled bool `json:"enabled"`

	// Source corresponds to the JSON schema field "source".
	Source string `json:"source"`
}

type HostedRoomScript_0

type HostedRoomScript_0 = RoomScript

type HostedRoomStatus

type HostedRoomStatus string
const HostedRoomStatusLive HostedRoomStatus = "live"
const HostedRoomStatusOff HostedRoomStatus = "off"
const HostedRoomStatusStarting HostedRoomStatus = "starting"

type HostedRoomTeams

type HostedRoomTeams struct {
	// A corresponds to the JSON schema field "a".
	A TeamStyle `json:"a"`

	// B corresponds to the JSON schema field "b".
	B TeamStyle `json:"b"`
}

O uniforme do time da casa (a) e o do time visitante (b).

type HostedRoomTeams_0

type HostedRoomTeams_0 = RoomTeams

type KickCommand

type KickCommand struct {
	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	PlayerID int `json:"playerId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type KnockoutCommand

type KnockoutCommand struct {
	// Action corresponds to the JSON schema field "action".
	Action KnockoutCommandAction `json:"action"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type KnockoutCommandAction

type KnockoutCommandAction string
const KnockoutCommandActionLock KnockoutCommandAction = "lock"
const KnockoutCommandActionReset KnockoutCommandAction = "reset"

type LivePlayer

type LivePlayer struct {
	// AccountID corresponds to the JSON schema field "accountId".
	AccountID LivePlayerAccountID `json:"accountId"`

	// Admin corresponds to the JSON schema field "admin".
	Admin bool `json:"admin"`

	// Connection corresponds to the JSON schema field "connection".
	Connection LivePlayerConnection `json:"connection"`

	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	ID int `json:"id"`

	// Nick corresponds to the JSON schema field "nick".
	Nick string `json:"nick"`

	// Place corresponds to the JSON schema field "place".
	Place LivePlayerPlace `json:"place"`
}

type LivePlayerAccountID

type LivePlayerAccountID *string

type LivePlayerConnection

type LivePlayerConnection string
const LivePlayerConnectionAfk LivePlayerConnection = "afk"
const LivePlayerConnectionOk LivePlayerConnection = "ok"
const LivePlayerConnectionReconnecting LivePlayerConnection = "reconnecting"

type LivePlayerPlace

type LivePlayerPlace string
const LivePlayerPlaceA LivePlayerPlace = "a"
const LivePlayerPlaceB LivePlayerPlace = "b"
const LivePlayerPlaceStands LivePlayerPlace = "stands"

type LiveRoom

type LiveRoom struct {
	// Address corresponds to the JSON schema field "address".
	Address LiveRoomAddress `json:"address"`

	// Code corresponds to the JSON schema field "code".
	Code string `json:"code"`

	// Map corresponds to the JSON schema field "map".
	Map string `json:"map"`

	// Mode corresponds to the JSON schema field "mode".
	Mode string `json:"mode"`

	// Phase corresponds to the JSON schema field "phase".
	Phase LiveRoomPhase `json:"phase"`

	// Players corresponds to the JSON schema field "players".
	Players []LivePlayer `json:"players"`

	// Score corresponds to the JSON schema field "score".
	Score LiveRoomScore `json:"score"`
}

type LiveRoomAddress

type LiveRoomAddress *string

type LiveRoomPhase

type LiveRoomPhase string
const LiveRoomPhasePaused LiveRoomPhase = "paused"
const LiveRoomPhasePlaying LiveRoomPhase = "playing"
const LiveRoomPhaseStopped LiveRoomPhase = "stopped"

type LiveRoomScore

type LiveRoomScore struct {
	// A corresponds to the JSON schema field "a".
	A int `json:"a"`

	// B corresponds to the JSON schema field "b".
	B int `json:"b"`
}

type LockCommand

type LockCommand struct {
	// Locked corresponds to the JSON schema field "locked".
	Locked bool `json:"locked"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type Match

type Match struct {
	// DurationSeconds corresponds to the JSON schema field "durationSeconds".
	DurationSeconds int `json:"durationSeconds"`

	// Format corresponds to the JSON schema field "format".
	Format MatchFormat `json:"format"`

	// HostedRoomID corresponds to the JSON schema field "hostedRoomId".
	HostedRoomID MatchHostedRoomID `json:"hostedRoomId"`

	// ID corresponds to the JSON schema field "id".
	ID string `json:"id"`

	// Map corresponds to the JSON schema field "map".
	Map MatchMap `json:"map"`

	// Mode corresponds to the JSON schema field "mode".
	Mode string `json:"mode"`

	// PlayedAt corresponds to the JSON schema field "playedAt".
	PlayedAt int `json:"playedAt"`

	// Players corresponds to the JSON schema field "players".
	Players []MatchPlayersElem `json:"players"`

	// Room corresponds to the JSON schema field "room".
	Room string `json:"room"`

	// Rules corresponds to the JSON schema field "rules".
	Rules *bool `json:"rules,omitempty,omitzero"`

	// ScoreA corresponds to the JSON schema field "scoreA".
	ScoreA int `json:"scoreA"`

	// ScoreB corresponds to the JSON schema field "scoreB".
	ScoreB int `json:"scoreB"`
}

type MatchEndedEvent

type MatchEndedEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Match corresponds to the JSON schema field "match".
	Match Match `json:"match"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type MatchEventEvent

type MatchEventEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Event corresponds to the JSON schema field "event".
	Event MatchEventEventEvent `json:"event"`

	// Player corresponds to the JSON schema field "player".
	Player *MatchEventEventPlayer `json:"player"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Team corresponds to the JSON schema field "team".
	Team interface{} `json:"team"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type MatchEventEventEvent

type MatchEventEventEvent string
const MatchEventEventEventBlock MatchEventEventEvent = "Block"
const MatchEventEventEventCard MatchEventEventEvent = "Card"
const MatchEventEventEventEliminated MatchEventEventEvent = "Eliminated"
const MatchEventEventEventFault MatchEventEventEvent = "Fault"
const MatchEventEventEventFinished MatchEventEventEvent = "Finished"
const MatchEventEventEventFlagCaptured MatchEventEventEvent = "FlagCaptured"
const MatchEventEventEventFlagDropped MatchEventEventEvent = "FlagDropped"
const MatchEventEventEventFlagTaken MatchEventEventEvent = "FlagTaken"
const MatchEventEventEventFoul MatchEventEventEvent = "Foul"
const MatchEventEventEventFrozen MatchEventEventEvent = "Frozen"
const MatchEventEventEventGoal MatchEventEventEvent = "Goal"
const MatchEventEventEventLapCompleted MatchEventEventEvent = "LapCompleted"
const MatchEventEventEventOut MatchEventEventEvent = "Out"
const MatchEventEventEventPenaltyKick MatchEventEventEvent = "PenaltyKick"
const MatchEventEventEventPoint MatchEventEventEvent = "Point"
const MatchEventEventEventPost MatchEventEventEvent = "Post"
const MatchEventEventEventRevived MatchEventEventEvent = "Revived"
const MatchEventEventEventRoundEnd MatchEventEventEvent = "RoundEnd"
const MatchEventEventEventRoundStart MatchEventEventEvent = "RoundStart"
const MatchEventEventEventSave MatchEventEventEvent = "Save"
const MatchEventEventEventUnfrozen MatchEventEventEvent = "Unfrozen"

type MatchEventEventPlayer

type MatchEventEventPlayer struct {
	// AccountID corresponds to the JSON schema field "accountId".
	AccountID PlayerRefAccountID `json:"accountId"`

	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	ID int `json:"id"`

	// Nick corresponds to the JSON schema field "nick".
	Nick string `json:"nick"`
}

type MatchEventEventPlayer_0

type MatchEventEventPlayer_0 = PlayerRef

type MatchEventEventTeam_0

type MatchEventEventTeam_0 string
const MatchEventEventTeam_0_A MatchEventEventTeam_0 = "a"
const MatchEventEventTeam_0_B MatchEventEventTeam_0 = "b"

type MatchFormat

type MatchFormat *string

type MatchHostedRoomID

type MatchHostedRoomID *string

type MatchInput

type MatchInput struct {
	Text    string
	Player  CommandPlayer
	Now     time.Duration
	Players []Person
}

MatchInput é a mensagem, quem mandou, o relógio e quem está na sala (pro argumento player).

type MatchMap

type MatchMap *string

type MatchPlayersElem

type MatchPlayersElem struct {
	// AccountID corresponds to the JSON schema field "accountId".
	AccountID MatchPlayersElemAccountID `json:"accountId"`

	// Nick corresponds to the JSON schema field "nick".
	Nick string `json:"nick"`

	// Outcome corresponds to the JSON schema field "outcome".
	Outcome interface{} `json:"outcome"`

	// Stats corresponds to the JSON schema field "stats".
	Stats MatchPlayersElemStats `json:"stats"`

	// Team corresponds to the JSON schema field "team".
	Team MatchPlayersElemTeam `json:"team"`
}

type MatchPlayersElemAccountID

type MatchPlayersElemAccountID *string

type MatchPlayersElemOutcome_0

type MatchPlayersElemOutcome_0 string
const MatchPlayersElemOutcome_0_Draw MatchPlayersElemOutcome_0 = "draw"
const MatchPlayersElemOutcome_0_Loss MatchPlayersElemOutcome_0 = "loss"
const MatchPlayersElemOutcome_0_Win MatchPlayersElemOutcome_0 = "win"

type MatchPlayersElemStats

type MatchPlayersElemStats map[string]float64

type MatchPlayersElemTeam

type MatchPlayersElemTeam string
const MatchPlayersElemTeamA MatchPlayersElemTeam = "a"
const MatchPlayersElemTeamB MatchPlayersElemTeam = "b"

type MatchStartedEvent

type MatchStartedEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Map corresponds to the JSON schema field "map".
	Map string `json:"map"`

	// Mode corresponds to the JSON schema field "mode".
	Mode string `json:"mode"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type Messages

type Messages struct {
	Usage      string
	Cooldown   string
	Permission string
}

Messages são as respostas prontas, com {command} (!gols), {nick}, {usage} (!gols <n>) e, em cada uma: {reason} no Usage, {left} (9s, 1min 5s) no Cooldown e {who} (a staff, o dono da sala) no Permission. Vazio herda o padrão.

type MoveCommand

type MoveCommand struct {
	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	PlayerID int `json:"playerId"`

	// Slot corresponds to the JSON schema field "slot".
	Slot *int `json:"slot,omitempty,omitzero"`

	// To corresponds to the JSON schema field "to".
	To MoveCommandTo `json:"to"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type MoveCommandTo

type MoveCommandTo string
const MoveCommandToA MoveCommandTo = "a"
const MoveCommandToB MoveCommandTo = "b"
const MoveCommandToStands MoveCommandTo = "stands"

type MuteCommand

type MuteCommand struct {
	// Muted corresponds to the JSON schema field "muted".
	Muted bool `json:"muted,omitempty,omitzero"`

	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	PlayerID int `json:"playerId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type Options

type Options struct {
	// BaseURL é onde a API responde: http://localhost:8092 no dev, https://<site>/api em produção.
	BaseURL string
	RoomID  string
	// Key é a chave da comunidade com o escopo rooms:control (amb_...).
	Key string
	// NoReconnect desliga a reconexão.
	NoReconnect bool
	// InitialDelay é a primeira espera depois de cair (dobra a cada tentativa); padrão 1 s.
	InitialDelay time.Duration
	// MaxDelay é o teto da espera; padrão 30 s.
	MaxDelay time.Duration
	// MaxAttempts: desiste depois de tantas tentativas seguidas sem ready; 0 = nunca.
	MaxAttempts int
	// CommandTimeout: quanto esperar o result de um comando; padrão 10 s.
	CommandTimeout time.Duration
}

Options configura o Bot.

type ParseInput

type ParseInput struct {
	Rest    string
	Words   []string
	Player  CommandPlayer
	Players []Person
}

ParseInput é o que o Parse próprio recebe: o texto depois do nome, já em palavras.

type PauseCommand

type PauseCommand struct {
	// Paused corresponds to the JSON schema field "paused".
	Paused *bool `json:"paused,omitempty,omitzero"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type Permission

type Permission string

Permission diz quem pode usar o comando. Vazio herda o padrão (todos).

const (
	PermissionAll   Permission = "all"
	PermissionStaff Permission = "staff"
	PermissionOwner Permission = "owner"
)

type Person

type Person struct {
	ID        int
	Nick      string
	AccountID *string
}

Person é quem está na sala, como o argumento "player" devolve.

type PickCommand

type PickCommand struct {
	// Keyword corresponds to the JSON schema field "keyword".
	Keyword *PickCommandKeyword `json:"keyword,omitempty,omitzero"`

	// Number corresponds to the JSON schema field "number".
	Number *int `json:"number,omitempty,omitzero"`

	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	PlayerID *int `json:"playerId,omitempty,omitzero"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type PickCommandKeyword

type PickCommandKeyword string
const PickCommandKeywordBottom PickCommandKeyword = "bottom"
const PickCommandKeywordRandom PickCommandKeyword = "random"
const PickCommandKeywordTop PickCommandKeyword = "top"

type PlayerJoinedEvent

type PlayerJoinedEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Player corresponds to the JSON schema field "player".
	Player PlayerRef `json:"player"`

	// quantas pessoas ficaram na sala
	Players int `json:"players"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type PlayerLeftEvent

type PlayerLeftEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Player corresponds to the JSON schema field "player".
	Player PlayerRef `json:"player"`

	// quantas pessoas ficaram na sala
	Players int `json:"players"`

	// Reason corresponds to the JSON schema field "reason".
	Reason PlayerLeftEventReason `json:"reason"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type PlayerLeftEventReason

type PlayerLeftEventReason string
const PlayerLeftEventReasonBanned PlayerLeftEventReason = "banned"
const PlayerLeftEventReasonDropped PlayerLeftEventReason = "dropped"
const PlayerLeftEventReasonKicked PlayerLeftEventReason = "kicked"
const PlayerLeftEventReasonLeft PlayerLeftEventReason = "left"

type PlayerRef

type PlayerRef struct {
	// AccountID corresponds to the JSON schema field "accountId".
	AccountID PlayerRefAccountID `json:"accountId"`

	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	ID int `json:"id"`

	// Nick corresponds to the JSON schema field "nick".
	Nick string `json:"nick"`
}

type PlayerRefAccountID

type PlayerRefAccountID *string

type ReadyMessage

type ReadyMessage struct {
	// Live corresponds to the JSON schema field "live".
	Live *ReadyMessageLive `json:"live"`

	// Room corresponds to the JSON schema field "room".
	Room HostedRoom `json:"room"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type ReadyMessageLive

type ReadyMessageLive struct {
	// Address corresponds to the JSON schema field "address".
	Address LiveRoomAddress `json:"address"`

	// Code corresponds to the JSON schema field "code".
	Code string `json:"code"`

	// Map corresponds to the JSON schema field "map".
	Map string `json:"map"`

	// Mode corresponds to the JSON schema field "mode".
	Mode string `json:"mode"`

	// Phase corresponds to the JSON schema field "phase".
	Phase LiveRoomPhase `json:"phase"`

	// Players corresponds to the JSON schema field "players".
	Players []LivePlayer `json:"players"`

	// Score corresponds to the JSON schema field "score".
	Score LiveRoomScore `json:"score"`
}

type ReadyMessageLive_0

type ReadyMessageLive_0 = LiveRoom

type RestartCommand

type RestartCommand struct {
	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type ResultMessage

type ResultMessage struct {
	// Code corresponds to the JSON schema field "code".
	Code *string `json:"code,omitempty,omitzero"`

	// Message corresponds to the JSON schema field "message".
	Message *string `json:"message,omitempty,omitzero"`

	// Ok corresponds to the JSON schema field "ok".
	Ok bool `json:"ok"`

	// Ref corresponds to the JSON schema field "ref".
	Ref *string `json:"ref,omitempty,omitzero"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type Role

type Role string

Role é o papel de quem mandou o comando na sala.

const (
	RolePlayer Role = "player"
	RoleStaff  Role = "staff"
	RoleOwner  Role = "owner"
)

type RoomCommand

type RoomCommand interface{}

type RoomConfigEvent

type RoomConfigEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Config corresponds to the JSON schema field "config".
	Config HostedRoomConfig `json:"config"`

	// Name corresponds to the JSON schema field "name".
	Name string `json:"name"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type RoomEvent

type RoomEvent interface{}

type RoomLiveEvent

type RoomLiveEvent struct {
	// Address corresponds to the JSON schema field "address".
	Address RoomLiveEventAddress `json:"address"`

	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Code corresponds to the JSON schema field "code".
	Code string `json:"code"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type RoomLiveEventAddress

type RoomLiveEventAddress *string

type RoomOffEvent

type RoomOffEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Reason corresponds to the JSON schema field "reason".
	Reason RoomOffEventReason `json:"reason"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type RoomOffEventReason

type RoomOffEventReason string
const RoomOffEventReasonEmpty RoomOffEventReason = "empty"
const RoomOffEventReasonFailed RoomOffEventReason = "failed"
const RoomOffEventReasonReleased RoomOffEventReason = "released"
const RoomOffEventReasonServerLost RoomOffEventReason = "server_lost"

type RoomRules

type RoomRules []Rule

type RoomScript

type RoomScript struct {
	// Enabled corresponds to the JSON schema field "enabled".
	Enabled bool `json:"enabled"`

	// Source corresponds to the JSON schema field "source".
	Source string `json:"source"`
}

type RoomTeams

type RoomTeams struct {
	// A corresponds to the JSON schema field "a".
	A TeamStyle `json:"a"`

	// B corresponds to the JSON schema field "b".
	B TeamStyle `json:"b"`
}

O uniforme do time da casa (a) e o do time visitante (b).

type Rule

type Rule struct {
	// CooldownSeconds corresponds to the JSON schema field "cooldownSeconds".
	CooldownSeconds *int `json:"cooldownSeconds,omitempty,omitzero"`

	// Do corresponds to the JSON schema field "do".
	Do []RuleAction `json:"do"`

	// Enabled corresponds to the JSON schema field "enabled".
	Enabled bool `json:"enabled"`

	// ID corresponds to the JSON schema field "id".
	ID string `json:"id"`

	// If corresponds to the JSON schema field "if".
	If []RuleCondition `json:"if"`

	// Name corresponds to the JSON schema field "name".
	Name string `json:"name"`

	// When corresponds to the JSON schema field "when".
	When RuleTrigger `json:"when"`
}

Quando (when) acontecer X, se (if) Y, faça (do) Z.

type RuleAction

type RuleAction interface{}

type RuleCondition

type RuleCondition interface{}

type RuleFiredEvent

type RuleFiredEvent struct {
	// Actions corresponds to the JSON schema field "actions".
	Actions []RuleFiredEventActionsElem `json:"actions"`

	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Depth corresponds to the JSON schema field "depth".
	Depth int `json:"depth"`

	// Player corresponds to the JSON schema field "player".
	Player *RuleFiredEventPlayer `json:"player"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Rule corresponds to the JSON schema field "rule".
	Rule RuleFiredEventRule `json:"rule"`

	// Trigger corresponds to the JSON schema field "trigger".
	Trigger string `json:"trigger"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type RuleFiredEventActionsElem

type RuleFiredEventActionsElem struct {
	// Message corresponds to the JSON schema field "message".
	Message *string `json:"message,omitempty,omitzero"`

	// Ok corresponds to the JSON schema field "ok".
	Ok bool `json:"ok"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type RuleFiredEventPlayer

type RuleFiredEventPlayer struct {
	// AccountID corresponds to the JSON schema field "accountId".
	AccountID PlayerRefAccountID `json:"accountId"`

	// O id do jogador nesta sala, informado nos eventos e no estado ao vivo. O id
	// muda se o jogador sair e voltar.
	ID int `json:"id"`

	// Nick corresponds to the JSON schema field "nick".
	Nick string `json:"nick"`
}

type RuleFiredEventPlayer_0

type RuleFiredEventPlayer_0 = PlayerRef

type RuleFiredEventRule

type RuleFiredEventRule struct {
	// ID corresponds to the JSON schema field "id".
	ID string `json:"id"`

	// Name corresponds to the JSON schema field "name".
	Name string `json:"name"`
}

type RuleTrigger

type RuleTrigger interface{}

type ScriptLogEvent

type ScriptLogEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Text corresponds to the JSON schema field "text".
	Text string `json:"text"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type ScriptStoppedEvent

type ScriptStoppedEvent struct {
	// At corresponds to the JSON schema field "at".
	At int `json:"at"`

	// Message corresponds to the JSON schema field "message".
	Message string `json:"message"`

	// Reason corresponds to the JSON schema field "reason".
	Reason ScriptStoppedEventReason `json:"reason"`

	// RoomID corresponds to the JSON schema field "roomId".
	RoomID string `json:"roomId"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type ScriptStoppedEventReason

type ScriptStoppedEventReason string
const ScriptStoppedEventReasonActions ScriptStoppedEventReason = "actions"
const ScriptStoppedEventReasonBudget ScriptStoppedEventReason = "budget"
const ScriptStoppedEventReasonCompile ScriptStoppedEventReason = "compile"
const ScriptStoppedEventReasonMemory ScriptStoppedEventReason = "memory"
const ScriptStoppedEventReasonPrivate ScriptStoppedEventReason = "private"
const ScriptStoppedEventReasonRanked ScriptStoppedEventReason = "ranked"
const ScriptStoppedEventReasonRuntime ScriptStoppedEventReason = "runtime"
const ScriptStoppedEventReasonTime ScriptStoppedEventReason = "time"

type ServerMessage

type ServerMessage interface{}

O que a API manda: ready (auth aceita), result (de cada comando), error e os eventos da sala.

type ShuffleCommand

type ShuffleCommand struct {
	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type StartCommand

type StartCommand struct {
	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type StopCommand

type StopCommand struct {
	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type TeamCommand

type TeamCommand struct {
	// Colors corresponds to the JSON schema field "colors".
	Colors *TeamCommandColors `json:"colors,omitempty,omitzero"`

	// Kit corresponds to the JSON schema field "kit".
	Kit *string `json:"kit,omitempty,omitzero"`

	// Name corresponds to the JSON schema field "name".
	Name *string `json:"name,omitempty,omitzero"`

	// Team corresponds to the JSON schema field "team".
	Team TeamCommandTeam `json:"team"`

	// Type corresponds to the JSON schema field "type".
	Type string `json:"type"`
}

type TeamCommandColors

type TeamCommandColors struct {
	// Base corresponds to the JSON schema field "base".
	Base string `json:"base"`

	// Second corresponds to the JSON schema field "second".
	Second string `json:"second"`
}

type TeamCommandTeam

type TeamCommandTeam string
const TeamCommandTeamA TeamCommandTeam = "a"
const TeamCommandTeamB TeamCommandTeam = "b"

type TeamStyle

type TeamStyle struct {
	// Colors corresponds to the JSON schema field "colors".
	Colors *TeamStyleColors `json:"colors,omitempty,omitzero"`

	// Kit corresponds to the JSON schema field "kit".
	Kit string `json:"kit"`

	// Name corresponds to the JSON schema field "name".
	Name string `json:"name"`
}

type TeamStyleColors

type TeamStyleColors struct {
	// Base corresponds to the JSON schema field "base".
	Base string `json:"base"`

	// Second corresponds to the JSON schema field "second".
	Second string `json:"second"`
}

type UsageError

type UsageError struct{ Reason string }

UsageError é o motivo de um argumento ruim: vira a resposta de uso.

func (*UsageError) Error

func (e *UsageError) Error() string

Directories

Path Synopsis
examples
welcome-bot command
Um bot de sala completo: dá boas-vindas, responde !regras e rola um !dado com argumento, faixa e cooldown.
Um bot de sala completo: dá boas-vindas, responde !regras e rola um !dado com argumento, faixa e cooldown.

Jump to

Keyboard shortcuts

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