Skip to content

Commit ee57528

Browse files
committed
feat: RoleColorsResolvable
1 parent 62c83bc commit ee57528

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
@@ -2829,6 +2829,12 @@ export interface RoleColors {
28292829
tertiaryColor: number | null;
28302830
}
28312831

2832+
export interface RoleColorsResolvable {
2833+
primaryColor: ColorResolvable;
2834+
secondaryColor?: ColorResolvable;
2835+
tertiaryColor?: ColorResolvable;
2836+
}
2837+
28322838
export class Role extends Base {
28332839
private constructor(client: Client<true>, data: APIRole, guild: Guild);
28342840
public colors: RoleColors;
@@ -2859,7 +2865,7 @@ export class Role extends Base {
28592865
channel: NonThreadGuildBasedChannel | Snowflake,
28602866
checkAdmin?: boolean,
28612867
): Readonly<PermissionsBitField>;
2862-
public setColors(colors: RoleColors, reason?: string): Promise<Role>;
2868+
public setColors(colors: RoleColorsResolvable, reason?: string): Promise<Role>;
28632869
public setHoist(hoist?: boolean, reason?: string): Promise<Role>;
28642870
public setMentionable(mentionable?: boolean, reason?: string): Promise<Role>;
28652871
public setName(name: string, reason?: string): Promise<Role>;
@@ -6842,7 +6848,7 @@ export interface ResolvedOverwriteOptions {
68426848
}
68436849

68446850
export interface RoleData {
6845-
colors?: RoleColors;
6851+
colors?: RoleColorsResolvable;
68466852
hoist?: boolean;
68476853
icon?: Base64Resolvable | BufferResolvable | EmojiResolvable | null;
68486854
mentionable?: boolean;

0 commit comments

Comments
 (0)