mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-09 05:27:22 +00:00
Merge pull request #75 from mavolin/74-guild-widget
This commit is contained in:
commit
24e29ecb38
30
api/guild.go
30
api/guild.go
|
@ -376,28 +376,34 @@ func (c *Client) SyncIntegration(guildID, integrationID discord.Snowflake) error
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GuildEmbed returns the guild embed object.
|
// GuildWidget returns the guild widget object.
|
||||||
//
|
//
|
||||||
// Requires the MANAGE_GUILD permission.
|
// Requires the MANAGE_GUILD permission.
|
||||||
func (c *Client) GuildEmbed(guildID discord.Snowflake) (*discord.GuildEmbed, error) {
|
func (c *Client) GuildWidget(guildID discord.Snowflake) (*discord.GuildWidget, error) {
|
||||||
var ge *discord.GuildEmbed
|
var ge *discord.GuildWidget
|
||||||
return ge, c.RequestJSON(&ge, "GET", EndpointGuilds+guildID.String()+"/embed")
|
return ge, c.RequestJSON(&ge, "GET", EndpointGuilds+guildID.String()+"/embed")
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://discord.com/developers/docs/resources/guild#guild-embed-object-guild-embed-structure
|
// https://discord.com/developers/docs/resources/guild#guild-embed-object-guild-embed-structure
|
||||||
type ModifyGuildEmbedData struct {
|
type ModifyGuildWidgetData struct {
|
||||||
Enabled option.Bool `json:"enabled,omitempty"`
|
// Enabled specifies whether the widget is enabled.
|
||||||
|
Enabled option.Bool `json:"enabled,omitempty"`
|
||||||
|
// ChannelID is the widget channel id.
|
||||||
ChannelID discord.Snowflake `json:"channel_id,omitempty"`
|
ChannelID discord.Snowflake `json:"channel_id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModifyGuildEmbed modifies the guild embed and updates the passed in
|
// ModifyGuildWidget modifies a guild widget object for the guild.
|
||||||
// GuildEmbed data.
|
|
||||||
//
|
//
|
||||||
// This method should be used with care: if you still want the embed enabled,
|
// Requires the MANAGE_GUILD permission.
|
||||||
// you need to set the Enabled boolean, even if it's already enabled. If you
|
func (c *Client) ModifyGuildWidget(
|
||||||
// don't, JSON will default it to false.
|
guildID discord.Snowflake, data ModifyGuildWidgetData) (*discord.GuildWidget, error) {
|
||||||
func (c *Client) ModifyGuildEmbed(guildID discord.Snowflake, data discord.GuildEmbed) error {
|
|
||||||
return c.RequestJSON(&data, "PATCH", EndpointGuilds+guildID.String()+"/embed")
|
var w *discord.GuildWidget
|
||||||
|
return w, c.RequestJSON(
|
||||||
|
&w, "PATCH",
|
||||||
|
EndpointGuilds+guildID.String()+"/embed",
|
||||||
|
httputil.WithJSONBody(data),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GuildVanityURL returns *Invite for guilds that have that feature enabled,
|
// GuildVanityURL returns *Invite for guilds that have that feature enabled,
|
||||||
|
|
|
@ -296,8 +296,11 @@ type Integration struct {
|
||||||
SyncedAt Timestamp `json:"synced_at"`
|
SyncedAt Timestamp `json:"synced_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GuildEmbed struct {
|
// https://discord.com/developers/docs/resources/guild#guild-widget-object
|
||||||
Enabled bool `json:"enabled"`
|
type GuildWidget struct {
|
||||||
|
// Enabled specifies whether the widget is enabled.
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
// ChannelID is the widget channel id.
|
||||||
ChannelID Snowflake `json:"channel_id,omitempty"`
|
ChannelID Snowflake `json:"channel_id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue