1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-07-07 05:06:13 +00:00

Revert "voice: Example should use JoinChannelAndSpeak"

This reverts commit 85619b2976. It was
accidentally merged into v3 instead of 238-branch.
This commit is contained in:
diamondburned 2022-01-18 21:28:23 -08:00
parent 85619b2976
commit 4fa2363f8a
No known key found for this signature in database
GPG key ID: D78C4471CE776659

View file

@ -4,8 +4,6 @@ import (
"context"
"io"
"log"
"os"
"os/signal"
"testing"
"github.com/diamondburned/arikawa/v3/discord"
@ -36,15 +34,12 @@ func TestNoop(t *testing.T) {
}
func ExampleSession() {
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()
s := state.New("Bot " + token)
// This is required for bots.
voice.AddIntents(s)
if err := s.Open(ctx); err != nil {
if err := s.Open(context.TODO()); err != nil {
log.Fatalln("failed to open gateway:", err)
}
defer s.Close()
@ -54,10 +49,10 @@ func ExampleSession() {
log.Fatalln("failed to create voice session:", err)
}
if err := v.JoinChannelAndSpeak(ctx, channelID, false, false); err != nil {
if err := v.JoinChannel(context.TODO(), channelID, false, false); err != nil {
log.Fatalln("failed to join voice channel:", err)
}
defer v.Leave(ctx)
defer v.Leave(context.TODO())
// Start writing Opus frames.
for {