diff --git a/commands/lyrics.go b/commands/lyrics.go index 34adbd6..bcc4ff4 100644 --- a/commands/lyrics.go +++ b/commands/lyrics.go @@ -16,10 +16,6 @@ import ( func (c *Commands) Lyrics(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { skipTrackSource := data.Bool("skip-track-source") - if err := e.DeferCreateMessage(false); err != nil { - return err - } - var ( track string lyrics *lavalyrics.Lyrics @@ -28,10 +24,13 @@ func (c *Commands) Lyrics(data discord.SlashCommandInteractionData, e *handler.C ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() - if encodedTrack, ok := data.OptString("track"); ok { track = fmt.Sprintf("`%s`", encodedTrack) + if err = e.DeferCreateMessage(false); err != nil { + return err + } + lyrics, err = lavalyrics.GetLyrics(ctx, c.Lavalink.BestNode().Rest(), encodedTrack, skipTrackSource) } else { player := c.Lavalink.ExistingPlayer(*e.GuildID()) @@ -52,6 +51,10 @@ func (c *Commands) Lyrics(data discord.SlashCommandInteractionData, e *handler.C track = res.FormatTrack(*playingTrack, 0) + if err = e.DeferCreateMessage(false); err != nil { + return err + } + lyrics, err = lavalyrics.GetCurrentTrackLyrics(ctx, player.Node().Rest(), player.Node().SessionID(), *e.GuildID(), skipTrackSource) } if err != nil {