Skip to content

Commit

Permalink
refactor shardmanager interface
Browse files Browse the repository at this point in the history
from #26
update dasgo
fix missing GUILD_MEMBERS_CHUNK intents
  • Loading branch information
switchupcb committed Jul 7, 2023
1 parent 8f02b93 commit da09a8a
Show file tree
Hide file tree
Showing 10 changed files with 225 additions and 229 deletions.
6 changes: 6 additions & 0 deletions _gen/bundle/tools/replaced/session
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
type Session struct {
Context context.Context
Shard *[2]int
Conn *websocket.Conn
heartbeat *heartbeat
manager *manager
Expand All @@ -15,6 +16,11 @@ type Session struct {
// Context is also used as a signal for the Session's goroutines.
Context context.Context

// Shard represents the [shard_id, num_shards] for this session.
//
// https://discord.com/developers/docs/topics/gateway#sharding
Shard *[2]int

// Conn represents a connection to the Discord Gateway.
Conn *websocket.Conn

Expand Down
18 changes: 18 additions & 0 deletions _gen/bundle/tools/replaced/sessionmanager
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
type SessionManager struct {
Gateway map[string]*Session
Voice map[string]*Session
All []*Session
}
---
type SessionManager struct {
// Gateway represents a map of Discord Gateway (TCP WebSocket Connections) session IDs to Sessions.
// map[ID]Session
Gateway map[string]*Session

// Voice represents a map of Discord Voice (UDP WebSocket Connection) session IDs to Sessions.
// map[ID]Session
Voice map[string]*Session

// All contains a pointer to every session that is being managed.
All []*Session
}
1 change: 1 addition & 0 deletions _gen/tools/_copygen/events/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Copygen interface {
AutoModerationActionExecution(*disgo.AutoModerationActionExecution)
InteractionCreate(*disgo.InteractionCreate)
VoiceServerUpdate(*disgo.VoiceServerUpdate)
// intents FlagIntentGUILD_PRESENCES FlagIntentGUILD_MEMBERS
GuildMembersChunk(*disgo.GuildMembersChunk)
UserUpdate(*disgo.UserUpdate)
// intents FlagIntentGUILDS
Expand Down
191 changes: 108 additions & 83 deletions disgo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit da09a8a

Please sign in to comment.