mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
* Plugins/Permissions: FIX PARITY ISSUES What is parity issues? Parity issues are files that exist but structured one way in the base/vanilla discordeno library, and structured another way in the permisison plugin. * deno fmt * plugins/permissions: nuke validations * plugins/permissions VALIDATIONS -> plugins/validations * plugins/validations: slash commands max 4000 chars * fix module not found
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { BotWithCache } from "./deps.ts";
|
|
import { channels } from "./src/channels/mod.ts";
|
|
import setupDiscoveryPermChecks from "./src/discovery.ts";
|
|
import { emojis } from "./src/emojis/mod.ts";
|
|
import { guilds } from "./src/guilds/mod.ts";
|
|
import { integrations } from "./src/integrations/mod.ts";
|
|
import { members } from "./src/members/mod.ts";
|
|
import { messages } from "./src/messages/mod.ts";
|
|
import { roles } from "./src/roles/mod.ts";
|
|
import { webhooks } from "./src/webhooks/mod.ts";
|
|
|
|
// PLUGINS MUST TAKE A BOT ARGUMENT WHICH WILL BE MODIFIED
|
|
export function enablePermissionsPlugin<B extends BotWithCache = BotWithCache>(bot: B): B {
|
|
// PERM CHECKS REQUIRE CACHE DUH!
|
|
if (!bot.enabledPlugins?.has("CACHE")) throw new Error("The PERMISSIONS plugin requires the CACHE plugin first.");
|
|
|
|
// MARK THIS PLUGIN BEING USED
|
|
bot.enabledPlugins.add("PERMISSIONS");
|
|
|
|
// BEGIN OVERRIDING HELPER FUNCTIONS
|
|
setupDiscoveryPermChecks(bot);
|
|
channels(bot);
|
|
emojis(bot);
|
|
guilds(bot);
|
|
integrations(bot);
|
|
members(bot);
|
|
messages(bot);
|
|
roles(bot);
|
|
webhooks(bot);
|
|
|
|
// PLUGINS MUST RETURN THE BOT
|
|
return bot;
|
|
}
|
|
|
|
export * from "./src/permissions.ts";
|
|
// DEFAULT MAKES IT SLIGHTLY EASIER TO USE
|
|
export default enablePermissionsPlugin;
|