mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-05-23 07:41:08 +00:00
API: implement #48
This commit is contained in:
parent
323dc2193e
commit
205f675f0c
|
@ -185,22 +185,45 @@ func (c *Client) PruneCount(guildID discord.Snowflake, days uint) (uint, error)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prune returns the number of members that is removed. Days must be 1 or more,
|
// Prune begins a prune. Days must be 1 or more, default 7.
|
||||||
// default 7.
|
|
||||||
//
|
//
|
||||||
// Requires KICK_MEMBERS.
|
// Requires KICK_MEMBERS.
|
||||||
func (c *Client) Prune(guildID discord.Snowflake, days uint) (uint, error) {
|
func (c *Client) Prune(guildID discord.Snowflake, days uint) error {
|
||||||
if days == 0 {
|
if days == 0 {
|
||||||
days = 7
|
days = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
var param struct {
|
var param struct {
|
||||||
Count uint `schema:"count"`
|
Days uint `schema:"days"`
|
||||||
RetCount bool `schema:"compute_prune_count"`
|
RetCount bool `schema:"compute_prune_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
param.Count = days
|
param.Days = days
|
||||||
param.RetCount = true // maybe expose this later?
|
param.RetCount = false
|
||||||
|
|
||||||
|
return c.FastRequest(
|
||||||
|
"POST",
|
||||||
|
EndpointGuilds+guildID.String()+"/prune",
|
||||||
|
httputil.WithSchema(c, param),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PruneWithCounts returns the number of members that is removed. Days must be 1 or more,
|
||||||
|
// default 7.
|
||||||
|
//
|
||||||
|
// Requires KICK_MEMBERS.
|
||||||
|
func (c *Client) PruneWithCount(guildID discord.Snowflake, days uint) (uint, error) {
|
||||||
|
if days == 0 {
|
||||||
|
days = 7
|
||||||
|
}
|
||||||
|
|
||||||
|
var param struct {
|
||||||
|
Days uint `schema:"days"`
|
||||||
|
RetCount bool `schema:"compute_prune_count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
param.Days = days
|
||||||
|
param.RetCount = true
|
||||||
|
|
||||||
var resp struct {
|
var resp struct {
|
||||||
Pruned uint `json:"pruned"`
|
Pruned uint `json:"pruned"`
|
||||||
|
|
Loading…
Reference in a new issue