Commit 352a038f authored by nanahira's avatar nanahira

migrate to reusable

parent d6fd231a
...@@ -21,18 +21,18 @@ npm install koishi-plugin-spammer ...@@ -21,18 +21,18 @@ npm install koishi-plugin-spammer
```yaml ```yaml
# koishi.yaml # koishi.yaml
plugins: plugins:
autopic: spammer@foo:
instances: paths: # 文件路径,一行一个。
- paths: # 文件路径,一行一个。 - ./data.txt
- ./data.txt presets: # 预设的消息。paths 和 presets 选择一个即可。
presets: # 预设的消息。paths 和 presets 选择一个即可。 - Hello!
- Hello! # 下列配置详见 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'
``` ```
// import 'source-map-support/register'; // import 'source-map-support/register';
import { SpammerConfig } from './config'; import { SpammerConfig } from './config';
import { DefinePlugin, MultiInstancePlugin } from 'koishi-thirdeye'; import { DefinePlugin, Reusable } from 'koishi-thirdeye';
import { SchedulePlugin } from 'koishi-schedule-send'; import { SchedulePlugin } from 'koishi-schedule-send';
export * from './config'; export * from './config';
@Reusable()
@DefinePlugin() @DefinePlugin()
export class Spammer extends SchedulePlugin(SpammerConfig) { export default class Spammer extends SchedulePlugin(SpammerConfig) {
async send() { async send() {
return this.config.getText(); return this.config.getText();
} }
} }
@DefinePlugin()
export default class SpammerPlugin extends MultiInstancePlugin(Spammer) {}
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