Documentation
¶
Index ¶
- Variables
- func SaveConfig(config Config) error
- type Bot
- func (b *Bot) AddCommands(commands ...Command)
- func (b *Bot) Close(ctx context.Context)
- func (b *Bot) OnApplicationCommandInteractionCreate(event *events.ApplicationCommandInteractionCreate)
- func (b *Bot) OnAutocompleteInteractionCreate(event *events.AutocompleteInteractionCreate)
- func (b *Bot) Start() error
- type Command
- type Config
- type HTTPError
- type PlaylistTrack
- type QuizPlayer
- type QuizPlayers
- type QuizQueue
- type QuizTrack
- type Response
- type Spotify
- type SpotifyConfig
- type Track
Constants ¶
This section is empty.
Variables ¶
View Source
var SpotifyRegex = regexp.MustCompile(`(https?://)?(www\.)?open\.spotify\.com/(user/[\w-]+/)?(?P<type>track|album|playlist|artist)/(?P<identifier>[\w-]+)`)
Functions ¶
func SaveConfig ¶
Types ¶
type Bot ¶
type Bot struct {
Logger log.Logger
Config Config
Client bot.Client
Commands map[string]Command
Players *QuizPlayers
Spotify *Spotify
}
func (*Bot) AddCommands ¶
func (*Bot) OnApplicationCommandInteractionCreate ¶
func (b *Bot) OnApplicationCommandInteractionCreate(event *events.ApplicationCommandInteractionCreate)
func (*Bot) OnAutocompleteInteractionCreate ¶
func (b *Bot) OnAutocompleteInteractionCreate(event *events.AutocompleteInteractionCreate)
type Command ¶
type Command struct {
Create discord.ApplicationCommandCreate
Handler func(b *Bot, event *events.ApplicationCommandInteractionCreate) error
AutocompleteHandler func(b *Bot, event *events.AutocompleteInteractionCreate) error
}
type Config ¶
type Config struct {
DevMode bool `json:"dev_mode"`
GuildID snowflake.ID `json:"guild_id"`
LogLevel log.Level `json:"log_level"`
Token string `json:"token"`
SyncCommands bool `json:"sync_commands"`
Database db.Config `json:"database"`
Spotify SpotifyConfig `json:"spotify"`
}
func LoadConfig ¶
type PlaylistTrack ¶
type PlaylistTrack struct {
Track Track `json:"track"`
}
type QuizPlayer ¶
type QuizPlayer struct {
Queue *QuizQueue
CurrentTrack *QuizTrack
// contains filtered or unexported fields
}
func (*QuizPlayer) Play ¶
func (p *QuizPlayer) Play(errorHandler func(err error))
func (*QuizPlayer) PlayNext ¶
func (p *QuizPlayer) PlayNext(errorHandler func(err error))
type QuizPlayers ¶
type QuizPlayers struct {
// contains filtered or unexported fields
}
func NewQuizPlayers ¶
func NewQuizPlayers() *QuizPlayers
func (*QuizPlayers) Get ¶
func (p *QuizPlayers) Get(guildID snowflake.ID) *QuizPlayer
func (*QuizPlayers) New ¶
func (p *QuizPlayers) New(guildID snowflake.ID, client bot.Client, conn voice.Connection) *QuizPlayer
type QuizQueue ¶
type QuizQueue struct {
// contains filtered or unexported fields
}
func NewQuizQueue ¶
func NewQuizQueue() *QuizQueue
type Spotify ¶
type Spotify struct {
// contains filtered or unexported fields
}
func NewSpotify ¶
func NewSpotify(cfg SpotifyConfig, logger log.Logger) *Spotify
func (*Spotify) GetPlaylist ¶
func (s *Spotify) GetPlaylist(id string) ([]PlaylistTrack, error)
type SpotifyConfig ¶
Click to show internal directories.
Click to hide internal directories.