like and unlike
This commit is contained in:
parent
2c0543383b
commit
5be7be1682
@ -26,6 +26,10 @@ func Run(ctx *gctx.Context, client *spotify.Client, args []string) error {
|
|||||||
return commands.PlayUrl(ctx, client, args)
|
return commands.PlayUrl(ctx, client, args)
|
||||||
case "pause":
|
case "pause":
|
||||||
return commands.Pause(ctx, client)
|
return commands.Pause(ctx, client)
|
||||||
|
case "like":
|
||||||
|
return commands.Like(ctx, client)
|
||||||
|
case "unlike":
|
||||||
|
return commands.Unlike(ctx, client)
|
||||||
case "next":
|
case "next":
|
||||||
return commands.Skip(ctx, client)
|
return commands.Skip(ctx, client)
|
||||||
case "shuffle":
|
case "shuffle":
|
||||||
|
@ -231,6 +231,32 @@ func Pause(ctx *gctx.Context, client *spotify.Client) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Like(ctx *gctx.Context, client *spotify.Client) error {
|
||||||
|
playing, err := client.PlayerCurrentlyPlaying(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = client.AddTracksToLibrary(ctx, playing.Item.ID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ctx.Println("Pausing!")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Unlike(ctx *gctx.Context, client *spotify.Client) error {
|
||||||
|
playing, err := client.PlayerCurrentlyPlaying(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = client.RemoveTracksFromLibrary(ctx, playing.Item.ID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ctx.Println("Pausing!")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func Skip(ctx *gctx.Context, client *spotify.Client) error {
|
func Skip(ctx *gctx.Context, client *spotify.Client) error {
|
||||||
err := client.Next(ctx)
|
err := client.Next(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user