@theholocron/holocron-plugin-discord 5.0.0-alpha.402 → 5.0.0-alpha.404

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/dist/index.d.mts CHANGED
@@ -174,8 +174,10 @@ export declare class DiscordNotifications implements Notifications {
174
174
  }): Promise<void>;
175
175
  /** The text of a post's recent messages, newest first. */
176
176
  readDiscussionMessages(channel: string, key: string, limit?: number): Promise<string[]>;
177
- /** Keeps the oldest post for `key` and deletes the others; returns how many it deleted. */
178
- dedupeDiscussion(channel: string, key: string): Promise<number>;
177
+ /** Keeps the oldest post for `key` and deletes the others; returns how many it deleted. `refresh` reads the forum again first. */
178
+ dedupeDiscussion(channel: string, key: string, opts?: {
179
+ refresh?: boolean;
180
+ }): Promise<number>;
179
181
  /**
180
182
  * Posts `content` (up to 2000 characters) in a text channel as the bot, without letting it mention anyone. A `#name`
181
183
  * that is one of the server's channels is linked.
package/dist/index.mjs CHANGED
@@ -355,8 +355,10 @@ var DiscordDiscussions = class DiscordDiscussions {
355
355
  return (await this.deps.bot().channels.messages(entry.thread.id, Math.min(Math.max(limit, 1), 100))).map((m) => m.content);
356
356
  }
357
357
  /** Keep the oldest post that carries `key` and delete the others. Returns how many were deleted. */
358
- async dedupe(channel, key) {
359
- const entry = (await this.posts(await this.forum(channel))).get(key);
358
+ async dedupe(channel, key, opts = {}) {
359
+ const forum = await this.forum(channel);
360
+ if (opts.refresh) this.forums.delete(forum.id);
361
+ const entry = (await this.posts(forum)).get(key);
360
362
  if (!entry) return 0;
361
363
  const bot = this.deps.bot();
362
364
  let deleted = 0;
@@ -1210,9 +1212,9 @@ var DiscordNotifications = class DiscordNotifications {
1210
1212
  readDiscussionMessages(channel, key, limit) {
1211
1213
  return this.discussions().messages(channel, key, limit);
1212
1214
  }
1213
- /** Keeps the oldest post for `key` and deletes the others; returns how many it deleted. */
1214
- dedupeDiscussion(channel, key) {
1215
- return this.discussions().dedupe(channel, key);
1215
+ /** Keeps the oldest post for `key` and deletes the others; returns how many it deleted. `refresh` reads the forum again first. */
1216
+ dedupeDiscussion(channel, key, opts) {
1217
+ return this.discussions().dedupe(channel, key, opts);
1216
1218
  }
1217
1219
  /**
1218
1220
  * Posts `content` (up to 2000 characters) in a text channel as the bot, without letting it mention anyone. A `#name`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-discord",
3
- "version": "5.0.0-alpha.402",
3
+ "version": "5.0.0-alpha.404",
4
4
  "description": "Holocron plugin for Discord. Implements the notifications capability via Discord incoming webhooks.",
5
5
  "keywords": [
6
6
  "discord",
@@ -41,19 +41,19 @@
41
41
  "tsx": "4.23.15",
42
42
  "typescript": "^5.9.3",
43
43
  "vitest": "^5.1.0",
44
+ "@theholocron/cli": "5.0.0-alpha.404",
44
45
  "@theholocron/discord-client": "^1.58.0-alpha.27",
45
- "@theholocron/cli": "5.0.0-alpha.402",
46
+ "@theholocron/eslint-config": "^8.9.0-alpha.16",
46
47
  "@theholocron/http-client": "^1.58.0-alpha.27",
47
- "@theholocron/eslint-config": "^8.9.0-alpha.15",
48
48
  "@theholocron/misc-utils": "^1.17.0-alpha.3",
49
- "@theholocron/tsdown-config": "^8.9.0-alpha.15",
50
- "@theholocron/tsconfig": "^8.9.0-alpha.15",
51
- "@theholocron/vitest-config": "^8.9.0-alpha.15"
49
+ "@theholocron/tsdown-config": "^8.9.0-alpha.16",
50
+ "@theholocron/tsconfig": "^8.9.0-alpha.16",
51
+ "@theholocron/vitest-config": "^8.9.0-alpha.16"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@theholocron/discord-client": "^1.50.0",
55
55
  "@theholocron/misc-utils": "^1.16.0",
56
- "@theholocron/cli": "5.0.0-alpha.402"
56
+ "@theholocron/cli": "5.0.0-alpha.404"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=22"