Skip to content

Commit 9f1ff20

Browse files
committed
feat: add role gradient support
Ref: discord/discord-api-docs#7549
1 parent 997c573 commit 9f1ff20

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Added:
99
- Added `collectibles` to users
10+
- Added `colors` to roles (supporting role gradients)
1011
## [6.4.2] - 2025-06-15
1112
### Fixed:
1213
- Fix express apps being forced to use `express.json` in the entire app ([#633](https://github.com/Snazzah/slash-create/pull/633))

src/constants.ts

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ export interface UserNameplate {
794794
/** @private */
795795
export interface ResolvedRole {
796796
color: number;
797+
colors: RoleColors;
797798
hoist: boolean;
798799
id: string;
799800
icon?: string;
@@ -806,6 +807,32 @@ export interface ResolvedRole {
806807
tags?: RoleTags;
807808
}
808809

810+
/** A role's tags */
811+
export interface RoleTags {
812+
/** The ID of the bot that belongs to the role */
813+
bot_id?: string;
814+
/** The ID of the integration that belongs to the role */
815+
integration_id?: string;
816+
/** Whether this is the guild's booster role */
817+
premium_subscriber?: null;
818+
/** The ID of this role's subscription SKU and listing */
819+
subscription_listing_id?: string;
820+
/** Whether this role can be purchased */
821+
available_for_purchase?: null;
822+
/** Whether this is a guild's linked role */
823+
guild_connections?: null;
824+
}
825+
826+
/** A role's colors */
827+
export interface RoleColors {
828+
/** The primary color for the role */
829+
primary_color: number;
830+
/** The secondary color for the role */
831+
secondary_color: number | null;
832+
/** The tertiary color for the role */
833+
tertiary_color: number | null;
834+
}
835+
809836
/** @private */
810837
export interface CommandChannel {
811838
type: ChannelType;
@@ -881,22 +908,6 @@ export interface ForumDefaultReaction {
881908
emoji_id: string | null;
882909
}
883910

884-
/** A role's tags */
885-
export interface RoleTags {
886-
/** The ID of the bot that belongs to the role */
887-
bot_id?: string;
888-
/** The ID of the integration that belongs to the role */
889-
integration_id?: string;
890-
/** Whether this is the guild's booster role */
891-
premium_subscriber?: null;
892-
/** The ID of this role's subscription SKU and listing */
893-
subscription_listing_id?: string;
894-
/** Whether this role can be purchased */
895-
available_for_purchase?: null;
896-
/** Whether this is a guild's linked role */
897-
guild_connections?: null;
898-
}
899-
900911
/** @hidden */
901912
export interface UserObject extends CommandUser {
902913
/** Whether this user is a bot. */

src/structures/role.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ImageFormats,
66
ImageSizeBoundaries,
77
ResolvedRole,
8+
RoleColors,
89
RoleTags
910
} from '../constants';
1011
import { BaseSlashCreator } from '../creator';
@@ -20,6 +21,8 @@ export class Role {
2021
readonly position: number;
2122
/** The role's color integer */
2223
readonly color: number;
24+
/** The role's colors */
25+
readonly colors: RoleColors;
2326
/** Whether the role is being hoisted */
2427
readonly hoist: boolean;
2528
/** The role icon hash */
@@ -49,6 +52,7 @@ export class Role {
4952
this.name = data.name;
5053
this.position = data.position;
5154
this.color = data.color;
55+
this.colors = data.colors;
5256
this.hoist = data.hoist;
5357
if (data.icon) this.icon = data.icon;
5458
this.managed = data.managed;

0 commit comments

Comments
 (0)