kotori-plugin-requester 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/lib/index.js +9 -11
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
 
2
2
  /**
3
3
  * @Package kotori-plugin-requester
4
- * @Version 1.0.1
4
+ * @Version 1.1.0
5
5
  * @Author Himeno <biyuehuya@gmail.com>
6
6
  * @Copyright 2024 Hotaru. All rights reserved.
7
7
  * @License GPL-3.0
8
8
  * @Link https://github.com/kotorijs/kotori
9
- * @Date 2024/6/6 21:03:50
9
+ * @Date 2024/6/7 21:36:15
10
10
  */
11
11
 
12
12
  "use strict";
@@ -27,8 +27,6 @@ var __copyProps = (to, from, except, desc) => {
27
27
  return to;
28
28
  };
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/index.ts
32
30
  var src_exports = {};
33
31
  __export(src_exports, {
34
32
  config: () => config,
@@ -38,8 +36,8 @@ __export(src_exports, {
38
36
  });
39
37
  module.exports = __toCommonJS(src_exports);
40
38
  var import_kotori_bot = require("kotori-bot");
41
- var lang = [__dirname, "../locales"];
42
- var config = import_kotori_bot.Tsu.Object({
39
+ const lang = [__dirname, "../locales"];
40
+ const config = import_kotori_bot.Tsu.Object({
43
41
  print: import_kotori_bot.Tsu.Boolean().default(true),
44
42
  filterCmd: import_kotori_bot.Tsu.Boolean().default(true),
45
43
  onHttpRequest: import_kotori_bot.Tsu.Union([
@@ -61,7 +59,7 @@ var config = import_kotori_bot.Tsu.Object({
61
59
  onGroupMsg: import_kotori_bot.Tsu.Boolean().default(true),
62
60
  onPrivateMsg: import_kotori_bot.Tsu.Boolean().default(true)
63
61
  });
64
- var inject = ["cache"];
62
+ const inject = ["cache"];
65
63
  function main(ctx, cfg) {
66
64
  const log = (identity, ...args) => {
67
65
  if (cfg.print) ctx.logger.label(identity).record(...args);
@@ -113,11 +111,11 @@ function main(ctx, cfg) {
113
111
  ctx.on("on_recall", (session) => {
114
112
  if (session.userId === session.api.adapter.selfId || session.operatorId === session.api.adapter.selfId) return;
115
113
  if (cfg.onPrivateRecall && session.type === import_kotori_bot.MessageScope.PRIVATE) {
116
- const message = ctx.cache.get(`${session.api.adapter.platform}${session.messageId}`);
114
+ const message = ctx.cache.get(`${session.api.adapter.identity}${session.messageId}`);
117
115
  if (!message) return;
118
116
  send(session)([`requester.msg.recall.private`, [session.userId, message]]);
119
117
  } else if (cfg.onGroupRecall && session.type === import_kotori_bot.MessageScope.GROUP) {
120
- const message = ctx.cache.get(`${session.api.adapter.platform}${session.messageId}`);
118
+ const message = ctx.cache.get(`${session.api.adapter.identity}${session.messageId}`);
121
119
  if (!message) return;
122
120
  const equaled = session.operatorId === session.userId;
123
121
  send(session)([
@@ -140,9 +138,9 @@ function main(ctx, cfg) {
140
138
  ctx.on("on_message", (session) => {
141
139
  if (session.userId === session.api.adapter.selfId) return;
142
140
  if (session.type === import_kotori_bot.MessageScope.GROUP && cfg.onGroupRecall) {
143
- ctx.cache.set(`${session.api.adapter.platform}${session.messageId}`, session.message);
141
+ ctx.cache.set(`${session.api.adapter.identity}${session.messageId}`, session.message);
144
142
  } else if (cfg.onPrivateRecall) {
145
- ctx.cache.set(`${session.api.adapter.platform}${session.messageId}`, session.message);
143
+ ctx.cache.set(`${session.api.adapter.identity}${session.messageId}`, session.message);
146
144
  }
147
145
  if (cfg.onPrivateMsg && String(session.userId) !== String(session.api.adapter.config.master)) {
148
146
  send(session)([`requester.msg.msg.private`, [session.userId, session.message]]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kotori-plugin-requester",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Listen delete message and request event call to master",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "author": "Himeno <biyuehuya@gmail.com>",
19
19
  "peerDependencies": {
20
- "kotori-bot": "^1.5.0"
20
+ "kotori-bot": "^1.5.4"
21
21
  },
22
22
  "kotori": {
23
23
  "meta": {