Commit aea09422 authored by nanahira's avatar nanahira

bump to Koishi 4.8

parent 4de6d131
import { App } from 'koishi'; import { Context } from 'koishi';
import TargetPlugin from '../src'; import TargetPlugin from '../src';
import ConsolePlugin from '@koishijs/plugin-console'; import ConsolePlugin from '@koishijs/plugin-console';
import SandboxPlugin from '@koishijs/plugin-sandbox'; import SandboxPlugin from '@koishijs/plugin-sandbox';
import * as DatabasePlugin from '@koishijs/plugin-database-memory'; import DatabasePlugin from '@koishijs/plugin-database-memory';
import CachePlugin from '@koishijs/plugin-cache-lru'; // import CachePlugin from '@koishijs/plugin-cache-lru';
import ExtrasInDev from './extras'; import ExtrasInDev from './extras';
const app = new App({ const app = new Context({
port: 14514, port: 14514,
host: 'localhost', host: 'localhost',
prefix: '.', prefix: '.',
...@@ -19,7 +19,7 @@ app.plugin(ConsolePlugin, { ...@@ -19,7 +19,7 @@ app.plugin(ConsolePlugin, {
}); });
// Some services // Some services
app.plugin(CachePlugin); // app.plugin(CachePlugin);
app.plugin(DatabasePlugin); app.plugin(DatabasePlugin);
// Some extras // Some extras
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import { Playbook } from './Playbook'; import { Playbook } from './Playbook';
import type { OneBotBot } from '@koishijs/plugin-adapter-onebot/lib/bot'; import type { OneBotBot } from '@koishijs/plugin-adapter-onebot';
import moment, { Moment } from 'moment'; import moment, { Moment } from 'moment';
export enum ShowStatus { export enum ShowStatus {
...@@ -42,7 +42,7 @@ export class Show { ...@@ -42,7 +42,7 @@ export class Show {
let availableBots: OneBotBot[] = []; let availableBots: OneBotBot[] = [];
const botNameMap = new Map<string, string>(); const botNameMap = new Map<string, string>();
for (const bot of bots) { for (const bot of bots) {
if (bot.adapter.platform !== 'onebot') { if (bot.platform !== 'onebot') {
continue; continue;
} }
const groups = await bot.getGuildList(); const groups = await bot.getGuildList();
......
...@@ -107,9 +107,9 @@ export class MyPlugin { ...@@ -107,9 +107,9 @@ export class MyPlugin {
} catch (e) { } catch (e) {
return `无法加载剧本文件 ${playbookPath}: ${e.toString()}`; return `无法加载剧本文件 ${playbookPath}: ${e.toString()}`;
} }
const bots: OneBotBot[] = this.ctx.bots.filter( const bots = this.ctx.bots.filter(
(b) => b.adapter.platform === 'onebot', (b) => b.platform === 'onebot',
) as OneBotBot[]; ) as unknown as OneBotBot[];
const show = new Show(groupId, playbook, this.config.autoChangeName); const show = new Show(groupId, playbook, this.config.autoChangeName);
for (const specificCharacter of specificCharacters) { for (const specificCharacter of specificCharacters) {
const [characterName, botId] = specificCharacter.split('='); const [characterName, botId] = specificCharacter.split('=');
......
import { App } from 'koishi'; import { Context } from 'koishi';
import TargetPlugin from '../src'; import TargetPlugin from '../src';
describe('Test of plugin.', () => { describe('Test of plugin.', () => {
let app: App; let app: Context;
beforeEach(async () => { beforeEach(async () => {
app = new App(); app = new Context();
// app.plugin(TargetPlugin); // app.plugin(TargetPlugin);
await app.start(); await app.start();
}); });
......
const path = require('path'); const path = require('path');
const packgeInfo = require('./package.json'); const packgeInfo = require('./package.json');
const { ESBuildMinifyPlugin } = require('esbuild-loader');
function externalsFromDep() { function externalsFromDep() {
return Object.fromEntries( return Object.fromEntries(
...@@ -43,4 +44,11 @@ module.exports = { ...@@ -43,4 +44,11 @@ module.exports = {
koishi: 'koishi', koishi: 'koishi',
...(packAll ? {} : externalsFromDep()), ...(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