feat(Session): Add GatewayWriteStruct function (#1409)

---------

Signed-off-by: Mia <m@yarn.network>
Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
This commit is contained in:
Kedas 2024-07-07 15:20:55 -04:00 committed by GitHub
parent 4a6d74ef80
commit dec4d43ba0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -515,6 +515,21 @@ func (s *Session) RequestGuildMembersBatchList(guildIDs []string, userIDs []stri
return
}
// GatewayWriteStruct allows for sending raw gateway structs over the gateway.
func (s *Session) GatewayWriteStruct(data interface{}) (err error) {
s.RLock()
defer s.RUnlock()
if s.wsConn == nil {
return ErrWSNotFound
}
s.wsMutex.Lock()
err = s.wsConn.WriteJSON(data)
s.wsMutex.Unlock()
return err
}
func (s *Session) requestGuildMembers(data requestGuildMembersData) (err error) {
s.log(LogInformational, "called")