From 95c220038631c85631360a15ec0d5ec268d5c03c Mon Sep 17 00:00:00 2001 From: ayntee Date: Sat, 26 Dec 2020 11:05:26 +0400 Subject: [PATCH] Make DjDev happy --- src/structures/emoji.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/structures/emoji.ts b/src/structures/emoji.ts index daa5b03..ec8104b 100644 --- a/src/structures/emoji.ts +++ b/src/structures/emoji.ts @@ -47,9 +47,12 @@ export class Emoji extends Base { async edit(data: ModifyGuildEmojiParams): Promise { if (this.id === null) throw new Error('Emoji ID is not valid.') if (this.guild === undefined) throw new Error('Guild is undefined') + const roles = Array.isArray(data.roles) + ? data.roles?.map((role) => (role instanceof Role ? role.id : role)) + : [data.roles instanceof Role ? data.roles.id : data.roles] const res = await this.client.rest.patch(EMOJI(this.guild.id, this.id), { ...data, - roles: data.roles?.map((role) => role.id) + roles }) return new Emoji(this.client, res) } @@ -79,5 +82,5 @@ export interface ModifyGuildEmojiParams { /** Name of the emoji */ name?: string /** Roles to which this emoji will be whitelisted */ - roles?: Role[] + roles?: string | Role | (string | Role)[] }