@@ -11,6 +11,7 @@ import (
1111 "github.com/keshon/melodix/internal/discord/discordreply"
1212 "github.com/keshon/melodix/internal/discord/perm"
1313 "github.com/keshon/melodix/internal/storage"
14+ "github.com/keshon/melodix/pkg/music/player"
1415)
1516
1617type Play struct {
@@ -212,10 +213,28 @@ func (c *Play) Run(ctx interface{}) error {
212213 }
213214
214215 if ! p .IsPlaying () {
215- _ = p .PlayNext (voiceState .ChannelID )
216+ if err := p .PlayNext (voiceState .ChannelID ); err != nil {
217+ if errors .Is (err , player .ErrTrackStartFailed ) {
218+ common .ListenPlayerStatusSlash (s , e , p , c .Bot , guildID , slashCtx .AppLog )
219+ return nil
220+ }
221+ if errors .Is (err , player .ErrNoTracksInQueue ) {
222+ discordreply .FollowupEmbedEphemeral (s , e , & discordgo.MessageEmbed {
223+ Title : "🎵 Queue" ,
224+ Description : "Nothing is in the queue to play." ,
225+ Color : discordreply .EmbedColor ,
226+ })
227+ return nil
228+ }
229+ discordreply .FollowupEmbedEphemeral (s , e , & discordgo.MessageEmbed {
230+ Title : "🎵 Playback Error" ,
231+ Description : fmt .Sprintf ("%v" , err ),
232+ Color : discordreply .EmbedColor ,
233+ })
234+ return nil
235+ }
216236 }
217237
218238 common .ListenPlayerStatusSlash (s , e , p , c .Bot , guildID , slashCtx .AppLog )
219239 return nil
220240}
221-
0 commit comments