Documentation ¶
Index ¶
- Constants
- Variables
- func AddAdmin(b *Bot, p CommandParameters)
- func AddChannel(b *Bot, p CommandParameters)
- func Admins(b *Bot, p CommandParameters)
- func Channels(b *Bot, p CommandParameters)
- func GiveNew(b *Bot, p CommandParameters)
- func Grab(b *Bot, p CommandParameters)
- func HandlerFromInteraction(b *Bot, cmd Command) func(*DG.Session, *DG.InteractionCreate)
- func HandlerFromMessageCreate(b *Bot, cmd Command) func(*DG.Session, *DG.MessageCreate)
- func Help(b *Bot, p CommandParameters)
- func Info(b *Bot, p CommandParameters)
- func IsHistoryInvalid(h History) bool
- func PageReact(b *Bot) func(*DG.Session, *DG.InteractionCreate)
- func Play(b *Bot, p CommandParameters)
- func Prefix(b *Bot, p CommandParameters)
- func RemoveAdmin(b *Bot, p CommandParameters)
- func RemoveChannel(b *Bot, p CommandParameters)
- func Reset(b *Bot, p CommandParameters)
- func SendEmbed(s *DG.Session, i *DG.Interaction, channelID string, embed *DG.MessageEmbed, ...) (*DG.Message, error)
- func SendText(s *DG.Session, i *DG.Interaction, channelID, content string) (*DG.Message, error)
- func SetCooldown(b *Bot, p CommandParameters)
- func SetPrefix(b *Bot, p CommandParameters)
- func SetStay(b *Bot, p CommandParameters)
- func ShowLeaderboard(b *Bot, p CommandParameters)
- func ShowScore(b *Bot, p CommandParameters)
- func Spawn(b *Bot, p CommandParameters)
- type Bot
- func (b *Bot) AddItems(items []Item)
- func (b *Bot) Debug(format string, args ...interface{})
- func (b *Bot) DebugE(err error, format string, args ...interface{})
- func (b *Bot) Error(format string, args ...interface{})
- func (b *Bot) ErrorE(err error, format string, args ...interface{})
- func (b *Bot) Fatal(format string, args ...interface{})
- func (b *Bot) FatalE(err error, format string, args ...interface{})
- func (b *Bot) GetServer(id string) Server
- func (b *Bot) GetUserScore(user string, serv Server) int
- func (b *Bot) GetUserScoreboard(user string, serv Server) ScoreBoard
- func (b *Bot) Info(format string, args ...interface{})
- func (b *Bot) NewServer(id string) Server
- func (b *Bot) OpenDB()
- func (b *Bot) RandomMonster() Monster
- func (b *Bot) SaveServer(s Server)
- func (b *Bot) SetupCommands()
- func (b *Bot) SortedMonsters() (res []Monster)
- func (b *Bot) Stop()
- func (b *Bot) TotalPoints() int
- func (b *Bot) TriggersAnyOtherCommand(p CommandParameters) bool
- func (b *Bot) Warn(format string, args ...interface{})
- func (b *Bot) WarnE(err error, format string, args ...interface{})
- type BotAction
- type Command
- type CommandParameters
- type Config
- type Game
- type History
- type InteractionHandlers
- type Item
- type Leaderboard
- type Listable
- type Menu
- func (m *Menu) FirstPage(s *DG.Session)
- func (m *Menu) GetComponents() []DG.MessageComponent
- func (m *Menu) ID() string
- func (m *Menu) LastPage(s *DG.Session)
- func (m *Menu) NextPage(s *DG.Session)
- func (m *Menu) PreviousPage(s *DG.Session)
- func (m *Menu) Send(s *DG.Session, i *DG.Interaction) error
- func (m *Menu) SetFooter(footer string)
- func (m *Menu) SetHeader(header string)
- func (m *Menu) SetImages(images []string)
- func (m *Menu) SetSubtitle(subtitle string)
- func (m *Menu) SetTitle(title string)
- type Message
- type Monster
- type MonsterSpawn
- type Option
- type OptionType
- type Options
- type Range
- type ScoreBoard
- type Server
Constants ¶
View Source
const ( DefaultPrefix = "b!" DefaultMinDelay = 120 DefaultVariableDelay = 781 DefaultStayTime = 5 * time.Second HistoryDepth = 10 )
View Source
const ( FirstPageLabel = "\u2060 \u2060 \u2060 First \u2060 \u2060 \u2060" PreviousPageLabel = "Previous" NextPageLabel = "\u2060 \u2060 \u2060 Next \u2060 \u2060 \u2060" LastPageLabel = "\u2060 \u2060 \u2060 Last \u2060 \u2060 \u2060" )
View Source
const UnknownItem = "???"
Variables ¶
View Source
var DefaultMemberPermissions int64 = DG.PermissionManageServer
Functions ¶
func AddAdmin ¶
func AddAdmin(b *Bot, p CommandParameters)
func AddChannel ¶
func AddChannel(b *Bot, p CommandParameters)
func Admins ¶
func Admins(b *Bot, p CommandParameters)
func Channels ¶
func Channels(b *Bot, p CommandParameters)
func GiveNew ¶
func GiveNew(b *Bot, p CommandParameters)
func Grab ¶
func Grab(b *Bot, p CommandParameters)
func HandlerFromInteraction ¶
func Help ¶
func Help(b *Bot, p CommandParameters)
func Info ¶
func Info(b *Bot, p CommandParameters)
func IsHistoryInvalid ¶
func Play ¶
func Play(b *Bot, p CommandParameters)
func Prefix ¶
func Prefix(b *Bot, p CommandParameters)
func RemoveAdmin ¶
func RemoveAdmin(b *Bot, p CommandParameters)
func RemoveChannel ¶
func RemoveChannel(b *Bot, p CommandParameters)
func Reset ¶
func Reset(b *Bot, p CommandParameters)
func SendEmbed ¶
func SendEmbed(s *DG.Session, i *DG.Interaction, channelID string, embed *DG.MessageEmbed, components []DG.MessageComponent) (*DG.Message, error)
func SetCooldown ¶
func SetCooldown(b *Bot, p CommandParameters)
func SetPrefix ¶
func SetPrefix(b *Bot, p CommandParameters)
func SetStay ¶
func SetStay(b *Bot, p CommandParameters)
func ShowLeaderboard ¶
func ShowLeaderboard(b *Bot, p CommandParameters)
func ShowScore ¶
func ShowScore(b *Bot, p CommandParameters)
func Spawn ¶
func Spawn(b *Bot, p CommandParameters)
Types ¶
type Bot ¶
type Bot struct { Log *LR.Logger UserID string Mention string Items map[string]Item Monsters map[string]Monster MonsterIds []string Menus map[string]Menu EqualMonsterChances bool InteractionHandlers InteractionHandlers Commands []Command // contains filtered or unexported fields }
func (*Bot) GetUserScoreboard ¶
func (b *Bot) GetUserScoreboard(user string, serv Server) ScoreBoard
func (*Bot) RandomMonster ¶
func (*Bot) SaveServer ¶
func (*Bot) SetupCommands ¶
func (b *Bot) SetupCommands()
func (*Bot) SortedMonsters ¶
func (*Bot) TotalPoints ¶
func (*Bot) TriggersAnyOtherCommand ¶
func (b *Bot) TriggersAnyOtherCommand(p CommandParameters) bool
type BotAction ¶
type BotAction func(*Bot, CommandParameters)
type Command ¶
type CommandParameters ¶
type CommandParameters struct {
UID, CID, GID, Name string // MID only available on MessageCreate, else empty
MsgCreate *DG.MessageCreate
I *DG.Interaction
Options map[string]interface{}
S Server
IsUserTriggered bool
}
func ParamsFromInteraction ¶
func ParamsFromInteraction(b *Bot, i *DG.InteractionCreate, name string) CommandParameters
func ParamsFromMessageCreate ¶
func ParamsFromMessageCreate(b *Bot, m *DG.MessageCreate, name string) CommandParameters
func (*CommandParameters) ParseOptionsFromInteraction ¶
func (p *CommandParameters) ParseOptionsFromInteraction(i *DG.Interaction, opts Options) error
func (*CommandParameters) ParseOptionsFromRaws ¶
func (p *CommandParameters) ParseOptionsFromRaws(raws []string, opts Options) error
type Config ¶
type Config struct { AppID int `json:"app-id" yaml:"app-id"` ClientID int `json:"client-id" yaml:"client-id"` PublicKey string `json:"public-key" yaml:"public-key"` ImgurClientID string `json:"imgur-client-id" yaml:"imgur-client-id"` ImgurClientSecret string `json:"imgur-client-secret" yaml:"imgur-client-secret"` Token string `json:"token" yaml:"token"` Monsters []Monster `json:"monsters" yaml:"monsters"` // contains filtered or unexported fields }
type Game ¶
type Game struct { On bool Monsters map[string]MonsterSpawn NextSpawn time.Time MinDelay time.Duration StayTime time.Duration SpawnRate int VariableDelay int Finished bool LastMessages History Winner string }
func (*Game) ResetSpawnRate ¶
func (g *Game) ResetSpawnRate()
type History ¶
type History []Message
func NewHistory ¶
func NewHistory() History
func (History) HasSeveralAuthors ¶
type InteractionHandlers ¶
type InteractionHandlers map[string]func(*DG.Session, *DG.InteractionCreate)
type Item ¶
type Item struct { ID string `json:"id,omitempty" yaml:"id,omitempty"` Name string `json:"name" yaml:"name"` Chance float64 `json:"chance" yaml:"chance"` Points int `json:"points" yaml:"points"` Range Range `json:"range,omitempty" yaml:"range,omitempty"` }
func (Item) Description ¶
type Leaderboard ¶
type Leaderboard []ScoreBoard
func (Leaderboard) Strings ¶
func (lb Leaderboard) Strings() []string
type Menu ¶
type Menu struct { L []string // List to be displayed in a embed message Images []string // List of images to be set as thumbnails on each page // contains filtered or unexported fields }
func (*Menu) GetComponents ¶
func (m *Menu) GetComponents() []DG.MessageComponent
func (*Menu) PreviousPage ¶
func (*Menu) SetSubtitle ¶
type Monster ¶
type Monster struct { ID int `json:"id" yaml:"id"` Name string `json:"name" yaml:"name"` Artist string `json:"artist" yaml:"artist"` Path string `json:"path" yaml:"path"` URL string `json:"url" yaml:"url"` Chance float64 `json:"chance" yaml:"chance"` Items []Item `json:"items" yaml:"items"` Range Range `json:"range,omitempty" yaml:"range,omitempty"` EqualItemChances bool `json:"equalchances,omitempty" yaml:"equalchances,omitempty"` }
type MonsterSpawn ¶
type Option ¶
type Option struct {
Name, Description string
Type OptionType
}
type OptionType ¶
type OptionType string
const ( TypeString OptionType = "string" TypeInteger OptionType = "integer" TypeChannel OptionType = "channel" TypeUser OptionType = "user" )
type Server ¶
type Server struct { ID string Prefix string G Game Channels []string Admins []string Users map[string][]string Lb Leaderboard }
Click to show internal directories.
Click to hide internal directories.