UNPKG

2.54 kBTypeScriptView Raw
1import { Client } from "discord.js";
2import CommandSystem, { PermissionSetEntityStub, CommandHandler } from "./commands";
3import { Context } from "./commands/commands";
4import BKConstants from "./Constants";
5import "./node-additions";
6export interface RoleOptions {
7 moderator: string[];
8 admin: string[];
9 root: string[];
10}
11export interface ApplicationOptions<T extends PermissionSetEntityStub> {
12 /**
13 * discord token. required unless you pass a client which has already been logged-in
14 */
15 token?: string;
16 /**
17 * discord client. if not passed, the application will create one.
18 */
19 client?: Client;
20 /**
21 * directory to load command files from
22 */
23 commandDirectory?: string;
24 /**
25 * whether or not command categories should default to their parent folder name.
26 * default is false
27 */
28 automaticCategoryNames?: boolean;
29 /**
30 * message prefix for commands
31 */
32 commandPrefix?: typeof Constants['COMMAND_PREFIX'];
33 /**
34 * whether to render errors in plaintext or embeds
35 */
36 errorFormat?: BKConstants.ErrorFormat;
37 /**
38 * Commands to exclude from bot loading
39 */
40 preloadExclude?: string[];
41 /**
42 * Function that adds additional variables to eval contexts
43 */
44 contextPopulator?: (context: Context) => Context;
45 /**
46 * The permissions entity that BotKit should query to determine command accessibility
47 */
48 permissionsEntity?: T;
49 /**
50 * The reference to the superusers on this instance
51 */
52 superuserCheck?: (id: string) => boolean;
53 /**
54 * The global guards to use
55 */
56 globalGuards?: CommandHandler[];
57 /**
58 * Advanced overrides. Do not modify things without knowing what they do.
59 */
60 overrides?: {
61 commandSystem?: {
62 features?: {
63 nodeBasedPermissions?: false;
64 superuserPermissions?: false;
65 };
66 };
67 };
68}
69/**
70 * Initializes the framework
71 */
72export declare class Application<T extends PermissionSetEntityStub = PermissionSetEntityStub> {
73 options: ApplicationOptions<T>;
74 readonly client: Client;
75 readonly commandSystem: CommandSystem;
76 constructor(options: ApplicationOptions<T>);
77 /**
78 * Sets the Discord client up and loads the command system
79 */
80 init(): Promise<void>;
81}
82export default Application;
83export * from "./commands";
84export declare const Constants: typeof BKConstants;
85export * from "./db";
86export * from "./modules";
87export * from "./util";