diff options
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo')
-rw-r--r-- | vendor/github.com/bwmarrin/discordgo/discord.go | 2 | ||||
-rw-r--r-- | vendor/github.com/bwmarrin/discordgo/restapi.go | 1 | ||||
-rw-r--r-- | vendor/github.com/bwmarrin/discordgo/structs.go | 3 | ||||
-rw-r--r-- | vendor/github.com/bwmarrin/discordgo/voice.go | 26 |
4 files changed, 18 insertions, 14 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/discord.go b/vendor/github.com/bwmarrin/discordgo/discord.go index 0b571764..5c0fea0c 100644 --- a/vendor/github.com/bwmarrin/discordgo/discord.go +++ b/vendor/github.com/bwmarrin/discordgo/discord.go @@ -22,7 +22,7 @@ import ( ) // VERSION of DiscordGo, follows Semantic Versioning. (http://semver.org/) -const VERSION = "0.27.0" +const VERSION = "0.27.1" // New creates a new Discord session with provided token. // If the token is for a bot, it must be prefixed with "Bot " diff --git a/vendor/github.com/bwmarrin/discordgo/restapi.go b/vendor/github.com/bwmarrin/discordgo/restapi.go index b7d323e7..fe4d2fe8 100644 --- a/vendor/github.com/bwmarrin/discordgo/restapi.go +++ b/vendor/github.com/bwmarrin/discordgo/restapi.go @@ -223,6 +223,7 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b for _, opt := range options { opt(cfg) } + req = cfg.Request if s.Debug { for k, v := range req.Header { diff --git a/vendor/github.com/bwmarrin/discordgo/structs.go b/vendor/github.com/bwmarrin/discordgo/structs.go index 1c29a7e9..2dad321c 100644 --- a/vendor/github.com/bwmarrin/discordgo/structs.go +++ b/vendor/github.com/bwmarrin/discordgo/structs.go @@ -527,7 +527,7 @@ type ThreadMember struct { // The time the current user last joined the thread JoinTimestamp time.Time `json:"join_timestamp"` // Any user-thread settings, currently only used for notifications - Flags int + Flags int `json:"flags"` } // ThreadsList represents a list of threads alongisde with thread member objects for the current user. @@ -622,6 +622,7 @@ const ( StickerFormatTypePNG StickerFormat = 1 StickerFormatTypeAPNG StickerFormat = 2 StickerFormatTypeLottie StickerFormat = 3 + StickerFormatTypeGIF StickerFormat = 4 ) // StickerType is the type of sticker. diff --git a/vendor/github.com/bwmarrin/discordgo/voice.go b/vendor/github.com/bwmarrin/discordgo/voice.go index 87e84b12..79ce18e2 100644 --- a/vendor/github.com/bwmarrin/discordgo/voice.go +++ b/vendor/github.com/bwmarrin/discordgo/voice.go @@ -599,44 +599,46 @@ func (v *VoiceConnection) udpOpen() (err error) { return } - // Create a 70 byte array and put the SSRC code from the Op 2 VoiceConnection event - // into it. Then send that over the UDP connection to Discord - sb := make([]byte, 70) - binary.BigEndian.PutUint32(sb, v.op2.SSRC) + // Create a 74 byte array to store the packet data + sb := make([]byte, 74) + binary.BigEndian.PutUint16(sb, 1) // Packet type (0x1 is request, 0x2 is response) + binary.BigEndian.PutUint16(sb[2:], 70) // Packet length (excluding type and length fields) + binary.BigEndian.PutUint32(sb[4:], v.op2.SSRC) // The SSRC code from the Op 2 VoiceConnection event + + // And send that data over the UDP connection to Discord. _, err = v.udpConn.Write(sb) if err != nil { v.log(LogWarning, "udp write error to %s, %s", addr.String(), err) return } - // Create a 70 byte array and listen for the initial handshake response + // Create a 74 byte array and listen for the initial handshake response // from Discord. Once we get it parse the IP and PORT information out // of the response. This should be our public IP and PORT as Discord // saw us. - rb := make([]byte, 70) + rb := make([]byte, 74) rlen, _, err := v.udpConn.ReadFromUDP(rb) if err != nil { v.log(LogWarning, "udp read error, %s, %s", addr.String(), err) return } - if rlen < 70 { + if rlen < 74 { v.log(LogWarning, "received udp packet too small") return fmt.Errorf("received udp packet too small") } - // Loop over position 4 through 20 to grab the IP address - // Should never be beyond position 20. + // Loop over position 8 through 71 to grab the IP address. var ip string - for i := 4; i < 20; i++ { + for i := 8; i < len(rb)-2; i++ { if rb[i] == 0 { break } ip += string(rb[i]) } - // Grab port from position 68 and 69 - port := binary.BigEndian.Uint16(rb[68:70]) + // Grab port from position 72 and 73 + port := binary.BigEndian.Uint16(rb[len(rb)-2:]) // Take the data from above and send it back to Discord to finalize // the UDP connection handshake. |