diff --git a/channel.go b/channel.go index 1212d5e..e962f4f 100644 --- a/channel.go +++ b/channel.go @@ -204,7 +204,7 @@ func (ch *Channel) JoinServer(ctx context.Context, ct cchat.MessagesContainer) ( } // Subscribe to typing events. - ch.session.Members.Subscribe(ch.guildID) + ch.session.MemberState.Subscribe(ch.guildID) // Listen to new members before creating the backlog and requesting members. addcancel(ch.session.AddHandler(func(c *gateway.GuildMembersChunkEvent) { diff --git a/channel_completion.go b/channel_completion.go index 17eea1d..e339860 100644 --- a/channel_completion.go +++ b/channel_completion.go @@ -100,7 +100,7 @@ func (ch *Channel) completeMentions(word string) (entries []cchat.CompletionEntr // If we couldn't find any members, then we can request Discord to // search for them. if len(m) == 0 { - ch.session.Members.SearchMember(ch.guildID, word) + ch.session.MemberState.SearchMember(ch.guildID, word) return } @@ -171,7 +171,7 @@ func (ch *Channel) completeEmojis(word string) (entries []cchat.CompletionEntry) return } - e, err := ch.session.Emoji.Get(ch.guildID) + e, err := ch.session.EmojiState.Get(ch.guildID) if err != nil { return } diff --git a/go.mod b/go.mod index 21db12d..85218de 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/diamondburned/cchat-discord go 1.14 require ( - github.com/diamondburned/arikawa v0.10.2 + github.com/diamondburned/arikawa v0.10.5 github.com/diamondburned/cchat v0.0.43 - github.com/diamondburned/ningen v0.1.1-0.20200712031630-349ee2c3f01c + github.com/diamondburned/ningen v0.1.1-0.20200715015332-cb3c7378b3c8 github.com/dustin/go-humanize v1.0.0 github.com/go-test/deep v1.0.6 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 4c2d682..424625b 100644 --- a/go.sum +++ b/go.sum @@ -29,6 +29,8 @@ github.com/diamondburned/arikawa v0.9.6 h1:6TpfTKa2btoVQGxojNqv8g2YC0tIc/tX5w/OC github.com/diamondburned/arikawa v0.9.6/go.mod h1:nIhVIatzTQhPUa7NB8w4koG1RF9gYbpAr8Fj8sKq660= github.com/diamondburned/arikawa v0.10.2 h1:xTsFWlWwGzFr8HD7tyv2jMRyserOR4yV5dhq/PZMPAA= github.com/diamondburned/arikawa v0.10.2/go.mod h1:nIhVIatzTQhPUa7NB8w4koG1RF9gYbpAr8Fj8sKq660= +github.com/diamondburned/arikawa v0.10.5 h1:o5lBopooA+8cXlKZdct5qF0xztuZZ35phvQrwGS5vYM= +github.com/diamondburned/arikawa v0.10.5/go.mod h1:nIhVIatzTQhPUa7NB8w4koG1RF9gYbpAr8Fj8sKq660= github.com/diamondburned/cchat v0.0.34 h1:BGiVxMRA9dmW3rLilIldBvjVan7eTTpaWCCfX9IKBYU= github.com/diamondburned/cchat v0.0.34/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU= github.com/diamondburned/cchat v0.0.35 h1:WiMGl8BQJgbP9E4xRxgLGlqUsHpTcJgDKDt8/6a7lBk= @@ -59,6 +61,8 @@ github.com/diamondburned/ningen v0.1.1-0.20200711215126-d4b8a17e818d h1:XgG/KRbA github.com/diamondburned/ningen v0.1.1-0.20200711215126-d4b8a17e818d/go.mod h1:NVneOJDUDEIC3cnyeh2vpeAPVtBdC2Kcy+uwDy4o2qk= github.com/diamondburned/ningen v0.1.1-0.20200712031630-349ee2c3f01c h1:CpYhIGiRzee7Jm0H4c0fLvRe/08QitDNo8KHYtrOmFE= github.com/diamondburned/ningen v0.1.1-0.20200712031630-349ee2c3f01c/go.mod h1:NVneOJDUDEIC3cnyeh2vpeAPVtBdC2Kcy+uwDy4o2qk= +github.com/diamondburned/ningen v0.1.1-0.20200715015332-cb3c7378b3c8 h1:0IxrMc4bh/sp2e0dnagKgM72i9CfCoo1FygyglJcXao= +github.com/diamondburned/ningen v0.1.1-0.20200715015332-cb3c7378b3c8/go.mod h1:SKPY3387RHCbMrnefex9D+zlrA2yB+LCtaaQAgatAuc= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= diff --git a/message.go b/message.go index 04dc326..3ff18e5 100644 --- a/message.go +++ b/message.go @@ -157,7 +157,7 @@ func NewMessageCreate(c *gateway.MessageCreateEvent, s *Session) Message { c.Member, _ = s.Store.Member(c.GuildID, c.Author.ID) } if c.Member == nil { - s.Members.RequestMember(c.GuildID, c.Author.ID) + s.MemberState.RequestMember(c.GuildID, c.Author.ID) return NewMessage(c.Message, s, NewUser(c.Author)) } @@ -176,7 +176,7 @@ func NewBacklogMessage(m discord.Message, s *Session, g discord.Guild) Message { mem, err := s.Store.Member(m.GuildID, m.Author.ID) if err != nil { - s.Members.RequestMember(m.GuildID, m.Author.ID) + s.MemberState.RequestMember(m.GuildID, m.Author.ID) return NewMessage(m, s, NewUser(m.Author)) } diff --git a/service.go b/service.go index 3f76b7b..0fb09a7 100644 --- a/service.go +++ b/service.go @@ -100,6 +100,8 @@ func NewSession(s *state.State) (*Session, error) { return nil, errors.Wrap(err, "Failed to create a state wrapper") } + var _ state.Store = s + if err := s.Open(); err != nil { return nil, err }