From ec4cd6d66156bf4933ca3902f90e228dbad702f8 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Sun, 3 Apr 2022 17:49:21 -0700 Subject: [PATCH] examples: Add voice example --- 0-examples/voice/go.mod | 19 ++++++ 0-examples/voice/go.sum | 20 ++++++ 0-examples/voice/main.go | 127 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 0-examples/voice/go.mod create mode 100644 0-examples/voice/go.sum create mode 100644 0-examples/voice/main.go diff --git a/0-examples/voice/go.mod b/0-examples/voice/go.mod new file mode 100644 index 0000000..453957c --- /dev/null +++ b/0-examples/voice/go.mod @@ -0,0 +1,19 @@ +module github.com/diamondburned/arikawa/v3/0-examples/voice + +go 1.17 + +replace github.com/diamondburned/arikawa/v3 => ../../ + +require ( + github.com/diamondburned/arikawa/v3 v3.0.0-rc.6 + github.com/diamondburned/oggreader v0.0.0-20201118014549-87df9534b647 + github.com/pkg/errors v0.9.1 +) + +require ( + github.com/gorilla/schema v1.2.0 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/sys v0.0.0-20211001092434-39dca1131b70 // indirect + golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect +) diff --git a/0-examples/voice/go.sum b/0-examples/voice/go.sum new file mode 100644 index 0000000..7fcb949 --- /dev/null +++ b/0-examples/voice/go.sum @@ -0,0 +1,20 @@ +github.com/diamondburned/oggreader v0.0.0-20201118014549-87df9534b647 h1:TJWvffl1cMLzSOvw8Wv3CQicuU9NaKDKXvBfh5T9W00= +github.com/diamondburned/oggreader v0.0.0-20201118014549-87df9534b647/go.mod h1:xEJuvlmPx1wBKUWkx+MUp1ULSMQwSM9FS+bnFJhPQkk= +github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc= +github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211001092434-39dca1131b70 h1:pGleJoyD1yA5HfvuaksHxD0404gsEkNDerKsQ0N0y1s= +golang.org/x/sys v0.0.0-20211001092434-39dca1131b70/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/0-examples/voice/main.go b/0-examples/voice/main.go new file mode 100644 index 0000000..b953cfe --- /dev/null +++ b/0-examples/voice/main.go @@ -0,0 +1,127 @@ +package main + +import ( + "context" + "flag" + "log" + "os" + "os/exec" + "os/signal" + "path/filepath" + "strconv" + "time" + + "github.com/diamondburned/arikawa/v3/discord" + "github.com/diamondburned/arikawa/v3/state" + "github.com/diamondburned/arikawa/v3/voice" + "github.com/diamondburned/arikawa/v3/voice/udp" + "github.com/diamondburned/oggreader" + "github.com/pkg/errors" +) + +func main() { + flag.Parse() + + file := flag.Arg(0) + if file == "" { + log.Fatalln("usage:", filepath.Base(os.Args[0]), "