1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-discord.git synced 2024-11-21 21:52:46 +00:00

use the API even less

This commit is contained in:
diamondburned 2021-01-05 21:02:54 -08:00
parent 46db98bfe9
commit 2c7b56ab6e
3 changed files with 6 additions and 10 deletions

View file

@ -178,7 +178,7 @@ var World = Commands{
return nil, err
}
m, err := ch.State.Member(ch.GuildID, user.ID())
m, err := ch.State.Cabinet.Member(ch.GuildID, user.ID())
if err != nil {
return nil, err
}

View file

@ -67,7 +67,7 @@ func (gf *GuildFolder) Servers(container cchat.ServersContainer) error {
var servers = make([]cchat.Server, 0, len(gf.GuildIDs))
for _, id := range gf.GuildIDs {
g, err := gf.state.Guild(id)
g, err := gf.state.Cabinet.Guild(id)
if err != nil {
continue
}

View file

@ -30,7 +30,7 @@ func New(s *state.Instance, g *discord.Guild) cchat.Server {
}
func NewFromID(s *state.Instance, gID discord.GuildID) (cchat.Server, error) {
g, err := s.Guild(gID)
g, err := s.Cabinet.Guild(gID)
if err != nil {
return nil, err
}
@ -38,11 +38,7 @@ func NewFromID(s *state.Instance, gID discord.GuildID) (cchat.Server, error) {
return New(s, g), nil
}
func (g *Guild) self(ctx context.Context) (*discord.Guild, error) {
return g.state.WithContext(ctx).Guild(g.id)
}
func (g *Guild) selfState() (*discord.Guild, error) {
func (g *Guild) self() (*discord.Guild, error) {
return g.state.Cabinet.Guild(g.id)
}
@ -51,7 +47,7 @@ func (g *Guild) ID() cchat.ID {
}
func (g *Guild) Name() text.Rich {
s, err := g.selfState()
s, err := g.self()
if err != nil {
// This shouldn't happen.
return text.Rich{Content: g.id.String()}
@ -63,7 +59,7 @@ func (g *Guild) Name() text.Rich {
func (g *Guild) AsIconer() cchat.Iconer { return g }
func (g *Guild) Icon(ctx context.Context, iconer cchat.IconContainer) (func(), error) {
s, err := g.self(ctx)
s, err := g.self()
if err != nil {
// This shouldn't happen.
return nil, errors.Wrap(err, "Failed to get guild")