diff --git a/discord.go b/discord.go index 4498c0758..3e5fed97c 100644 --- a/discord.go +++ b/discord.go @@ -15,7 +15,6 @@ package discordgo import ( "net/http" - "runtime" "time" "github.com/gorilla/websocket" @@ -26,9 +25,12 @@ const VERSION = "0.28.1" // New creates a new Discord session with provided token. // If the token is for a bot, it must be prefixed with "Bot " -// e.g. "Bot ..." +// +// e.g. "Bot ..." +// // Or if it is an OAuth2 token, it must be prefixed with "Bearer " -// e.g. "Bearer ..." +// +// e.g. "Bearer ..." func New(token string) (s *Session, err error) { // Create an empty Session interface. @@ -45,17 +47,19 @@ func New(token string) (s *Session, err error) { MaxRestRetries: 3, Client: &http.Client{Timeout: (20 * time.Second)}, Dialer: websocket.DefaultDialer, - UserAgent: "DiscordBot (https://github.com/bwmarrin/discordgo, v" + VERSION + ")", - sequence: new(int64), - LastHeartbeatAck: time.Now().UTC(), + //UserAgent: "DiscordBot (https://github.com/bwmarrin/discordgo, v" + VERSION + ")" + UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36", + sequence: new(int64), + LastHeartbeatAck: time.Now().UTC(), } // Initialize the Identify Package with defaults // These can be modified prior to calling Open() s.Identify.Compress = true s.Identify.LargeThreshold = 250 - s.Identify.Properties.OS = runtime.GOOS - s.Identify.Properties.Browser = "DiscordGo v" + VERSION + //s.Identify.Properties.OS = runtime.GOOS + s.Identify.Properties.OS = "Mac OS X" + s.Identify.Properties.Browser = "Chrome" s.Identify.Intents = IntentsAllWithoutPrivileged s.Identify.Token = token s.Token = token diff --git a/examples/voice_receive/go.mod b/examples/voice_receive/go.mod index f6bbdeb80..bb3875631 100644 --- a/examples/voice_receive/go.mod +++ b/examples/voice_receive/go.mod @@ -1,7 +1,58 @@ module github.com/bwmarrin/discordgo/examples/voice_receive +go 1.22.2 + require ( github.com/bwmarrin/discordgo v0.21.1 github.com/pion/rtp v1.6.0 github.com/pion/webrtc/v3 v3.0.0-20200721060053-ca3cc9d940bc ) + +require ( + github.com/cheekybits/genny v1.0.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fsnotify/fsnotify v1.4.7 // indirect + github.com/golang/mock v1.2.0 // indirect + github.com/golang/protobuf v1.2.0 // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/gorilla/websocket v1.4.0 // indirect + github.com/hpcloud/tail v1.0.0 // indirect + github.com/kr/pretty v0.1.0 // indirect + github.com/kr/pty v1.1.1 // indirect + github.com/kr/text v0.1.0 // indirect + github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9 // indirect + github.com/marten-seemann/qtls v0.2.3 // indirect + github.com/onsi/ginkgo v1.7.0 // indirect + github.com/onsi/gomega v1.4.3 // indirect + github.com/pion/datachannel v1.4.19 // indirect + github.com/pion/dtls/v2 v2.0.2 // indirect + github.com/pion/ice/v2 v2.0.0-rc.8 // indirect + github.com/pion/logging v0.2.2 // indirect + github.com/pion/mdns v0.0.4 // indirect + github.com/pion/quic v0.1.1 // indirect + github.com/pion/randutil v0.1.0 // indirect + github.com/pion/rtcp v1.2.3 // indirect + github.com/pion/sctp v1.7.8 // indirect + github.com/pion/sdp/v2 v2.4.0 // indirect + github.com/pion/srtp v1.5.0 // indirect + github.com/pion/stun v0.3.5 // indirect + github.com/pion/transport v0.10.1 // indirect + github.com/pion/turn/v2 v2.0.4 // indirect + github.com/pion/udp v0.1.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/sclevine/agouti v3.0.0+incompatible // indirect + github.com/stretchr/objx v0.1.0 // indirect + github.com/stretchr/testify v1.6.1 // indirect + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect + golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect + golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect + golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect + golang.org/x/text v0.3.0 // indirect + golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + gopkg.in/fsnotify.v1 v1.4.7 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect + gopkg.in/yaml.v2 v2.2.2 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/interactions.go b/interactions.go index c562463af..22a7f50b3 100644 --- a/interactions.go +++ b/interactions.go @@ -235,6 +235,8 @@ type Interaction struct { Token string `json:"token"` Version int `json:"version"` + + Nonce string `json:"nonce"` } type interaction Interaction diff --git a/message.go b/message.go index 3b03ed5f9..a77453154 100644 --- a/message.go +++ b/message.go @@ -150,6 +150,8 @@ type Message struct { // An array of StickerItem objects, representing sent stickers, if there were any. StickerItems []*StickerItem `json:"sticker_items"` + + Nonce string `json:"nonce"` } // UnmarshalJSON is a helper function to unmarshal the Message.