hotcat-bot-qq 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hotcat-bot-qq",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "基于 node-napcat-ts 的 TypeScript QQ 机器人框架",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,7 +13,6 @@ export class HotCatPlugin extends PluginBase {
13
13
  }
14
14
 
15
15
  private startTime = 0
16
- private enabled = false
17
16
 
18
17
  static create(api: BotApi, bot: BotClient) {
19
18
  return new HotCatPlugin(api, bot)
@@ -21,16 +20,14 @@ export class HotCatPlugin extends PluginBase {
21
20
 
22
21
  async load() {
23
22
  this.startTime = Date.now()
24
- this.enabled = true
25
- this.bot.event.message.onGroupMessage(this.onGroupMsg)
23
+ this.api.napcat.on('message.group', this.onGroupMsg)
26
24
  }
27
25
 
28
26
  async unload() {
29
- this.enabled = false
27
+ this.api.napcat.off('message.group', this.onGroupMsg)
30
28
  }
31
29
 
32
- private onGroupMsg = async (_bot: BotClient, event: any) => {
33
- if (!this.enabled) return
30
+ private onGroupMsg = async (event: any) => {
34
31
  const msg = event.raw_message.trim()
35
32
 
36
33
  if (msg === '#hotCat' || msg === '#hotcat') {