mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-06-30 16:46:11 +00:00
API: fix #35
This commit is contained in:
parent
1b990cd58d
commit
984c8f0239
27
api/guild.go
27
api/guild.go
|
@ -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.
|
// ModifyIntegration requires MANAGE_GUILD.
|
||||||
func (c *Client) ModifyIntegration(
|
func (c *Client) ModifyIntegration(guildID, integrationID discord.Snowflake, data ModifyIntegrationData) error {
|
||||||
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
|
|
||||||
|
|
||||||
return c.FastRequest(
|
return c.FastRequest(
|
||||||
"PATCH",
|
"PATCH", EndpointGuilds+guildID.String()+"/integrations/"+integrationID.String(),
|
||||||
EndpointGuilds+guildID.String()+"/integrations/"+integrationID.String(),
|
httputil.WithJSONBody(data),
|
||||||
httputil.WithSchema(c, param),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue