mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-27 17:23:00 +00:00
API: fix #35
This commit is contained in:
parent
1b990cd58d
commit
984c8f0239
25
api/guild.go
25
api/guild.go
|
@ -233,25 +233,18 @@ func (c *Client) AttachIntegration(
|
|||
)
|
||||
}
|
||||
|
||||
// ModifyIntegration requires MANAGE_GUILD.
|
||||
func (c *Client) ModifyIntegration(
|
||||
guildID, integrationID discord.Snowflake,
|
||||
expireBehavior, expireGracePeriod int, emoticons bool) error {
|
||||
|
||||
var param struct {
|
||||
ExpireBehavior int `json:"expire_behavior"`
|
||||
ExpireGracePeriod int `json:"expire_grace_period"`
|
||||
EnableEmoticons bool `json:"enable_emoticons"`
|
||||
// https://discord.com/developers/docs/resources/guild#modify-guild-integration-json-params
|
||||
type ModifyIntegrationData struct {
|
||||
ExpireBehavior *discord.ExpireBehavior `json:"expire_behavior"`
|
||||
ExpireGracePeriod json.OptionInt `json:"expire_grace_period"`
|
||||
EnableEmoticons json.OptionBool `json:"enable_emoticons"` // limited to twitch
|
||||
}
|
||||
|
||||
param.ExpireBehavior = expireBehavior
|
||||
param.ExpireGracePeriod = expireGracePeriod
|
||||
param.EnableEmoticons = emoticons
|
||||
|
||||
// ModifyIntegration requires MANAGE_GUILD.
|
||||
func (c *Client) ModifyIntegration(guildID, integrationID discord.Snowflake, data ModifyIntegrationData) error {
|
||||
return c.FastRequest(
|
||||
"PATCH",
|
||||
EndpointGuilds+guildID.String()+"/integrations/"+integrationID.String(),
|
||||
httputil.WithSchema(c, param),
|
||||
"PATCH", EndpointGuilds+guildID.String()+"/integrations/"+integrationID.String(),
|
||||
httputil.WithJSONBody(data),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue