Commit 34a88cdf authored by nanahira's avatar nanahira

bump to Koishi 4.8

parent fd4a1387
...@@ -13,22 +13,18 @@ export default class ExtrasInDev { ...@@ -13,22 +13,18 @@ export default class ExtrasInDev {
weight: 2, weight: 2,
}); });
ctx.plugin(PicSourceYandePlugin, { ctx.plugin(PicSourceYandePlugin, {
instances: [
{
name: 'yande', name: 'yande',
weight: 1, weight: 1,
endpoint: 'https://yande.re/post.json', endpoint: 'https://yande.re/post.json',
pageLimit: 200, pageLimit: 200,
isDefault: true, isDefault: true,
}, });
{ ctx.plugin(PicSourceYandePlugin, {
name: 'konachan', name: 'konachan',
weight: 1, weight: 1,
endpoint: 'https://konachan.com/post.json', endpoint: 'https://konachan.com/post.json',
pageLimit: 200, pageLimit: 200,
isDefault: true, isDefault: true,
},
],
}); });
ctx.plugin(PicSourceHeisi, { isDefault: true }); ctx.plugin(PicSourceHeisi, { isDefault: true });
ctx.plugin(PicSourceMiraikoi, { isDefault: true }); ctx.plugin(PicSourceMiraikoi, { isDefault: true });
......
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.
...@@ -47,31 +47,31 @@ ...@@ -47,31 +47,31 @@
"testEnvironment": "node" "testEnvironment": "node"
}, },
"dependencies": { "dependencies": {
"koishi-thirdeye": "^10.3.2", "koishi-thirdeye": "^11.0.6",
"moment": "^2.29.3" "moment": "^2.29.3"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.7.5", "koishi": "^4.8.2",
"koishi-plugin-pics": "^9.4.1" "koishi-plugin-pics": "^10.0.0"
}, },
"devDependencies": { "devDependencies": {
"@koishijs/plugin-cache-lru": "^1.0.0-rc.0", "@koishijs/plugin-console": "^4.1.1",
"@koishijs/plugin-console": "^3.3.2", "@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-database-memory": "^1.3.0", "@koishijs/plugin-sandbox": "^2.0.1",
"@koishijs/plugin-sandbox": "^1.1.3",
"@types/jest": "^27.5.0", "@types/jest": "^27.5.0",
"@types/node": "^17.0.31", "@types/node": "^17.0.31",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^4.33.0",
"esbuild-loader": "^2.19.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^3.4.1", "eslint-plugin-prettier": "^3.4.1",
"jest": "^28.0.3", "jest": "^28.0.3",
"koishi-plugin-pics": "^9.4.1", "koishi-plugin-pics": "^10.0.0",
"koishi-plugin-picsource-heisi": "^6.0.3", "koishi-plugin-picsource-heisi": "^7.0.0",
"koishi-plugin-picsource-lolicon": "^9.2.5", "koishi-plugin-picsource-lolicon": "^10.0.0",
"koishi-plugin-picsource-miraikoi": "^1.0.2", "koishi-plugin-picsource-miraikoi": "^2.0.0",
"koishi-plugin-picsource-yande": "^2.0.3", "koishi-plugin-picsource-yande": "^3.0.0",
"prettier": "^2.6.2", "prettier": "^2.6.2",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"ts-jest": "^28.0.1", "ts-jest": "^28.0.1",
......
...@@ -35,9 +35,9 @@ export class EdgingProfile { ...@@ -35,9 +35,9 @@ export class EdgingProfile {
bot: Bot; bot: Bot;
getBot(bots: Adapter.BotList) { getBot(bots: Bot[]) {
if (this.from) { if (this.from) {
return bots.get(this.from); return bots.find(bot => bot.sid === this.from);
} else { } else {
return this.session.bot; return this.session.bot;
} }
...@@ -130,7 +130,7 @@ export class EdgingProfile { ...@@ -130,7 +130,7 @@ export class EdgingProfile {
return this.failTriggerWord && message.startsWith(this.failTriggerWord); 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) => { Object.keys(config.defaultProfile).forEach((key) => {
if (!this[key] && config.defaultProfile[key]) { if (!this[key] && config.defaultProfile[key]) {
this[key] = config.defaultProfile[key]; this[key] = config.defaultProfile[key];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { EdgingPluginConfig, EdgingProfile } from './config'; import { EdgingPluginConfig, EdgingProfile } from './config';
import { import {
DefinePlugin, DefinePlugin,
BasePlugin, StarterPlugin,
Provide, Provide,
Inject, Inject,
LifecycleEvents, LifecycleEvents,
...@@ -22,12 +22,9 @@ import { dynamicInterval } from './utility'; ...@@ -22,12 +22,9 @@ import { dynamicInterval } from './utility';
export * from './config'; export * from './config';
declare module 'koishi' { declare module 'koishi' {
// eslint-disable-next-line @typescript-eslint/no-namespace interface Context {
namespace Context {
interface Services {
edging: EdgingPlugin; edging: EdgingPlugin;
} }
}
} }
class UserDef { class UserDef {
...@@ -74,7 +71,7 @@ export class EdgingPanel { ...@@ -74,7 +71,7 @@ export class EdgingPanel {
@Provide('edging', { immediate: true }) @Provide('edging', { immediate: true })
@DefinePlugin({ name: 'edging', schema: EdgingPluginConfig }) @DefinePlugin({ name: 'edging', schema: EdgingPluginConfig })
export default class EdgingPlugin export default class EdgingPlugin
extends BasePlugin<EdgingPluginConfig> extends StarterPlugin(EdgingPluginConfig)
implements LifecycleEvents implements LifecycleEvents
{ {
onApply() { onApply() {
...@@ -94,7 +91,7 @@ export default class EdgingPlugin ...@@ -94,7 +91,7 @@ export default class EdgingPlugin
} }
@Inject() @Inject()
private bots: Adapter.BotList; private bots: Bot[];
@Inject() @Inject()
private pics: PicsContainer; private pics: PicsContainer;
......
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