From fc9b7215036af123db5304a8525c4476b1c2b26d Mon Sep 17 00:00:00 2001 From: ayntee Date: Tue, 3 Nov 2020 05:50:02 -0800 Subject: [PATCH] Oopsie --- src/structures/role.ts | 16 ++++++++++------ src/types/role.ts | 6 +++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/structures/role.ts b/src/structures/role.ts index 9179c06d8..e6b598b46 100644 --- a/src/structures/role.ts +++ b/src/structures/role.ts @@ -2,15 +2,19 @@ import { Unpromise } from "../types/misc.ts"; import { RoleData } from "../types/role.ts"; export async function createRole(data: RoleData) { + const { tags, ...rest } = data; + + const roleTags = { + botID: tags?.bot_id, + premiumSubscriber: "premium_subscriber" in (data.tags ?? {}), + integrationID: data.tags?.integration_id, + }; + return { - ...data, + ...rest, /** The @ mention of the role in a string. */ mention: `<@&${data.id}>`, - tags: { - botID: data.tags?.botID, - premiumSubscriber: "premium_subscriber" in (data.tags ?? {}), - integrationID: data.tags?.integrationID, - }, + tags: roleTags, }; } diff --git a/src/types/role.ts b/src/types/role.ts index 78011d198..0139a2906 100644 --- a/src/types/role.ts +++ b/src/types/role.ts @@ -20,7 +20,7 @@ export interface RoleData { } export interface RoleTags { - botID?: string; - premiumSubscriber?: boolean; - integrationID?: string; + bot_id?: string; + premium_subscriber?: boolean; + integration_id?: string; }