UNPKG

@kotori-bot/core

Version:
95 lines (94 loc) 3.4 kB
/** * @Package @kotori-bot/core * @Version 1.7.2 * @Author Arimura Sena <me@hotaru.icu> * @Copyright 2024-2025 Hotaru. All rights reserved. * @License GPL-3.0 * @Link https://github.com/kotorijs/kotori * @Date 2026/2/14 15:50:13 */ "use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var core_exports = {}; __export(core_exports, { Context: () => Context, Core: () => Core, default: () => core_default }); module.exports = __toCommonJS(core_exports); var import_i18n = __toESM(require("@kotori-bot/i18n")); var import_tools = require("@kotori-bot/tools"); var import_fluoro = __toESM(require("fluoro")); var import_components = require("../components"); var import_global = require("../global"); var import_config = __toESM(require("./config")); var import_message = __toESM(require("./message")); class Context extends import_fluoro.default { [import_global.Symbols.adapter] = /* @__PURE__ */ new Map(); [import_global.Symbols.bot] = /* @__PURE__ */ new Map(); constructor(config) { super(); this.provide("config", new import_config.default(config)); this.mixin("config", ["config", "meta"]); this.provide("message", new import_message.default(this)); this.mixin("message", [ "midware", "command", "regexp", "notify", "boardcast", "task", "filter", import_global.Symbols.command, import_global.Symbols.midware, import_global.Symbols.task, import_global.Symbols.filter, import_global.Symbols.promise, import_global.Symbols.regexp ]); this.provide("http", new import_tools.Http()); this.inject("http"); this.provide("i18n", new import_i18n.default({ lang: this.config.global.lang })); this.inject("i18n"); this.service("cache", new import_components.Cache(this.extends("cache"))); } start() { this.emit("ready"); } stop() { this.emit("dispose"); } } const Core = Context; var core_default = Core; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Context, Core });