From c2e7916aa3f68a39f9a3f9a9702261acc13b5104 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Mon, 25 Jan 2021 17:08:56 +0530 Subject: [PATCH] some changes to Role --- src/structures/role.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/structures/role.ts b/src/structures/role.ts index 6f435c5..f3fea26 100644 --- a/src/structures/role.ts +++ b/src/structures/role.ts @@ -1,12 +1,13 @@ import { Client } from '../models/client.ts' -import { Base } from './base.ts' +import { SnowflakeBase } from './base.ts' import { RoleModifyPayload, RolePayload } from '../types/role.ts' import { Permissions } from '../utils/permissions.ts' import { Guild } from './guild.ts' import { Member } from './member.ts' import { User } from './user.ts' -export class Role extends Base { +/** Represents a Guild Role */ +export class Role extends SnowflakeBase { id: string guild: Guild name: string @@ -52,6 +53,17 @@ export class Role extends Base { this.mentionable = data.mentionable ?? this.mentionable } + /** Delete the Role */ + async delete(): Promise { + return this.guild.roles.delete(this) + } + + /** Edit the Role */ + async edit(options: RoleModifyPayload): Promise { + return this.guild.roles.edit(this, options) + } + + /** Add the Role to a Member */ async addTo(member: Member | User | string): Promise { if (member instanceof User) { member = member.id @@ -68,6 +80,7 @@ export class Role extends Base { return member.roles.add(this.id) } + /** Remove the Role from a Member */ async removeFrom(member: Member | User | string): Promise { if (member instanceof User) { member = member.id @@ -83,14 +96,6 @@ export class Role extends Base { return member.roles.remove(this.id) } - - async delete(): Promise { - return this.guild.roles.delete(this) - } - - async edit(options: RoleModifyPayload): Promise { - return this.guild.roles.edit(this, options) - } } export interface RoleTags {