From d04b402d3ea0c3a070609d26abbe0e17265134d2 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Tue, 11 Apr 2023 20:01:41 +0100 Subject: [PATCH] fix: permissions calculation for user should consider their ID not ours --- src/classes/User.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/classes/User.ts b/src/classes/User.ts index 9decb301..75d623ec 100644 --- a/src/classes/User.ts +++ b/src/classes/User.ts @@ -145,16 +145,14 @@ export class User { } if ( - this.#collection.client.channels - .toList() - .find( - (channel) => - (channel.type === "Group" || channel.type === "DirectMessage") && - channel.recipientIds.has(this.#collection.client.user!.id) - ) || - this.#collection.client.serverMembers - .toList() - .find((member) => member.id.user === this.#collection.client.user!.id) + this.#collection.client.channels.find( + (channel) => + (channel.type === "Group" || channel.type === "DirectMessage") && + channel.recipientIds.has(this.id) + ) || + this.#collection.client.serverMembers.find( + (member) => member.id.user === this.id + ) ) { if (this.#collection.client.user?.bot || this.bot) { permissions |= UserPermission.SendMessage;