Commit 34a88cdf authored by nanahira's avatar nanahira

bump to Koishi 4.8

parent fd4a1387
......@@ -13,22 +13,18 @@ export default class ExtrasInDev {
weight: 2,
});
ctx.plugin(PicSourceYandePlugin, {
instances: [
{
name: 'yande',
weight: 1,
endpoint: 'https://yande.re/post.json',
pageLimit: 200,
isDefault: true,
},
{
name: 'konachan',
weight: 1,
endpoint: 'https://konachan.com/post.json',
pageLimit: 200,
isDefault: true,
},
],
name: 'yande',
weight: 1,
endpoint: 'https://yande.re/post.json',
pageLimit: 200,
isDefault: true,
});
ctx.plugin(PicSourceYandePlugin, {
name: 'konachan',
weight: 1,
endpoint: 'https://konachan.com/post.json',
pageLimit: 200,
isDefault: true,
});
ctx.plugin(PicSourceHeisi, { isDefault: true });
ctx.plugin(PicSourceMiraikoi, { isDefault: true });
......
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.
......@@ -35,9 +35,9 @@ export class EdgingProfile {
bot: Bot;
getBot(bots: Adapter.BotList) {
getBot(bots: Bot[]) {
if (this.from) {
return bots.get(this.from);
return bots.find(bot => bot.sid === this.from);
} else {
return this.session.bot;
}
......@@ -130,7 +130,7 @@ export class EdgingProfile {
return this.failTriggerWord && message.startsWith(this.failTriggerWord);
}
async initialize(config: EdgingPluginConfig, bots: Adapter.BotList) {
async initialize(config: EdgingPluginConfig, bots: Bot[]) {
Object.keys(config.defaultProfile).forEach((key) => {
if (!this[key] && config.defaultProfile[key]) {
this[key] = config.defaultProfile[key];
......
......@@ -2,7 +2,7 @@
import { EdgingPluginConfig, EdgingProfile } from './config';
import {
DefinePlugin,
BasePlugin,
StarterPlugin,
Provide,
Inject,
LifecycleEvents,
......@@ -22,11 +22,8 @@ import { dynamicInterval } from './utility';
export * from './config';
declare module 'koishi' {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Context {
interface Services {
edging: EdgingPlugin;
}
interface Context {
edging: EdgingPlugin;
}
}
......@@ -74,7 +71,7 @@ export class EdgingPanel {
@Provide('edging', { immediate: true })
@DefinePlugin({ name: 'edging', schema: EdgingPluginConfig })
export default class EdgingPlugin
extends BasePlugin<EdgingPluginConfig>
extends StarterPlugin(EdgingPluginConfig)
implements LifecycleEvents
{
onApply() {
......@@ -94,7 +91,7 @@ export default class EdgingPlugin
}
@Inject()
private bots: Adapter.BotList;
private bots: Bot[];
@Inject()
private pics: PicsContainer;
......
import { App } from 'koishi';
import { Context } from 'koishi';
import TargetPlugin from '../src';
describe('Test of plugin.', () => {
let app: App;
let app: Context;
beforeEach(async () => {
app = new App();
app = new Context();
// app.plugin(TargetPlugin);
await app.start();
});
......
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