pammy

package module
v0.0.0-...-0d5330c Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotInVoiceChannel        = errors.New("not in voice channel")
	ErrEmptyTracks              = errors.New("empty tracks")
	ErrTrackNotFound            = errors.New("track not found")
	ErrCannotRemovePlayingTrack = errors.New("cannot remove the playing track")
)

Functions

This section is empty.

Types

type AddCommand

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

func NewAddCommand

func NewAddCommand(hub *Hub, ytClient *youtube.Client) *AddCommand

func (*AddCommand) Command

func (c *AddCommand) Command() *discordgo.ApplicationCommand

func (*AddCommand) Handle

type AutoPlayCommand

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

func NewAutoPlayCommand

func NewAutoPlayCommand(hub *Hub) *AutoPlayCommand

func (*AutoPlayCommand) Command

func (*AutoPlayCommand) Handle

type Bot

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

func NewBot

func NewBot(guidID string, dg *discordgo.Session, ytClient *youtube.Client, errCh chan error) *Bot

func (*Bot) Add

func (b *Bot) Add(track *Track)

func (*Bot) AutoDiscoverNextTrack

func (b *Bot) AutoDiscoverNextTrack() bool

func (*Bot) Clear

func (b *Bot) Clear(all bool) int

Clear clears the upcomming tracks (tracks queue) then return a total removed tracks Set all to true to clear all tracks except the current playing track.

func (*Bot) Close

func (b *Bot) Close()

func (*Bot) CurrentTrackIndex

func (b *Bot) CurrentTrackIndex() int

func (*Bot) GoTo

func (b *Bot) GoTo(idx int) error

func (*Bot) JoinVoiceChannel

func (b *Bot) JoinVoiceChannel(channelID string) error

func (*Bot) List

func (b *Bot) List(page, pageSize int) TrackPage

func (*Bot) Next

func (b *Bot) Next(n int) error

func (*Bot) Pause

func (b *Bot) Pause() error

func (*Bot) Prev

func (b *Bot) Prev(n int) error

func (*Bot) Remove

func (b *Bot) Remove(idx int) error

func (*Bot) Reset

func (b *Bot) Reset()

func (*Bot) Resume

func (b *Bot) Resume() error

func (*Bot) SetAutoDiscoverNextTrack

func (b *Bot) SetAutoDiscoverNextTrack(v bool)

func (*Bot) SetTextChannelID

func (b *Bot) SetTextChannelID(id string)

func (*Bot) State

func (b *Bot) State() BotState

func (*Bot) TextChannelID

func (b *Bot) TextChannelID() string

func (*Bot) TotalTracks

func (b *Bot) TotalTracks() int

func (*Bot) VoiceChannelID

func (b *Bot) VoiceChannelID() string

type BotState

type BotState uint
const (
	BotStateWaitForTrack BotState = iota
	BotStatePlaying
	BotStatePaused
)

type ClearCommand

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

func NewClearCommand

func NewClearCommand(hub *Hub) *ClearCommand

func (*ClearCommand) Command

func (*ClearCommand) Handle

type Client

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

func NewClient

func NewClient(token string) (*Client, error)

func (*Client) AddGlobalSlashCommand

func (c *Client) AddGlobalSlashCommand(cmd SlashCommand)

func (*Client) Start

func (c *Client) Start() error

type CommandHandleFunc

type CommandHandleFunc func(s *discordgo.Session, i *discordgo.InteractionCreate)

type Hub

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

func NewHub

func NewHub(dg *discordgo.Session, ytClient *youtube.Client) *Hub

func (*Hub) GetBot

func (h *Hub) GetBot(guildID string) (*Bot, bool)

func (*Hub) RemoveBot

func (h *Hub) RemoveBot(guildID string)

func (*Hub) SetBot

func (h *Hub) SetBot(bot *Bot, guildID string)

type LeaveCommand

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

func NewLeaveCommand

func NewLeaveCommand(hub *Hub) *LeaveCommand

func (*LeaveCommand) Command

func (*LeaveCommand) Handle

type ListCommand

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

func NewListCommand

func NewListCommand(hub *Hub) *ListCommand

func (*ListCommand) Command

func (*ListCommand) Handle

type NextCommand

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

func NewNextCommand

func NewNextCommand(hub *Hub) *NextCommand

func (*NextCommand) Command

func (*NextCommand) Handle

type PauseCommand

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

func NewPauseCommand

func NewPauseCommand(hub *Hub) *PauseCommand

func (*PauseCommand) Command

func (*PauseCommand) Handle

type RemoveCommand

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

func NewRemoveCommand

func NewRemoveCommand(hub *Hub) *RemoveCommand

func (*RemoveCommand) Command

func (*RemoveCommand) Handle

type ResetCommand

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

func NewResetCommand

func NewResetCommand(hub *Hub) *ResetCommand

func (*ResetCommand) Command

func (*ResetCommand) Handle

type ResumeCommand

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

func NewResumeCommand

func NewResumeCommand(hub *Hub) *ResumeCommand

func (*ResumeCommand) Command

func (*ResumeCommand) Handle

type SlashCommand

type SlashCommand interface {
	Command() *discordgo.ApplicationCommand
	Handle(s *discordgo.Session, i *discordgo.InteractionCreate)
}

type Track

type Track struct {
	ID       string
	Name     string
	Duration time.Duration
}

type TrackPage

type TrackPage struct {
	TrackInfos  []string
	Page        int
	PageSize    int
	TotalPage   int
	TotalTracks int
	TotalQueued int
}

func (TrackPage) DisplayText

func (tp TrackPage) DisplayText() string

Directories

Path Synopsis
tools
extractresult command

Jump to

Keyboard shortcuts

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