1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 17:23:00 +00:00
This commit is contained in:
mavolin 2020-05-11 01:48:26 +02:00
parent 1b990cd58d
commit 984c8f0239
No known key found for this signature in database
GPG key ID: D8681218EDF216DF

View file

@ -233,25 +233,18 @@ func (c *Client) AttachIntegration(
)
}
// 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
}
// 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"`
}
param.ExpireBehavior = expireBehavior
param.ExpireGracePeriod = expireGracePeriod
param.EnableEmoticons = emoticons
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),
)
}