diff --git a/src/structures/role.ts b/src/structures/role.ts index 01ada1d..ed2e821 100644 --- a/src/structures/role.ts +++ b/src/structures/role.ts @@ -12,14 +12,7 @@ export class Role extends Base { permissions: Permissions managed: boolean mentionable: boolean - - get mention(): string { - return `<@&${this.id}>` - } - - toString(): string { - return this.mention - } + tags?: RoleTags constructor(client: Client, data: RolePayload) { super(client, data) @@ -31,6 +24,14 @@ export class Role extends Base { this.permissions = new Permissions(data.permissions) this.managed = data.managed this.mentionable = data.mentionable + this.tags = + data.tags !== undefined + ? { + botID: data.tags?.bot_id, + integrationID: data.tags?.integration_id, + premiumSubscriber: 'premium_subscriber' in (data.tags ?? {}) + } + : undefined } readFromData(data: RolePayload): void { @@ -46,3 +47,12 @@ export class Role extends Base { this.mentionable = data.mentionable ?? this.mentionable } } + +export interface RoleTags { + /** The id of the bot who has this role */ + botID?: string + /** Whether this is the premium subscriber role for this guild */ + premiumSubscriber: boolean + /** The id of the integration this role belongs to */ + integrationID?: string +} diff --git a/src/types/role.ts b/src/types/role.ts index 78f43d6..5ddfee8 100644 --- a/src/types/role.ts +++ b/src/types/role.ts @@ -7,4 +7,14 @@ export interface RolePayload { permissions: string managed: boolean mentionable: boolean + tags?: RoleTagsPayload +} + +export interface RoleTagsPayload { + /** The id of the bot who has this role */ + bot_id?: string + /** Whether this is the premium subscriber role for this guild */ + premium_subscriber?: null + /** The id of the integration this role belongs to */ + integration_id?: string }