From b799664d90c10ecfd8fff61edfe0dd6fc27af61a Mon Sep 17 00:00:00 2001 From: topi314 Date: Sun, 14 Jul 2024 09:32:27 +0200 Subject: [PATCH] implement repeat command & update disgo --- commands/repeat.go | 20 ++++++++++++++++++++ go.mod | 6 +++--- go.sum | 12 ++++++------ main.go | 2 +- 4 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 commands/repeat.go diff --git a/commands/repeat.go b/commands/repeat.go new file mode 100644 index 0000000..7c71484 --- /dev/null +++ b/commands/repeat.go @@ -0,0 +1,20 @@ +package commands + +import ( + "fmt" + + "github.com/disgoorg/disgo/discord" + "github.com/disgoorg/disgo/handler" + + "github.com/lavalink-devs/lavalink-bot/lavalinkbot" +) + +func (c *Commands) Repeat(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error { + newMode := lavalinkbot.RepeatMode(data.String("mode")) + + c.MusicQueue.SetRepeatMode(*e.GuildID(), newMode) + + return e.CreateMessage(discord.MessageCreate{ + Content: fmt.Sprintf("Set repeat mode to `%s`", newMode), + }) +} diff --git a/go.mod b/go.mod index 245d7b6..ef20e6a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/lavalink-devs/lavalink-bot go 1.22 require ( - github.com/disgoorg/disgo v0.18.7 + github.com/disgoorg/disgo v0.18.8 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-20240428194130-71a50d68e826 @@ -27,8 +27,8 @@ require ( 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.24.0 // indirect + golang.org/x/crypto v0.25.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sys v0.21.0 // indirect + golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/go.sum b/go.sum index a6441ab..e3e08d4 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,8 @@ github.com/cloudflare/circl v1.3.9/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZ 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.18.7 h1:Xg5eiOdSo+wR3CDMIPh9Vmykdkwk/rdcs00vhr2U6m0= -github.com/disgoorg/disgo v0.18.7/go.mod h1:gkl6DBdbKUvmOOJayWPSvS52KPN/8uJGJ2f13gCEB1o= +github.com/disgoorg/disgo v0.18.8 h1:qysxgI5jY+v8crQ6oWIe316CmX761jjDfhuL0RVf0FU= +github.com/disgoorg/disgo v0.18.8/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= @@ -59,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.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/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= @@ -84,8 +84,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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.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= diff --git a/main.go b/main.go index 0b485cc..ee3accc 100644 --- a/main.go +++ b/main.go @@ -80,7 +80,7 @@ func main() { r.SlashCommand("/seek", cmds.Seek) r.SlashCommand("/volume", cmds.Volume) r.SlashCommand("/shuffle", cmds.Shuffle) - // r.SlashCommand("/repeat", cmds.Repeat) + r.SlashCommand("/repeat", cmds.Repeat) r.SlashCommand("/queue", cmds.Queue) r.SlashCommand("/now-playing", cmds.NowPlaying) // r.SlashCommand("/lyrics", cmds.Lyrics)