Skip to content

Commit

Permalink
feat(Session): Add GatewayWriteStruct function (#1409)
Browse files Browse the repository at this point in the history
---------

Signed-off-by: Mia <[email protected]>
Co-authored-by: Fedor Lapshin <[email protected]>
  • Loading branch information
K3das and FedorLap2006 committed Jul 7, 2024
1 parent 4a6d74e commit dec4d43
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions wsapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit dec4d43

Please sign in to comment.