mirror of
https://github.com/bwmarrin/discordgo.git
synced 2025-12-23 23:17:45 -05:00
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:
15
wsapi.go
15
wsapi.go
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user