Skip to content

[Example] How do I use the voice package with the bot package after the refactor in v2? #178

Locked Answered by diamondburned
diamondburned asked this question in Help
Discussion options

You must be logged in to vote

The new voice API removed the entire state-keeping of voice sessions that the previous API had, because it's not always needed. As such, you don't even need the Voice field anymore.

The reason you received timing out errors is because you didn't specify the needed Gateway Intents. Because voice works separately from bot, the router has no way of knowing whether or not you need the Intents. As such, a fix would be to do:

wait, err := bot.Start(token, cmds, func(ctx *bot.Context) error {
    voice.AddIntents(ctx.Gateway)
    return nil
})

For future reference, the documentation provides a full example of using Session, so you could use that as a reference to check against your Session code.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by diamondburned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant