[Example] How do I use the voice package with the bot package after the refactor in v2? #178
-
I have this bot code that used to work here: wait, err := bot.Start(token, cmds, func(ctx *bot.Context) error {
cmds.Voice = voice.NewWithState(ctx.State)
return nil
}) Apparently, the How should I fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 The reason you received timing out errors is because you didn't specify the needed Gateway Intents. Because 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 |
Beta Was this translation helpful? Give feedback.
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 frombot
, the router has no way of knowing whether or not you need the Intents. As such, a fix would be to do:For future reference, the documentation provides a full example of using
Session
, so you could use that as a reference to check against yourSession
code.