UNPKG

4.26 kBSource Map (JSON)View Raw
1{"version":3,"file":"index.js","sourceRoot":"./src/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,2CAAoC;AACpC,0DAAoE;AAEpE,4DAAsC;AACtC,4BAA0B;AAC1B,sBAAoB;AAgEpB;;GAEG;AACH,MAAa,WAAW;IAIpB,YAA0B,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;QACpD,mBAAW,CAAC,YAAY,CAAC;YACrB,cAAc,EAAE,OAAO,CAAC,aAAa;YACrC,mBAAmB,EAAE,OAAO,CAAC,WAAW;SAC3C,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI;QACZ,IAAY,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,mBAAM,EAAE,CAAC;QAC3D,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;YAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SAC/C;QAEA,IAAY,CAAC,aAAa,GAAG,IAAI,kBAAa,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,EAAE,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;QACnN,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;CACJ;AAxBD,kCAwBC;AAED,kBAAe,WAAW,CAAC;AAE3B,gCAA2B;AACd,QAAA,SAAS,GAAG,mBAAW,CAAC;AACrC,0BAAqB;AACrB,+BAA0B;AAC1B,4BAAuB","sourcesContent":["import { Client } from \"discord.js\";\nimport CommandSystem, { PermissionSetEntityStub } from \"./commands\";\nimport { Context } from \"./commands/commands\";\nimport BKConstants from \"./Constants\";\nimport \"./node-additions\";\nimport \"./override\";\n\n\nexport interface RoleOptions {\n moderator: string[];\n admin: string[];\n root: string[];\n}\n\nexport interface ApplicationOptions<T extends PermissionSetEntityStub> {\n /**\n * discord token. required unless you pass a client which has already been logged-in\n */\n token?: string;\n /**\n * discord client. if not passed, the application will create one.\n */\n client?: Client;\n /**\n * directory to load command files from\n */\n commandDirectory?: string;\n /**\n * whether or not command categories should default to their parent folder name.\n * default is false\n */\n automaticCategoryNames?: boolean;\n /**\n * message prefix for commands\n */\n commandPrefix?: typeof Constants['COMMAND_PREFIX'];\n /**\n * whether to render errors in plaintext or embeds\n */\n errorFormat?: BKConstants.ErrorFormat;\n /**\n * Commands to exclude from bot loading\n */\n preloadExclude?: string[];\n /**\n * Function that adds additional variables to eval contexts\n */\n contextPopulator?: (context: Context) => Context\n /**\n * The permissions entity that BotKit should query to determine command accessibility\n */\n permissionsEntity?: T;\n /**\n * The reference to the superusers on this instance\n */\n superuserCheck?: (id: string) => boolean;\n /**\n * Advanced overrides. Do not modify things without knowing what they do.\n */\n overrides?: {\n commandSystem?: {\n features?: {\n nodeBasedPermissions?: false;\n superuserPermissions?: false;\n }\n }\n }\n}\n\n/**\n * Initializes the framework\n */\nexport class Application<T extends PermissionSetEntityStub = PermissionSetEntityStub> {\n public readonly client: Client;\n public readonly commandSystem: CommandSystem;\n\n public constructor(public options: ApplicationOptions<T>) {\n BKConstants.applyPatches({\n COMMAND_PREFIX: options.commandPrefix,\n ERROR_RENDER_FORMAT: options.errorFormat\n });\n }\n\n /**\n * Sets the Discord client up and loads the command system\n */\n public async init(): Promise<void> {\n (this as any).client = this.options.client || new Client();\n this.client.botkit = this;\n if (!this.client.readyTimestamp) {\n await this.client.login(this.options.token);\n }\n\n (this as any).commandSystem = new CommandSystem({ directory: this.options.commandDirectory, app: this, preloadExclude: this.options.preloadExclude, automaticCategoryNames: this.options.automaticCategoryNames });\n await this.commandSystem.init();\n }\n}\n\nexport default Application;\n\nexport * from \"./commands\";\nexport const Constants = BKConstants;\nexport * from \"./db\";\nexport * from \"./modules\";\nexport * from \"./util\";\n"]}
\No newline at end of file