fix(lib/perm): now the bot by-pass the whitelist

- The nuke command wasn't possible is the bot wasn't whitelist
- My vision of the whitelist is to restrict people (other bots too) not
block the bot itself
This commit is contained in:
Raphael 2025-11-14 22:11:54 +01:00 committed by Raphaël
parent 7b365660f5
commit 70a1d75344

View file

@ -1,4 +1,5 @@
import { prisma } from '@lib/prisma';
import { client } from '@lib/client';
import { User as UserPrisma } from '@prisma/client';
/**
@ -7,6 +8,9 @@ import { User as UserPrisma } from '@prisma/client';
* @returns true if the user is whitelisted flase overwise
*/
export async function isWhitelisted(userId: string, guildId: string): Promise<boolean> {
if (client.user?.id == userId) {
return true;
}
const userData: UserPrisma = await prisma.user.findUnique({
where: {
id: userId,
@ -22,5 +26,5 @@ export async function isWhitelisted(userId: string, guildId: string): Promise<bo
},
},
});
return (userData.isOwner || userData.isBuyer || count != 0);
return (userData.isDev || userData.isOwner || userData.isBuyer || count != 0);
}