Documentation ¶
Index ¶
- Variables
- type DCADataGetter
- type GuildPlayer
- func (p *GuildPlayer) AddSong(textChannelID, voiceChannelID *string, songs ...*voice.Song) error
- func (p *GuildPlayer) Close() error
- func (p *GuildPlayer) GetPlayedSong() (*voice.PlayedSong, error)
- func (p *GuildPlayer) GetPlaylist() ([]string, error)
- func (p *GuildPlayer) GetVoiceChannelInfo() map[string]VoiceChannelInfo
- func (p *GuildPlayer) PrintVoiceChannelInfo()
- func (p *GuildPlayer) RemoveSong(position int) (*voice.Song, error)
- func (p *GuildPlayer) Run(ctx context.Context) error
- func (p *GuildPlayer) SkipSong()
- func (p *GuildPlayer) StartListeningEvents(s *discordgo.Session)
- func (p *GuildPlayer) Stop() error
- func (p *GuildPlayer) UpdateVoiceState(s *discordgo.Session, vs *discordgo.VoiceStateUpdate)
- func (p *GuildPlayer) WithLogger(l *zap.Logger) *GuildPlayer
- type Trigger
- type VoiceChannelInfo
Constants ¶
This section is empty.
Variables ¶
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 ¶
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) 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 ¶
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.