bot

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoSongs indica que no hay canciones disponibles.
	ErrNoSongs = errors.New("canción no disponible")
	// ErrRemoveInvalidPosition indica que la posición de eliminación de la canción es inválida.
	ErrRemoveInvalidPosition = errors.New("posición inválida")
)

Functions

This section is empty.

Types

type DCADataGetter

type DCADataGetter func(ctx context.Context, song *voice.Song) (io.Reader, error)

DCADataGetter es una función para obtener datos de audio codificados en DCA para una canción específica.

type GuildPlayer

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

GuildPlayer es el reproductor de música para un servidor específico en Discord.

func NewGuildPlayer

func NewGuildPlayer(ctx context.Context, session voice.VoiceChatSession, songStorage store.SongStorage, stateStorage store.StateStorage, dCADataGetter DCADataGetter, message discordmessenger.ChatMessageSender) *GuildPlayer

NewGuildPlayer crea una nueva instancia de GuildPlayer con los parámetros proporcionados.

func (*GuildPlayer) AddSong

func (p *GuildPlayer) AddSong(textChannelID, voiceChannelID *string, songs ...*voice.Song) error

AddSong agrega una o más canciones a la lista de reproducción.

func (*GuildPlayer) Close

func (p *GuildPlayer) Close() error

Close cierra el reproductor de música.

func (*GuildPlayer) GetPlayedSong

func (p *GuildPlayer) GetPlayedSong() (*voice.PlayedSong, error)

GetPlayedSong obtiene la canción que se está reproduciendo actualmente.

func (*GuildPlayer) GetPlaylist

func (p *GuildPlayer) GetPlaylist() ([]string, error)

GetPlaylist obtiene la lista de reproducción actual.

func (*GuildPlayer) GetVoiceChannelInfo

func (p *GuildPlayer) GetVoiceChannelInfo() map[string]VoiceChannelInfo

GetVoiceChannelInfo devuelve el mapa con toda la información de los canales de voz y su estado.

func (*GuildPlayer) PrintVoiceChannelInfo

func (p *GuildPlayer) PrintVoiceChannelInfo()

PrintVoiceChannelInfo imprime la información sobre los servidores y los canales de voz donde se está usando el bot.

func (*GuildPlayer) RemoveSong

func (p *GuildPlayer) RemoveSong(position int) (*voice.Song, error)

RemoveSong elimina una canción de la lista de reproducción por posición.

func (*GuildPlayer) Run

func (p *GuildPlayer) Run(ctx context.Context) error

Run inicia el bucle principal del reproductor de música.

func (*GuildPlayer) SkipSong

func (p *GuildPlayer) SkipSong()

SkipSong salta la canción actual.

func (*GuildPlayer) StartListeningEvents

func (p *GuildPlayer) StartListeningEvents(s *discordgo.Session)

StartListeningEvents inicia la escucha de eventos relevantes.

func (*GuildPlayer) Stop

func (p *GuildPlayer) Stop() error

Stop detiene la reproducción y limpia la lista de reproducción.

func (*GuildPlayer) UpdateVoiceState

func (p *GuildPlayer) UpdateVoiceState(s *discordgo.Session, vs *discordgo.VoiceStateUpdate)

UpdateVoiceState actualiza el mapa de información sobre los canales de voz.

func (*GuildPlayer) WithLogger

func (p *GuildPlayer) WithLogger(l *zap.Logger) *GuildPlayer

WithLogger establece el logger para el GuildPlayer y devuelve el mismo GuildPlayer.

type Trigger

type Trigger struct {
	Command        string
	VoiceChannelID *string
	TextChannelID  *string
}

Trigger representa un disparador para comandos relacionados con la reproducción de música.

type VoiceChannelInfo

type VoiceChannelInfo struct {
	GuildID         string
	BotID           string
	GuildName       string
	VoiceChannelID  string
	TextChannelID   string
	TextChannelName string
	Members         []*discordgo.Member
	PlayingSong     *voice.PlayMessage
	LastUpdated     time.Time
}

VoiceChannelInfo contiene información sobre un canal de voz y su estado.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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