koishi-plugin-18xx 0.0.10 → 0.0.11

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/lib/index.js CHANGED
@@ -210,7 +210,6 @@ __name(command, "command");
210
210
 
211
211
  // src/server.tsx
212
212
  var import_plugin_server2 = __toESM(require("@koishijs/plugin-server"));
213
- var import_lru_cache = require("lru-cache");
214
213
  var import_jsx_runtime = require("@satorijs/element/jsx-runtime");
215
214
  var ForkServer = class extends import_plugin_server2.default {
216
215
  static {
@@ -237,7 +236,7 @@ var forkServer = /* @__PURE__ */ __name((ctx, config) => new Promise((resolve, r
237
236
  }), "forkServer");
238
237
  var MESSAGE_REGEX = /^<@?(.*?)>\s*([\S\s]*)$/;
239
238
  var GAME_REGEX = /18xx\.games\/game\/(\d+)/;
240
- var sendCache = new import_lru_cache.LRUCache({ max: 1e3 });
239
+ var sendCache = /* @__PURE__ */ new Map();
241
240
  async function server(ctx, config) {
242
241
  const logger = ctx.logger(name);
243
242
  let server2 = ctx.server;
@@ -296,7 +295,8 @@ async function server(ctx, config) {
296
295
  }
297
296
  if (result?.length > 0) {
298
297
  logger.info("通知发送成功", result, sendCacheKey, message);
299
- sendCache.set(sendCacheKey, { ts: Date.now() });
298
+ const cancel = ctx.setTimeout(() => sendCache.delete(sendCacheKey), profile.interval * 1e3);
299
+ sendCache.set(sendCacheKey, { ts: Date.now(), cancel });
300
300
  return true;
301
301
  }
302
302
  } catch (e) {
@@ -320,7 +320,6 @@ async function server(ctx, config) {
320
320
  sendCache.set(sendCacheKey, { ts: lastTimestamp, cancel });
321
321
  return;
322
322
  }
323
- sendCache.delete(sendCacheKey);
324
323
  }
325
324
  if (!config.notification.items.length) {
326
325
  await sendNotification(profile);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-18xx",
3
3
  "description": "18xxGames 机器人",
4
- "version": "0.0.10",
4
+ "version": "0.0.11",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -46,8 +46,5 @@
46
46
  "en",
47
47
  "zh"
48
48
  ]
49
- },
50
- "dependencies": {
51
- "lru-cache": "^11.1.0"
52
49
  }
53
50
  }
package/lib/api.d.ts DELETED
File without changes