diff --git a/commands/decode.go b/commands/decode.go index cc85fee..6b031d5 100644 --- a/commands/decode.go +++ b/commands/decode.go @@ -29,9 +29,9 @@ var decode = discord.SlashCommandCreate{ }, } -func (c *Commands) Decode(e *handler.CommandEvent) error { - track := e.SlashCommandInteractionData().String("track") - lavalink := e.SlashCommandInteractionData().Bool("lavalink") +func (c *Commands) Decode(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + track := data.String("track") + lavalink := data.Bool("lavalink") if !lavalink { var content string @@ -43,8 +43,8 @@ func (c *Commands) Decode(e *handler.CommandEvent) error { content += fmt.Sprintf("track was encoded with version: `%d`\n", version) } if decoded != nil { - data, _ := json.MarshalIndent(decoded, "", " ") - content += fmt.Sprintf("```json\n%s\n```", data) + decodedData, _ := json.MarshalIndent(decoded, "", " ") + content += fmt.Sprintf("```json\n%s\n```", decodedData) } return e.CreateMessage(discord.MessageCreate{ @@ -56,7 +56,7 @@ func (c *Commands) Decode(e *handler.CommandEvent) error { return err } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() decoded, err := c.Lavalink.BestNode().Rest().DecodeTrack(ctx, track) if err != nil { @@ -66,7 +66,7 @@ func (c *Commands) Decode(e *handler.CommandEvent) error { return err } - data, err := json.MarshalIndent(decoded, "", " ") + decodedData, err := json.MarshalIndent(decoded, "", " ") if err != nil { _, err = e.UpdateInteractionResponse(discord.MessageUpdate{ Content: json.Ptr(fmt.Sprintf("failed to decode track: %s", err)), @@ -75,7 +75,7 @@ func (c *Commands) Decode(e *handler.CommandEvent) error { } _, err = e.UpdateInteractionResponse(discord.MessageUpdate{ - Content: json.Ptr(fmt.Sprintf("```json\n%s\n```", data)), + Content: json.Ptr(fmt.Sprintf("```json\n%s\n```", decodedData)), }) return err } diff --git a/commands/disconnect.go b/commands/disconnect.go index e8c96c8..96a2b2c 100644 --- a/commands/disconnect.go +++ b/commands/disconnect.go @@ -8,8 +8,8 @@ import ( "github.com/disgoorg/disgo/handler" ) -func (c *Commands) Disconnect(e *handler.CommandEvent) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) +func (c *Commands) Disconnect(_ discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() if err := c.Client.UpdateVoiceState(ctx, *e.GuildID(), nil, false, false); err != nil { diff --git a/commands/effect.go b/commands/effect.go index 06a8edd..ed3e455 100644 --- a/commands/effect.go +++ b/commands/effect.go @@ -97,8 +97,8 @@ var effects = map[EffectType]lavalink.Filters{ }, } -func (c *Commands) Effects(e *handler.CommandEvent) error { - effectType := EffectType(e.SlashCommandInteractionData().String("effect")) +func (c *Commands) Effects(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + effectType := EffectType(data.String("effect")) if err := c.Lavalink.ExistingPlayer(*e.GuildID()).Update(context.Background(), lavalink.WithFilters(effects[effectType])); err != nil { return e.CreateMessage(discord.MessageCreate{ Content: fmt.Sprintf("failed to appply effect: `%s`", err), diff --git a/commands/info.go b/commands/info.go index 488c04e..39f8e29 100644 --- a/commands/info.go +++ b/commands/info.go @@ -27,7 +27,7 @@ var info = discord.SlashCommandCreate{ }, } -func (c *Commands) InfoBot(e *handler.CommandEvent) error { +func (c *Commands) InfoBot(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { var fields []discord.EmbedField c.Lavalink.ForNodes(func(node disgolink.Node) { version, err := node.Version(context.TODO()) @@ -65,7 +65,7 @@ func (c *Commands) InfoBot(e *handler.CommandEvent) error { }) } -func (c *Commands) InfoLavalink(e *handler.CommandEvent) error { +func (c *Commands) InfoLavalink(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { nodeInfos := map[string]lavalink.Info{} c.Lavalink.ForNodes(func(node disgolink.Node) { nodeInfo, err := node.Info(context.TODO()) diff --git a/commands/latest.go b/commands/latest.go index 0e15556..8ca2f0b 100644 --- a/commands/latest.go +++ b/commands/latest.go @@ -45,7 +45,7 @@ func (c *Commands) LatestAutocomplete(e *handler.AutocompleteEvent) error { return e.AutocompleteResult(choices) } -func (c *Commands) Latest(e *handler.CommandEvent) error { +func (c *Commands) Latest(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { if err := e.DeferCreateMessage(false); err != nil { return err } diff --git a/commands/lyrics.go b/commands/lyrics.go index eb1fbf5..34adbd6 100644 --- a/commands/lyrics.go +++ b/commands/lyrics.go @@ -13,24 +13,47 @@ import ( "github.com/lavalink-devs/lavalink-bot/internal/res" ) -func (c *Commands) Lyrics(e *handler.CommandEvent) error { - player := c.Lavalink.ExistingPlayer(*e.GuildID()) - track := player.Track() - if track == nil { - return e.CreateMessage(discord.MessageCreate{ - Content: "no track playing", - Flags: discord.MessageFlagEphemeral, - }) - } +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 } - node := c.Lavalink.BestNode() + var ( + track string + lyrics *lavalyrics.Lyrics + err error + ) - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() - lyrics, err := lavalyrics.GetLyrics(ctx, node.Rest(), node.SessionID(), *e.GuildID()) + + if encodedTrack, ok := data.OptString("track"); ok { + track = fmt.Sprintf("`%s`", encodedTrack) + + lyrics, err = lavalyrics.GetLyrics(ctx, c.Lavalink.BestNode().Rest(), encodedTrack, skipTrackSource) + } else { + player := c.Lavalink.ExistingPlayer(*e.GuildID()) + if player == nil { + return e.CreateMessage(discord.MessageCreate{ + Content: "No player found", + Flags: discord.MessageFlagEphemeral, + }) + } + + playingTrack := player.Track() + if playingTrack == nil { + return e.CreateMessage(discord.MessageCreate{ + Content: "no track playing", + Flags: discord.MessageFlagEphemeral, + }) + } + + track = res.FormatTrack(*playingTrack, 0) + + lyrics, err = lavalyrics.GetCurrentTrackLyrics(ctx, player.Node().Rest(), player.Node().SessionID(), *e.GuildID(), skipTrackSource) + } if err != nil { _, err = e.UpdateInteractionResponse(discord.MessageUpdate{ Content: json.Ptr(fmt.Sprintf("failed to decode track: %s", err)), @@ -38,6 +61,13 @@ func (c *Commands) Lyrics(e *handler.CommandEvent) error { return err } + if lyrics == nil { + _, err = e.UpdateInteractionResponse(discord.MessageUpdate{ + Content: json.Ptr("no lyrics found"), + }) + return err + } + var content string if len(lyrics.Lines) == 0 { content = lyrics.Text @@ -48,7 +78,7 @@ func (c *Commands) Lyrics(e *handler.CommandEvent) error { } _, err = e.UpdateInteractionResponse(discord.MessageUpdate{ - Content: json.Ptr(fmt.Sprintf("Loaded lyrics for %s from `%s`", res.FormatTrack(*track, 0), lyrics.SourceName)), + Content: json.Ptr(fmt.Sprintf("Loaded lyrics for %s from `%s`(`%s`)", track, lyrics.SourceName, lyrics.Provider)), Files: []*discord.File{ discord.NewFile("lyrics.txt", "", bytes.NewReader([]byte(content))), }, diff --git a/commands/music.go b/commands/music.go index c973be9..97653d2 100644 --- a/commands/music.go +++ b/commands/music.go @@ -2,7 +2,6 @@ package commands import ( "github.com/disgoorg/disgo/discord" - "github.com/disgoorg/disgo/events" "github.com/disgoorg/disgo/handler" "github.com/disgoorg/disgolink/v3/lavalink" "github.com/disgoorg/json" @@ -305,13 +304,22 @@ var music = discord.SlashCommandCreate{ discord.ApplicationCommandOptionBool{ Name: "raw", Description: "Whether to include the raw track & info", - Required: false, }, }, }, discord.ApplicationCommandOptionSubCommand{ Name: "lyrics", - Description: "Shows the lyrics of the current track", + Description: "Shows the lyrics of the current or a given track", + Options: []discord.ApplicationCommandOption{ + discord.ApplicationCommandOptionBool{ + Name: "track", + Description: "Whether to include the raw lyrics", + }, + discord.ApplicationCommandOptionBool{ + Name: "skip-track-source", + Description: "Whether to skip the track source to resolve the lyrics", + }, + }, }, discord.ApplicationCommandOptionSubCommand{ Name: "remove", @@ -459,10 +467,10 @@ var music = discord.SlashCommandCreate{ } func (c *Commands) RequirePlayer(next handler.Handler) handler.Handler { - return func(e *events.InteractionCreate) error { + return func(e *handler.InteractionEvent) error { if e.Type() == discord.InteractionTypeApplicationCommand { if player := c.Lavalink.ExistingPlayer(*e.GuildID()); player == nil { - return e.Respond(discord.InteractionResponseTypeCreateMessage, discord.MessageCreate{ + return e.CreateMessage(discord.MessageCreate{ Content: "No player found", Flags: discord.MessageFlagEphemeral, }) diff --git a/commands/now_playing.go b/commands/now_playing.go index 836d6f4..56bb292 100644 --- a/commands/now_playing.go +++ b/commands/now_playing.go @@ -10,7 +10,7 @@ import ( "github.com/lavalink-devs/lavalink-bot/internal/res" ) -func (c *Commands) NowPlaying(e *handler.CommandEvent) error { +func (c *Commands) NowPlaying(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { player := c.Lavalink.Player(*e.GuildID()) track := player.Track() if track == nil { @@ -30,8 +30,8 @@ func (c *Commands) NowPlaying(e *handler.CommandEvent) error { } var files []*discord.File - if e.SlashCommandInteractionData().Bool("raw") { - data, err := json.MarshalIndent(track, "", " ") + if data.Bool("raw") { + decodedData, err := json.MarshalIndent(track, "", " ") if err != nil { return e.CreateMessage(discord.MessageCreate{ Content: fmt.Sprintf("Failed to marshal track: %s", err), @@ -40,7 +40,7 @@ func (c *Commands) NowPlaying(e *handler.CommandEvent) error { } files = append(files, &discord.File{ Name: "track.json", - Reader: bytes.NewReader(data), + Reader: bytes.NewReader(decodedData), }) } diff --git a/commands/pause.go b/commands/pause.go index 0825a11..d238756 100644 --- a/commands/pause.go +++ b/commands/pause.go @@ -9,8 +9,8 @@ import ( "github.com/disgoorg/disgolink/v3/lavalink" ) -func (c *Commands) Pause(e *handler.CommandEvent) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) +func (c *Commands) Pause(_ discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() player := c.Lavalink.ExistingPlayer(*e.GuildID()) diff --git a/commands/play.go b/commands/play.go index 6c55788..5ec0fbd 100644 --- a/commands/play.go +++ b/commands/play.go @@ -58,7 +58,7 @@ func (c *Commands) PlayAutocomplete(e *handler.AutocompleteEvent) error { types = append(types, lavasearch.SearchType(searchType)) } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() result, err := lavasearch.LoadSearch(ctx, c.Lavalink.BestNode().Rest(), query, types) if err != nil { @@ -164,7 +164,7 @@ func (c Choices) Swap(i, j int) { c[i], c[j] = c[j], c[i] } -func (c *Commands) Play(e *handler.CommandEvent) error { +func (c *Commands) Play(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { voiceState, ok := c.Client.Caches().VoiceState(*e.GuildID(), e.User().ID) if !ok { return e.CreateMessage(discord.MessageCreate{ @@ -173,8 +173,6 @@ func (c *Commands) Play(e *handler.CommandEvent) error { }) } - data := e.SlashCommandInteractionData() - query := data.String("query") if !data.Bool("raw") { @@ -191,7 +189,7 @@ func (c *Commands) Play(e *handler.CommandEvent) error { return err } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() result, err := c.Lavalink.BestNode().LoadTracks(ctx, query) if err != nil { @@ -261,7 +259,7 @@ func (c *Commands) Play(e *handler.CommandEvent) error { track, tracks = tracks[0], tracks[1:] } - playCtx, playCancel := context.WithTimeout(context.Background(), 10*time.Second) + playCtx, playCancel := context.WithTimeout(e.Ctx, 10*time.Second) defer playCancel() if err = player.Update(playCtx, lavalink.WithTrack(track)); err != nil { _, err = e.CreateFollowupMessage(discord.MessageCreate{ diff --git a/commands/queue.go b/commands/queue.go index ece758a..122a3b2 100644 --- a/commands/queue.go +++ b/commands/queue.go @@ -8,7 +8,7 @@ import ( "github.com/lavalink-devs/lavalink-bot/internal/res" ) -func (c *Commands) Queue(e *handler.CommandEvent) error { +func (c *Commands) Queue(_ discord.SlashCommandInteractionData, e *handler.CommandEvent) error { _, tracks := c.MusicQueue.Get(*e.GuildID()) if len(tracks) == 0 { return e.CreateMessage(discord.MessageCreate{ diff --git a/commands/resume.go b/commands/resume.go index 46ebee2..da4ab97 100644 --- a/commands/resume.go +++ b/commands/resume.go @@ -9,8 +9,8 @@ import ( "github.com/disgoorg/disgolink/v3/lavalink" ) -func (c *Commands) Resume(e *handler.CommandEvent) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) +func (c *Commands) Resume(_ discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() player := c.Lavalink.ExistingPlayer(*e.GuildID()) diff --git a/commands/seek.go b/commands/seek.go index c210b8e..3d77011 100644 --- a/commands/seek.go +++ b/commands/seek.go @@ -11,12 +11,11 @@ import ( "github.com/lavalink-devs/lavalink-bot/internal/res" ) -func (c *Commands) Seek(e *handler.CommandEvent) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) +func (c *Commands) Seek(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() player := c.Lavalink.ExistingPlayer(*e.GuildID()) - data := e.SlashCommandInteractionData() position := data.Int("position") duration, ok := data.OptInt("unit") if !ok { diff --git a/commands/shuffle.go b/commands/shuffle.go index a41b467..faebf05 100644 --- a/commands/shuffle.go +++ b/commands/shuffle.go @@ -5,7 +5,7 @@ import ( "github.com/disgoorg/disgo/handler" ) -func (c *Commands) Shuffle(e *handler.CommandEvent) error { +func (c *Commands) Shuffle(_ discord.SlashCommandInteractionData, e *handler.CommandEvent) error { ok := c.MusicQueue.Shuffle(*e.GuildID()) if !ok { return e.CreateMessage(discord.MessageCreate{ diff --git a/commands/skip.go b/commands/skip.go index e3a2b8d..5636b7b 100644 --- a/commands/skip.go +++ b/commands/skip.go @@ -9,8 +9,8 @@ import ( "github.com/disgoorg/disgolink/v3/lavalink" ) -func (c *Commands) Skip(e *handler.CommandEvent) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) +func (c *Commands) Skip(_ discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() player := c.Lavalink.ExistingPlayer(*e.GuildID()) track, ok := c.MusicQueue.Next(*e.GuildID()) diff --git a/commands/sponsorblock.go b/commands/sponsorblock.go index 5b2d530..af8a193 100644 --- a/commands/sponsorblock.go +++ b/commands/sponsorblock.go @@ -9,10 +9,10 @@ import ( "github.com/disgoorg/sponsorblock-plugin" ) -func (c *Commands) ShowSponsorblock(e *handler.CommandEvent) error { +func (c *Commands) ShowSponsorblock(_ discord.SlashCommandInteractionData, e *handler.CommandEvent) error { node := c.Lavalink.Player(*e.GuildID()).Node() - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() categories, err := sponsorblock.GetCategories(ctx, node.Rest(), node.SessionID(), *e.GuildID()) if err != nil { @@ -32,8 +32,7 @@ func (c *Commands) ShowSponsorblock(e *handler.CommandEvent) error { }) } -func (c *Commands) SetSponsorblock(e *handler.CommandEvent) error { - data := e.SlashCommandInteractionData() +func (c *Commands) SetSponsorblock(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { node := c.Lavalink.Player(*e.GuildID()).Node() var categories []sponsorblock.SegmentCategory @@ -43,7 +42,7 @@ func (c *Commands) SetSponsorblock(e *handler.CommandEvent) error { } } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() if err := sponsorblock.SetCategories(ctx, node.Rest(), node.SessionID(), *e.GuildID(), categories); err != nil { return e.CreateMessage(discord.MessageCreate{ diff --git a/commands/stop.go b/commands/stop.go index b7c31bc..e7146b1 100644 --- a/commands/stop.go +++ b/commands/stop.go @@ -9,8 +9,8 @@ import ( "github.com/disgoorg/disgolink/v3/lavalink" ) -func (c *Commands) Stop(e *handler.CommandEvent) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) +func (c *Commands) Stop(_ discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() player := c.Lavalink.ExistingPlayer(*e.GuildID()) if err := player.Update(ctx, lavalink.WithNullTrack()); err != nil { diff --git a/commands/tts.go b/commands/tts.go index 79a51bc..26ff154 100644 --- a/commands/tts.go +++ b/commands/tts.go @@ -8,8 +8,7 @@ import ( "github.com/disgoorg/disgo/handler" ) -func (c *Commands) TTS(e *handler.CommandEvent) error { - data := e.SlashCommandInteractionData() +func (c *Commands) TTS(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { message := data.String("message") tts := url.URL{ diff --git a/commands/volume.go b/commands/volume.go index 0523332..a7b16c8 100644 --- a/commands/volume.go +++ b/commands/volume.go @@ -10,8 +10,8 @@ import ( "github.com/disgoorg/disgolink/v3/lavalink" ) -func (c *Commands) Volume(e *handler.CommandEvent) error { - volume := e.SlashCommandInteractionData().Int("volume") +func (c *Commands) Volume(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + volume := data.Int("volume") player := c.Lavalink.ExistingPlayer(*e.GuildID()) oldVolume := player.Volume() @@ -22,7 +22,7 @@ func (c *Commands) Volume(e *handler.CommandEvent) error { }) } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second) defer cancel() if err := player.Update(ctx, lavalink.WithVolume(volume)); err != nil { return e.CreateMessage(discord.MessageCreate{ diff --git a/go.mod b/go.mod index c686cd4..e9957ea 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,10 @@ module github.com/lavalink-devs/lavalink-bot go 1.21 require ( - github.com/disgoorg/disgo v0.17.2 + github.com/disgoorg/disgo v0.18.4 github.com/disgoorg/disgolink/v3 v3.0.1-0.20240311001109-56f250c13235 github.com/disgoorg/json v1.1.0 - github.com/disgoorg/lavalyrics-plugin v0.0.0-20231229215219-9dfb609a0968 + github.com/disgoorg/lavalyrics-plugin v0.0.0-20240428194130-71a50d68e826 github.com/disgoorg/lavasearch-plugin v1.0.1-0.20231229185935-76caa6d35100 github.com/disgoorg/lavasrc-plugin v1.0.0 github.com/disgoorg/snowflake/v2 v2.0.1 @@ -21,18 +21,15 @@ require ( require ( github.com/ProtonMail/go-crypto v1.0.0 // indirect - github.com/cloudflare/circl v1.3.7 // indirect - github.com/golang/protobuf v1.5.4 // indirect + github.com/cloudflare/circl v1.3.8 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/gorilla/websocket v1.5.1 // indirect github.com/magefile/mage v1.15.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/sasha-s/go-csync v0.0.0-20240107134140-fcbab37b09ad // indirect - golang.org/x/crypto v0.21.0 // indirect - golang.org/x/net v0.22.0 // indirect - golang.org/x/oauth2 v0.18.0 // indirect - golang.org/x/sys v0.18.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/oauth2 v0.19.0 // indirect + golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/protobuf v1.33.0 // indirect ) diff --git a/go.sum b/go.sum index 81e72f7..267c93e 100644 --- a/go.sum +++ b/go.sum @@ -2,19 +2,19 @@ github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0k github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= -github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= -github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI= +github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/disgoorg/disgo v0.17.2 h1:RxiLq8guMtk+9tArFwve02iya2APQ9yZVtV30ySKNtw= -github.com/disgoorg/disgo v0.17.2/go.mod h1:8r3h9fXSz7BbACxLPsPbtB6LX8gaQFUETgPKV/0gAKQ= +github.com/disgoorg/disgo v0.18.4 h1:pRn5xV6v06g79EuTPKHSlshb1GGv5ncHOdYbxZ6Gr1A= +github.com/disgoorg/disgo v0.18.4/go.mod h1:gkl6DBdbKUvmOOJayWPSvS52KPN/8uJGJ2f13gCEB1o= github.com/disgoorg/disgolink/v3 v3.0.1-0.20240311001109-56f250c13235 h1:Mtqh7yLVBW6uKWAbrqKZv7DgXpoWBfPctok8sABYIiY= github.com/disgoorg/disgolink/v3 v3.0.1-0.20240311001109-56f250c13235/go.mod h1:YIwjIteZcjfI7HYZWH241iRI7RjTLoN51HLDOUHVSFI= github.com/disgoorg/json v1.1.0 h1:7xigHvomlVA9PQw9bMGO02PHGJJPqvX5AnwlYg/Tnys= github.com/disgoorg/json v1.1.0/go.mod h1:BHDwdde0rpQFDVsRLKhma6Y7fTbQKub/zdGO5O9NqqA= -github.com/disgoorg/lavalyrics-plugin v0.0.0-20231229215219-9dfb609a0968 h1:DghJgly/S/4Ekr3x3DmK6GPvmiII1uEclC7Tp/an6Hk= -github.com/disgoorg/lavalyrics-plugin v0.0.0-20231229215219-9dfb609a0968/go.mod h1:xoVKtS9skWr9OF2NgPPjv9ejuYXJ5RLcfMf7hTr6MWY= +github.com/disgoorg/lavalyrics-plugin v0.0.0-20240428194130-71a50d68e826 h1:wLB2wLSS+issIGqoT0XIWkcrKlcKbh0H9W9e5nfTtVM= +github.com/disgoorg/lavalyrics-plugin v0.0.0-20240428194130-71a50d68e826/go.mod h1:xoVKtS9skWr9OF2NgPPjv9ejuYXJ5RLcfMf7hTr6MWY= github.com/disgoorg/lavasearch-plugin v1.0.1-0.20231229185935-76caa6d35100 h1:lmibrw2MBBZ+vyKHzlJ01MvLz16jiCQAJ6Qm/j3Al70= github.com/disgoorg/lavasearch-plugin v1.0.1-0.20231229185935-76caa6d35100/go.mod h1:SjlXMsCmXImKOKVYpElcr8Ogbwt7L1BGYemCwt+Ld4I= github.com/disgoorg/lavasrc-plugin v1.0.0 h1:FMQ8igQgIeP9rWX+YxjMtJCrWz8nCY0kLb2c/6n0Dpo= @@ -23,12 +23,7 @@ github.com/disgoorg/snowflake/v2 v2.0.1 h1:CuUxGLwggUxEswZOmZ+mZ5i0xSumQdXW9tXW7 github.com/disgoorg/snowflake/v2 v2.0.1/go.mod h1:SPU9c2CNn5DSyb86QcKtdZgix9osEtKrHLW4rMhfLCs= github.com/disgoorg/sponsorblock-plugin v1.0.1-0.20231229185915-2448f4189bbc h1:3R5oHK4895QxqXvyMkhIKwF67x6Twq+ILLcvlWCFNuk= github.com/disgoorg/sponsorblock-plugin v1.0.1-0.20231229185915-2448f4189bbc/go.mod h1:RXm79FX342ijRDJy8TMZPGtkshIXjgPJELbet9uuAIE= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v52 v52.0.0 h1:uyGWOY+jMQ8GVGSX8dkSwCzlehU3WfdxQ7GweO/JP7M= @@ -64,8 +59,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -74,10 +69,10 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= -golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= -golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg= +golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -91,8 +86,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -101,7 +96,6 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= @@ -114,12 +108,6 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go index 4956c61..61d4d5f 100644 --- a/main.go +++ b/main.go @@ -51,42 +51,42 @@ func main() { cmds := &commands.Commands{Bot: b} r := handler.New() r.Use(middleware.Go) - r.Command("/info/bot", cmds.InfoBot) - r.Command("/info/lavalink", cmds.InfoLavalink) - r.Command("/latest", cmds.Latest) + r.SlashCommand("/info/bot", cmds.InfoBot) + r.SlashCommand("/info/lavalink", cmds.InfoLavalink) + r.SlashCommand("/latest", cmds.Latest) r.Autocomplete("/latest", cmds.LatestAutocomplete) - r.Command("/decode", cmds.Decode) + r.SlashCommand("/decode", cmds.Decode) r.Route("/music", func(r handler.Router) { - r.Command("/play", cmds.Play) - r.Command("/tts", cmds.TTS) + r.SlashCommand("/play", cmds.Play) + r.SlashCommand("/tts", cmds.TTS) r.Autocomplete("/play", cmds.PlayAutocomplete) + r.SlashCommand("/lyrics", cmds.Lyrics) r.Group(func(r handler.Router) { r.Use(cmds.RequirePlayer) - r.Command("/lyrics", cmds.Lyrics) - - r.Command("/stop", cmds.Stop) - r.Command("/disconnect", cmds.Disconnect) - r.Command("/skip", cmds.Skip) - r.Command("/pause", cmds.Pause) - r.Command("/resume", cmds.Resume) - r.Command("/seek", cmds.Seek) - r.Command("/volume", cmds.Volume) - r.Command("/shuffle", cmds.Shuffle) - // r.Command("/repeat", cmds.Repeat) - r.Command("/queue", cmds.Queue) - r.Command("/now-playing", cmds.NowPlaying) - // r.Command("/lyrics", cmds.Lyrics) - // r.Command("/remove", cmds.Remove) - // r.Command("/move", cmds.Move) - // r.Command("/swap", cmds.Swap) - // r.Command("/clear", cmds.Clear) - // r.Command("/rewind", cmds.Rewind) - // r.Command("/forward", cmds.Forward) - // r.Command("/restart", cmds.Restart) - r.Command("/effects", cmds.Effects) - r.Command("/sponsorblock/show", cmds.ShowSponsorblock) - r.Command("/sponsorblock/set", cmds.SetSponsorblock) + + r.SlashCommand("/stop", cmds.Stop) + r.SlashCommand("/disconnect", cmds.Disconnect) + r.SlashCommand("/skip", cmds.Skip) + r.SlashCommand("/pause", cmds.Pause) + r.SlashCommand("/resume", cmds.Resume) + r.SlashCommand("/seek", cmds.Seek) + r.SlashCommand("/volume", cmds.Volume) + r.SlashCommand("/shuffle", cmds.Shuffle) + // r.SlashCommand("/repeat", cmds.Repeat) + r.SlashCommand("/queue", cmds.Queue) + r.SlashCommand("/now-playing", cmds.NowPlaying) + // r.SlashCommand("/lyrics", cmds.Lyrics) + // r.SlashCommand("/remove", cmds.Remove) + // r.SlashCommand("/move", cmds.Move) + // r.SlashCommand("/swap", cmds.Swap) + // r.SlashCommand("/clear", cmds.Clear) + // r.SlashCommand("/rewind", cmds.Rewind) + // r.SlashCommand("/forward", cmds.Forward) + // r.SlashCommand("/restart", cmds.Restart) + r.SlashCommand("/effects", cmds.Effects) + r.SlashCommand("/sponsorblock/show", cmds.ShowSponsorblock) + r.SlashCommand("/sponsorblock/set", cmds.SetSponsorblock) }) })