generated from nhcarrigan/template
feat: check discord entitlements
This commit is contained in:
parent
7437deab71
commit
b64871791d
@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "20",
|
"node": "20",
|
||||||
"pnpm": "8"
|
"pnpm": "9"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/nhcarrigan/mod-bot#readme",
|
"homepage": "https://github.com/nhcarrigan/mod-bot#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
4804
pnpm-lock.yaml
generated
4804
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -13,9 +13,17 @@ import { ExtendedClient } from "../interfaces/ExtendedClient";
|
|||||||
export const checkEntitledGuild = async (
|
export const checkEntitledGuild = async (
|
||||||
bot: ExtendedClient,
|
bot: ExtendedClient,
|
||||||
guild: Guild
|
guild: Guild
|
||||||
): Promise<boolean> =>
|
): Promise<boolean> => {
|
||||||
Boolean(
|
const isGuildEntitled = await bot.application?.entitlements
|
||||||
await bot.db.entitlements
|
.fetch({
|
||||||
|
guild,
|
||||||
|
excludeEnded: true
|
||||||
|
})
|
||||||
|
.catch(() => null);
|
||||||
|
const isManuallyEntitled = await bot.db.entitlements
|
||||||
.findFirst({ where: { serverId: guild.id } })
|
.findFirst({ where: { serverId: guild.id } })
|
||||||
.catch(() => null)
|
.catch(() => null);
|
||||||
|
return Boolean(
|
||||||
|
(isGuildEntitled && isGuildEntitled.size) || isManuallyEntitled
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user