Commit f516d658 authored by nanahira's avatar nanahira

bump to Koishi 4.8

parent e8671b3a
import { App } from 'koishi';
import { Context } from 'koishi';
import TargetPlugin from '../src';
import ConsolePlugin from '@koishijs/plugin-console';
import SandboxPlugin from '@koishijs/plugin-sandbox';
import * as DatabasePlugin from '@koishijs/plugin-database-memory';
import CachePlugin from '@koishijs/plugin-cache-lru';
import DatabasePlugin from '@koishijs/plugin-database-memory';
// import CachePlugin from '@koishijs/plugin-cache-lru';
import ExtrasInDev from './extras';
const app = new App({
const app = new Context({
port: 14514,
host: 'localhost',
prefix: '.',
......@@ -19,7 +19,7 @@ app.plugin(ConsolePlugin, {
});
// Some services
app.plugin(CachePlugin);
// app.plugin(CachePlugin);
app.plugin(DatabasePlugin);
// Some extras
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -178,8 +178,8 @@ export class Instance {
})
from: string;
getBot(list: Adapter.BotList) {
return list.get(this.from);
getBot(list: Bot[]) {
return list.find((bot) => bot.sid === this.from);
}
@DefineSchema({
......@@ -194,7 +194,7 @@ export class Instance {
})
rules: Rule[];
async run(list: Adapter.BotList) {
async run(list:Bot[]) {
const bot = this.getBot(list);
if (bot?.status !== 'online') {
logger.info(`Skipping job for ${this.from} because it's not online.`);
......@@ -235,7 +235,7 @@ export class GreetingPluginConfig {
@DefineSchema({ description: '实例列表。', type: Instance })
instances: Instance[];
async runInstances(list: Adapter.BotList, instances = this.instances) {
async runInstances(list:Bot[], instances = this.instances) {
const failedInstances = _.compact(
await Promise.all(instances.map((instance) => instance.run(list))),
);
......
......@@ -2,7 +2,7 @@
import { GreetingPluginConfig, Instance } from './config';
import {
DefinePlugin,
BasePlugin,
StarterPlugin,
Inject,
LifecycleEvents,
UseEvent,
......@@ -14,11 +14,11 @@ export * from './config';
@DefinePlugin({ name: 'greeting', schema: GreetingPluginConfig })
export default class GreetingPlugin
extends BasePlugin<GreetingPluginConfig>
extends StarterPlugin(GreetingPluginConfig)
implements LifecycleEvents
{
@Inject()
private bots: Adapter.BotList;
private bots: Bot[];
private job: Job;
......
const path = require('path');
const packgeInfo = require('./package.json');
const { ESBuildMinifyPlugin } = require('esbuild-loader');
function externalsFromDep() {
return Object.fromEntries(
......@@ -43,4 +44,11 @@ module.exports = {
koishi: 'koishi',
...(packAll ? {} : externalsFromDep()),
},
optimization: {
minimizer: [
new ESBuildMinifyPlugin({
keepNames: true,
}),
],
},
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment