Commit 583e90ca authored by nanahira's avatar nanahira

migrate koishi v4.8

parent 26a11d8e
import { App } from 'koishi';
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 ExtrasInDev from './extras';
const app = new App({
......@@ -17,10 +15,6 @@ app.plugin(ConsolePlugin, {
open: false,
});
// Some services
app.plugin(CachePlugin);
app.plugin(DatabasePlugin);
// Some extras
app.plugin(ExtrasInDev);
......
This diff is collapsed.
......@@ -44,18 +44,16 @@
"testEnvironment": "node"
},
"dependencies": {
"koishi-target-def": "^1.1.1",
"koishi-target-def": "^2.0.0",
"node-schedule": "^2.1.0"
},
"peerDependencies": {
"koishi": "^4.7.4",
"koishi-thirdeye": "^10.2.1"
"koishi": "^4.8.1",
"koishi-thirdeye": "^11.0.5"
},
"devDependencies": {
"@koishijs/plugin-cache-lru": "^1.0.0-rc.0",
"@koishijs/plugin-console": "^3.3.2",
"@koishijs/plugin-database-memory": "^1.3.0",
"@koishijs/plugin-sandbox": "^1.1.3",
"@koishijs/plugin-console": "^4.0.1",
"@koishijs/plugin-sandbox": "^2.0.0",
"@types/jest": "^27.5.0",
"@types/node": "^17.0.31",
"@types/node-schedule": "^1.3.2",
......
// import 'source-map-support/register';
import { SchedulePluginConfig } from './config';
import {
BasePlugin,
CreatePluginFactory,
Inject,
InjectLogger,
StarterPlugin,
} from 'koishi-thirdeye';
import { Logger } from 'koishi';
import { Adapter } from 'koishi';
import { Bot } from 'koishi';
export * from './config';
export class BaseSchedulePlugin extends BasePlugin<SchedulePluginConfig> {
export class BaseSchedulePlugin extends StarterPlugin(SchedulePluginConfig) {
@InjectLogger()
logger: Logger;
@Inject(true)
bots: Adapter.BotList;
bots: Bot[];
async send() {
return '';
......@@ -38,7 +37,7 @@ export class BaseSchedulePlugin extends BasePlugin<SchedulePluginConfig> {
await Promise.all(
this.config.targets.map(async (target) => {
try {
const bot = this.bots.get(target.bot);
const bot = this.bots.find(bot => bot.sid === target.bot);
this.logger.debug(`Sending message from ${target.bot}.`);
const ids = await target.send(this.bots, message);
this.logger.debug(
......
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