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:
parent
4a6d74ef80
commit
dec4d43ba0
1 changed files with 15 additions and 0 deletions
15
wsapi.go
15
wsapi.go
|
@ -515,6 +515,21 @@ func (s *Session) RequestGuildMembersBatchList(guildIDs []string, userIDs []stri
|
||||||
return
|
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) {
|
func (s *Session) requestGuildMembers(data requestGuildMembersData) (err error) {
|
||||||
s.log(LogInformational, "called")
|
s.log(LogInformational, "called")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue