This commit is contained in:
ayntee
2020-11-03 05:50:02 -08:00
parent ec3a6f21e2
commit fc9b721503
2 changed files with 13 additions and 9 deletions
+10 -6
View File
@@ -2,15 +2,19 @@ import { Unpromise } from "../types/misc.ts";
import { RoleData } from "../types/role.ts"; import { RoleData } from "../types/role.ts";
export async function createRole(data: RoleData) { 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 { return {
...data, ...rest,
/** The @ mention of the role in a string. */ /** The @ mention of the role in a string. */
mention: `<@&${data.id}>`, mention: `<@&${data.id}>`,
tags: { tags: roleTags,
botID: data.tags?.botID,
premiumSubscriber: "premium_subscriber" in (data.tags ?? {}),
integrationID: data.tags?.integrationID,
},
}; };
} }
+3 -3
View File
@@ -20,7 +20,7 @@ export interface RoleData {
} }
export interface RoleTags { export interface RoleTags {
botID?: string; bot_id?: string;
premiumSubscriber?: boolean; premium_subscriber?: boolean;
integrationID?: string; integration_id?: string;
} }