summary refs log tree commit diff
path: root/src/util/Permissions.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/Permissions.ts')
-rw-r--r--src/util/Permissions.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts
index d7233536..ae21e138 100644
--- a/src/util/Permissions.ts
+++ b/src/util/Permissions.ts
@@ -5,7 +5,7 @@ import { ChannelDocument, ChannelModel } from "../models/Channel";
 import { ChannelPermissionOverwrite } from "../models/Channel";
 import { Role, RoleModel } from "../models/Role";
 import { BitField } from "./BitField";
-import { GuildDocument } from "../models/Guild";
+import { GuildDocument, GuildModel } from "../models/Guild";
 
 export type PermissionResolvable = bigint | number | Permissions | PermissionResolvable[] | PermissionString;
 
@@ -151,6 +151,10 @@ export async function getPermission(
 ) {
 	var { channel, member } = cache || {};
 
+	const guild = await GuildModel.findOne({ id: guild_id }, { owner_id: true }).exec();
+	if (!guild) throw new Error("Guild not found");
+	if (guild.owner_id === user_id) return new Permissions(Permissions.FLAGS.ADMINISTRATOR);
+
 	member = await MemberModel.findOne({ guild_id, id: user_id }, "roles").exec();
 	if (!member) throw new Error("Member not found");