Files
discordeno/structures/role.ts
2020-02-25 22:56:15 -05:00

27 lines
831 B
TypeScript

import { Role_Data } from '../types/role.ts'
export const create_role = (data: Role_Data) => ({
/** The entire raw Role data */
raw: () => data,
/** role id */
id: () => data.id,
/** role name */
name: () => data.name,
/** integer representation of hexadecimal color code */
color: () => data.color,
/** if this role is pinned in the user listing */
hoist: () => data.hoist,
/** position of this role */
position: () => data.position,
/** permission bit set */
permissions: () => data.permissions,
/** whether this role is managed by an integration */
managed: () => data.managed,
/** whether this role is mentionable */
mentionable: () => data.mentionable,
/** The @ mention of the role in a string. */
mention: () => `<@&${data.id}>`
})
export type Role = ReturnType<typeof create_role>