summary refs log tree commit diff
path: root/util/src
diff options
context:
space:
mode:
Diffstat (limited to 'util/src')
-rw-r--r--util/src/util/Permissions.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/util/src/util/Permissions.ts b/util/src/util/Permissions.ts
index 94fb3b51..ab8dd9b1 100644
--- a/util/src/util/Permissions.ts
+++ b/util/src/util/Permissions.ts
@@ -254,7 +254,7 @@ export async function getPermission(
 		if (guild.owner_id === user_id) return new Permissions(Permissions.FLAGS.ADMINISTRATOR);
 
 		member = await Member.findOneOrFail({
-			where: { guild_id, user_id },
+			where: { guild_id, id: user_id },
 			relations: ["roles", ...(opts.member_relations || [])],
 			select: [
 				"id",
@@ -265,6 +265,9 @@ export async function getPermission(
 		});
 	}
 
+	let recipient_ids: any = channel?.recipients?.map((x) => x.id);
+	if (!recipient_ids?.length) recipient_ids = null;
+
 	// TODO: remove guild.roles and convert recipient_ids to recipients
 	var permission = Permissions.finalPermission({
 		user: {
@@ -277,7 +280,7 @@ export async function getPermission(
 		channel: {
 			overwrites: channel?.permission_overwrites,
 			owner_id: channel?.owner_id,
-			recipient_ids: channel?.recipients?.map((x) => x.id),
+			recipient_ids,
 		},
 	});