Skip to content

Commit 7c62b71

Browse files
sebm253topi314
andauthored
Add role gradient colors (#453)
* reformat imports & update .editorconfig * Add role gradient colors * i have no idea whats going on --------- Co-authored-by: topi314 <[email protected]>
1 parent 6267de0 commit 7c62b71

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

discord/guild.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const (
108108
GuildFeatureCreatorStorePage GuildFeature = "CREATOR_STORE_PAGE"
109109
GuildFeatureDeveloperSupportServer GuildFeature = "DEVELOPER_SUPPORT_SERVER"
110110
GuildFeatureDiscoverable GuildFeature = "DISCOVERABLE"
111+
GuildFeatureEnhancedRoleColors GuildFeature = "ENHANCED_ROLE_COLORS"
111112
GuildFeatureFeaturable GuildFeature = "FEATURABLE"
112113
GuildFeatureInvitesDisabled GuildFeature = "INVITES_DISABLED"
113114
GuildFeatureInviteSplash GuildFeature = "INVITE_SPLASH"

discord/role.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Role struct {
1616
Name string `json:"name"`
1717
Description *string `json:"description,omitempty"`
1818
Color int `json:"color"`
19+
RoleColors RoleColors `json:"colors"`
1920
Hoist bool `json:"hoist"`
2021
Position int `json:"position"`
2122
Permissions Permissions `json:"permissions"`
@@ -47,6 +48,12 @@ func (r Role) CreatedAt() time.Time {
4748
return r.ID.Time()
4849
}
4950

51+
type RoleColors struct {
52+
PrimaryColor int `json:"primary_color"`
53+
SecondaryColor *int `json:"secondary_color"`
54+
TertiaryColor *int `json:"tertiary_color"`
55+
}
56+
5057
// RoleTag are tags a Role has
5158
type RoleTag struct {
5259
BotID *snowflake.ID `json:"bot_id,omitempty"`
@@ -69,6 +76,7 @@ type RoleCreate struct {
6976
Name string `json:"name,omitempty"`
7077
Permissions *Permissions `json:"permissions,omitempty"`
7178
Color int `json:"color,omitempty"`
79+
Colors RoleColors `json:"colors,omitempty"`
7280
Hoist bool `json:"hoist,omitempty"`
7381
Icon *Icon `json:"icon,omitempty"`
7482
Emoji string `json:"unicode_emoji,omitempty"`
@@ -77,13 +85,14 @@ type RoleCreate struct {
7785

7886
// RoleUpdate is the payload to update a Role
7987
type RoleUpdate struct {
80-
Name *string `json:"name,omitempty"`
81-
Permissions *Permissions `json:"permissions,omitempty"`
82-
Color *int `json:"color,omitempty"`
83-
Hoist *bool `json:"hoist,omitempty"`
84-
Icon omit.Omit[*Icon] `json:"icon,omitzero"`
85-
Emoji *string `json:"unicode_emoji,omitempty"`
86-
Mentionable *bool `json:"mentionable,omitempty"`
88+
Name *string `json:"name,omitempty"`
89+
Permissions *Permissions `json:"permissions,omitempty"`
90+
Color *int `json:"color,omitempty"`
91+
Colors omit.Omit[*RoleColors] `json:"colors,omitzero"`
92+
Hoist *bool `json:"hoist,omitempty"`
93+
Icon omit.Omit[*Icon] `json:"icon,omitzero"`
94+
Emoji *string `json:"unicode_emoji,omitempty"`
95+
Mentionable *bool `json:"mentionable,omitempty"`
8796
}
8897

8998
// RolePositionUpdate is the payload to update a Role(s) position

0 commit comments

Comments
 (0)