Skip to content

Commit d5468b2

Browse files
committed
feat: RoleColorsResolvable
1 parent 370fb31 commit d5468b2

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

packages/discord.js/src/managers/RoleManager.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ class RoleManager extends CachedManager {
110110
*/
111111

112112
/**
113-
* @typedef {Object} RoleColors
114-
* @property {number} primaryColor The primary color of the role
115-
* @property {?number} secondaryColor The secondary color of the role.
113+
* @typedef {Object} RoleColorsResolvable
114+
* @property {ColorResolvable} primaryColor The primary color of the role
115+
* @property {ColorResolvable} [secondaryColor] The secondary color of the role.
116116
* This will make the role a gradient between the other provided colors
117-
* @property {?number} tertiaryColor The tertiary color of the role.
117+
* @property {ColorResolvable} [tertiaryColor] The tertiary color of the role.
118118
* When sending `tertiaryColor` the API enforces the role color to be a holographic style with values of `primaryColor = 11127295`, `secondaryColor = 16759788`, and `tertiaryColor = 16761760`
119119
*/
120120

@@ -123,7 +123,7 @@ class RoleManager extends CachedManager {
123123
*
124124
* @typedef {Object} RoleCreateOptions
125125
* @property {string} [name] The name of the new role
126-
* @property {RoleColors} [colors] The colors to create the role with
126+
* @property {RoleColorsResolvable} [colors] The colors to create the role with
127127
* @property {boolean} [hoist] Whether or not the new role should be hoisted
128128
* @property {PermissionResolvable} [permissions] The permissions for the new role
129129
* @property {number} [position] The position of the new role

packages/discord.js/src/structures/Role.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ class Role extends Base {
5757
this.name = data.name;
5858
}
5959

60+
/**
61+
* @typedef {Object} RoleColors
62+
* @property {number} primaryColor The primary color of the role
63+
* @property {?number} secondaryColor The secondary color of the role.
64+
* This will make the role a gradient between the other provided colors
65+
* @property {?number} tertiaryColor The tertiary color of the role.
66+
* When sending `tertiaryColor` the API enforces the role color to be a holographic style with values of `primaryColor = 11127295`, `secondaryColor = 16759788`, and `tertiaryColor = 16761760`
67+
*/
68+
6069
if ('colors' in data) {
6170
/**
6271
* The colors of the role
@@ -261,7 +270,7 @@ class Role extends Base {
261270
*
262271
* @typedef {Object} RoleData
263272
* @property {string} [name] The name of the role
264-
* @property {RoleColors} [colors] The colors of the role
273+
* @property {RoleColorsResolvable} [colors] The colors of the role
265274
* @property {boolean} [hoist] Whether or not the role should be hoisted
266275
* @property {number} [position] The position of the role
267276
* @property {PermissionResolvable} [permissions] The permissions of the role
@@ -321,7 +330,7 @@ class Role extends Base {
321330
/**
322331
* Sets new colors for the role.
323332
*
324-
* @param {RoleColors} colors The colors of the role
333+
* @param {RoleColorsResolvable} colors The colors of the role
325334
* @param {string} [reason] Reason for changing the role's colors
326335
* @returns {Promise<Role>}
327336
* @example

packages/discord.js/typings/index.d.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,6 +2840,12 @@ export interface RoleColors {
28402840
tertiaryColor: number | null;
28412841
}
28422842

2843+
export interface RoleColorsResolvable {
2844+
primaryColor: ColorResolvable;
2845+
secondaryColor?: ColorResolvable;
2846+
tertiaryColor?: ColorResolvable;
2847+
}
2848+
28432849
export class Role extends Base {
28442850
private constructor(client: Client<true>, data: APIRole, guild: Guild);
28452851
public colors: RoleColors;
@@ -2870,7 +2876,7 @@ export class Role extends Base {
28702876
channel: NonThreadGuildBasedChannel | Snowflake,
28712877
checkAdmin?: boolean,
28722878
): Readonly<PermissionsBitField>;
2873-
public setColors(colors: RoleColors, reason?: string): Promise<Role>;
2879+
public setColors(colors: RoleColorsResolvable, reason?: string): Promise<Role>;
28742880
public setHoist(hoist?: boolean, reason?: string): Promise<Role>;
28752881
public setMentionable(mentionable?: boolean, reason?: string): Promise<Role>;
28762882
public setName(name: string, reason?: string): Promise<Role>;
@@ -6803,7 +6809,7 @@ export interface ResolvedOverwriteOptions {
68036809
}
68046810

68056811
export interface RoleData {
6806-
colors?: RoleColors;
6812+
colors?: RoleColorsResolvable;
68076813
hoist?: boolean;
68086814
icon?: Base64Resolvable | BufferResolvable | EmojiResolvable | null;
68096815
mentionable?: boolean;

0 commit comments

Comments
 (0)