This commit is contained in:
ayntee
2020-11-27 10:14:07 -08:00
4 changed files with 36 additions and 6 deletions

View File

@@ -2,10 +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 (tags ?? {}),
integrationID: tags?.integration_id,
};
return {
...data,
...rest,
/** The @ mention of the role in a string. */
mention: `<@&${data.id}>`,
tags: roleTags,
};
}