Skip to content

implemented all the commands#8

Open
ftrapture wants to merge 5 commits intolavalink-devs:masterfrom
ftrapture:master
Open

implemented all the commands#8
ftrapture wants to merge 5 commits intolavalink-devs:masterfrom
ftrapture:master

Conversation

@ftrapture
Copy link
Copy Markdown
Contributor

No description provided.

@topi314
Copy link
Copy Markdown
Member

topi314 commented Aug 18, 2025

you should rebase your master branch.
That's why you should develope on feature branches instead

Comment on lines +15 to +18
player := c.Lavalink.ExistingPlayer(*e.GuildID())
if player != nil {
player.Destroy(ctx)
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the player is automatically destroyed on disconnect

func (c *Commands) Forward(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error {
ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second)
defer cancel()
player := c.Lavalink.ExistingPlayer(*e.GuildID())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

player can be nil

Comment on lines +15 to +16
ctx, cancel := context.WithTimeout(e.Ctx, 10*time.Second)
defer cancel()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can move this down where you actually use it

Comment on lines +32 to +37
if nPos == cPos {
return e.CreateMessage(discord.MessageCreate{
Content: "The player is already at position **`" + res.FormatDuration(lavalink.Duration(cPos)) + "`**",
Flags: discord.MessageFlagEphemeral,
})
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just forward anyway tbh

var vcID snowflake.ID

ch, ok := data.OptChannel("channel")
if ok && ch.Type == discord.ChannelTypeGuildVoice {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be a stage too

"github.com/lavalink-devs/lavalink-bot/internal/res"
)

func (c *Commands) Rewind(data discord.SlashCommandInteractionData, e *handler.CommandEvent) error {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comments as with forward command

"github.com/disgoorg/disgo/handler"
)

func (c *Commands) SwapAutocomplete(e *handler.AutocompleteEvent) error {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same things as with remove/move

}
})
if voiceStates <= 1 {
if atomic.LoadInt32(&voiceStates) <= 1 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what?

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if !event.Reason.MayStartNext() {
p.Destroy(ctx)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? we can stay connected

}
track, ok := h.MusicQueue.Next(p.GuildID())
if !ok {
p.Destroy(ctx)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? we can stay connected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants