-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_guilds.go
40 lines (32 loc) · 1.51 KB
/
client_guilds.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package tatsu_api
import (
"context"
"golang.org/x/xerrors"
)
// GetGuildMemberPoints wraps around GetGuildMemberPointsWithContext using the background context.
func (c *Client) GetGuildMemberPoints(guildID string, userID string) (*GuildMemberPoints, error) {
return c.GetGuildMemberPointsWithContext(context.Background(), guildID, userID)
}
// GetGuildMemberPointsWithContext gets a guild member's points using the specified context.
func (c *Client) GetGuildMemberPointsWithContext(ctx context.Context, guildID string,
userID string) (*GuildMemberPoints, error) {
points, err := c.rc.getGuildMemberPoints(ctx, guildID, userID)
if err != nil {
return nil, xerrors.Errorf("failed to get get guild member points: %w", err)
}
return points, nil
}
// ModifyGuildMemberScore wraps around ModifyGuildMemberScore using the background context.
func (c *Client) ModifyGuildMemberScore(guildID string, userID string, action Action,
amount uint32) (*GuildMemberScore, error) {
return c.ModifyGuildMemberScoreWithContext(context.Background(), guildID, userID, action, amount)
}
// ModifyGuildMemberScoreWithContext modifies a guild member's score using the specified context.
func (c *Client) ModifyGuildMemberScoreWithContext(ctx context.Context, guildID string, userID string,
action Action, amount uint32) (*GuildMemberScore, error) {
score, err := c.rc.modifyGuildMemberScore(ctx, guildID, userID, action, amount)
if err != nil {
return nil, xerrors.Errorf("failed to modify guild member score: %w", err)
}
return score, err
}