mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 09:20:08 +00:00
chore: use DiscordBitwisePermissionFlags and PermissionStrings
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { getGatewayBot } from "./helpers/misc/get_gateway_bot.ts";
|
||||
import { DiscordGatewayIntents } from "./types/gateway/gateway_intents.ts";
|
||||
import { baseEndpoints, GATEWAY_VERSION } from "./util/constants.ts";
|
||||
import { spawnShards } from "./ws/shard_manager.ts";
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { botId } from "../bot.ts";
|
||||
import { cacheHandlers } from "../cache.ts";
|
||||
import { Channel, Guild, Member, Role } from "../structures/mod.ts";
|
||||
import {
|
||||
DiscordBitwisePermissionFlags,
|
||||
PermissionStrings,
|
||||
} from "../types/mod.ts";
|
||||
|
||||
async function getCached(
|
||||
table: "guilds",
|
||||
@@ -174,12 +178,14 @@ export function botHasChannelPermissions(
|
||||
/** Returns the permissions that are not in the given permissionBits */
|
||||
export function missingPermissions(
|
||||
permissionBits: string,
|
||||
permissions: Permission[],
|
||||
permissions: PermissionStrings[],
|
||||
) {
|
||||
if (BigInt(permissionBits) & 8n) return [];
|
||||
|
||||
return permissions.filter(
|
||||
(permission) => !(BigInt(permissionBits) & BigInt(Permissions[permission])),
|
||||
(permission) =>
|
||||
!(BigInt(permissionBits) &
|
||||
BigInt(DiscordBitwisePermissionFlags[permission])),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user