diff --git a/packages/rest/__tests__/CDN.test.ts b/packages/rest/__tests__/CDN.test.ts index 076bb89..dd7a3eb 100644 --- a/packages/rest/__tests__/CDN.test.ts +++ b/packages/rest/__tests__/CDN.test.ts @@ -64,6 +64,10 @@ test('guildIcon dynamic-not-animated', () => { expect(cdn.icon(id, hash, { dynamic: true })).toBe(`${base}/icons/${id}/${hash}.png`); }); +test('role icon default', () => { + expect(cdn.roleIcon(id, hash)).toBe(`${base}/role-icons/${id}/${hash}.png`); +}); + test('splash default', () => { expect(cdn.splash(id, hash)).toBe(`${base}/splashes/${id}/${hash}.png`); }); diff --git a/packages/rest/src/lib/CDN.ts b/packages/rest/src/lib/CDN.ts index f0d6d10..d2fa037 100644 --- a/packages/rest/src/lib/CDN.ts +++ b/packages/rest/src/lib/CDN.ts @@ -107,6 +107,16 @@ export class CDN { return this.makeURL(`/icons/${guildId}/${iconHash}`, options); } + /** + * Generates a URL for the icon of a role + * @param roleId The id of the role that has the icon + * @param roleIconHash The hash provided by Discord for this role icon + * @param options Optional options for the role icon + */ + public roleIcon(roleId: string, roleIconHash: string, options?: ImageURLOptions): string { + return this.makeURL(`/role-icons/${roleId}/${roleIconHash}`, options); + } + /** * Generates a guild invite splash URL for a guild's invite splash. * @param guildId The guild id that has the invite splash