Commit 558e1e08 authored by nanahira's avatar nanahira

migrate to reusable

parent 1b661582
...@@ -19,17 +19,17 @@ npm install koishi-plugin-autopic koishi-plugin-pics ...@@ -19,17 +19,17 @@ npm install koishi-plugin-autopic koishi-plugin-pics
```yaml ```yaml
# koishi.yaml # koishi.yaml
plugins: plugins:
autopic: autopic@foo:
instances: sourceTags: # 图源标签,见 koishi-plugin-pics
- sourceTags: # 图源标签,见 koishi-plugin-pics - anime
- anime picTags: [] # 图片标签,见 koishi-plugin-pics
picTags: [] # 图片标签,见 koishi-plugin-pics # 下列配置详见 koishi-schedule-send
# 下列配置详见 koishi-schedule-send cron: '18 13 * * * *'
cron: '18 13 * * * *' interval: 30000
interval: 30000 targets:
immediate: false - bot: 'onebot:1111111111'
targets: users:
- bot: 'onebot:1111111111' - '33333333'
channels: channels:
- channelId: '222222222' - channelId: '222222222'
``` ```
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"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": "^27.5.1", "jest": "^27.5.1",
"koishi-plugin-picsource-lolicon": "^9.2.3", "koishi-plugin-picsource-lolicon": "^9.2.5",
"prettier": "^2.6.0", "prettier": "^2.6.0",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"ts-jest": "^27.1.3", "ts-jest": "^27.1.3",
...@@ -5324,16 +5324,16 @@ ...@@ -5324,16 +5324,16 @@
} }
}, },
"node_modules/koishi-plugin-picsource-lolicon": { "node_modules/koishi-plugin-picsource-lolicon": {
"version": "9.2.3", "version": "9.2.5",
"resolved": "https://registry.npmjs.org/koishi-plugin-picsource-lolicon/-/koishi-plugin-picsource-lolicon-9.2.3.tgz", "resolved": "https://registry.npmjs.org/koishi-plugin-picsource-lolicon/-/koishi-plugin-picsource-lolicon-9.2.5.tgz",
"integrity": "sha512-qF4+Tj0sSxmotvAeDjHW3N2w8YDo+3UJuRUp62kgsB5008ymRWcNX+zP6rtKapuKp4i/jJN5B2Z/NfaA0NjwvA==", "integrity": "sha512-hcQB4iZBnUdDI0dTbAxav35AQ1TkTrutnrBjiyPukkspxUDL+ECtZa9EU0YlFvpk7nLKHa/JJcNeYWrU53gMng==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"koishi-thirdeye": "^10.2.8" "koishi-thirdeye": "^10.3.1"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.7.4", "koishi": "^4.7.5",
"koishi-plugin-pics": "^9.3.3" "koishi-plugin-pics": "^9.4.1"
} }
}, },
"node_modules/koishi-schedule-send": { "node_modules/koishi-schedule-send": {
...@@ -12017,12 +12017,12 @@ ...@@ -12017,12 +12017,12 @@
} }
}, },
"koishi-plugin-picsource-lolicon": { "koishi-plugin-picsource-lolicon": {
"version": "9.2.3", "version": "9.2.5",
"resolved": "https://registry.npmjs.org/koishi-plugin-picsource-lolicon/-/koishi-plugin-picsource-lolicon-9.2.3.tgz", "resolved": "https://registry.npmjs.org/koishi-plugin-picsource-lolicon/-/koishi-plugin-picsource-lolicon-9.2.5.tgz",
"integrity": "sha512-qF4+Tj0sSxmotvAeDjHW3N2w8YDo+3UJuRUp62kgsB5008ymRWcNX+zP6rtKapuKp4i/jJN5B2Z/NfaA0NjwvA==", "integrity": "sha512-hcQB4iZBnUdDI0dTbAxav35AQ1TkTrutnrBjiyPukkspxUDL+ECtZa9EU0YlFvpk7nLKHa/JJcNeYWrU53gMng==",
"dev": true, "dev": true,
"requires": { "requires": {
"koishi-thirdeye": "^10.2.8" "koishi-thirdeye": "^10.3.1"
} }
}, },
"koishi-schedule-send": { "koishi-schedule-send": {
......
// import 'source-map-support/register'; // import 'source-map-support/register';
import { AutoPicPluginConfig } from './config'; import { AutoPicPluginConfig } from './config';
import { DefinePlugin, Inject, MultiInstancePlugin } from 'koishi-thirdeye'; import {
DefinePlugin,
Inject,
MultiInstancePlugin,
Reusable,
} from 'koishi-thirdeye';
import PicsContainer from 'koishi-plugin-pics'; import PicsContainer from 'koishi-plugin-pics';
import { SchedulePlugin } from 'koishi-schedule-send'; import { SchedulePlugin } from 'koishi-schedule-send';
export * from './config'; export * from './config';
@Reusable()
@DefinePlugin() @DefinePlugin()
export class AutoPicInstancePlugin extends SchedulePlugin(AutoPicPluginConfig) { export default class AutoPicInstancePlugin extends SchedulePlugin(
AutoPicPluginConfig,
) {
@Inject(true) @Inject(true)
private pics: PicsContainer; private pics: PicsContainer;
...@@ -26,8 +34,3 @@ export class AutoPicInstancePlugin extends SchedulePlugin(AutoPicPluginConfig) { ...@@ -26,8 +34,3 @@ export class AutoPicInstancePlugin extends SchedulePlugin(AutoPicPluginConfig) {
return await this.pics.getSegment(pic.url); return await this.pics.getSegment(pic.url);
} }
} }
@DefinePlugin()
export default class AutoPicPlugin extends MultiInstancePlugin(
AutoPicInstancePlugin,
) {}
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