@songsid/agend-plugin-discord 0.0.2 → 0.0.4

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.
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from "node:events";
2
- import type { ChannelAdapter, ApprovalHandle, SendOpts, SentMessage, PermissionPrompt, Choice, AlertData } from "@suzuke/agend/channel";
3
- import type { AccessManager } from "@suzuke/agend/channel/access-manager";
2
+ import type { ChannelAdapter, ApprovalHandle, SendOpts, SentMessage, PermissionPrompt, Choice, AlertData } from "@songsid/agend/channel";
3
+ import type { AccessManager } from "@songsid/agend/channel/access-manager";
4
4
  export interface DiscordAdapterOptions {
5
5
  id: string;
6
6
  botToken: string;
@@ -6,7 +6,7 @@ import { pipeline } from "node:stream/promises";
6
6
  import { Readable } from "node:stream";
7
7
  import { createWriteStream } from "node:fs";
8
8
  import { Client, GatewayIntentBits, ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, } from "discord.js";
9
- import { MessageQueue } from "@suzuke/agend/channel/message-queue";
9
+ import { MessageQueue } from "@songsid/agend/channel/message-queue";
10
10
  const DISCORD_MAX_LENGTH = 2000;
11
11
  export class DiscordAdapter extends EventEmitter {
12
12
  type = "discord";
@@ -490,7 +490,7 @@ export class DiscordAdapter extends EventEmitter {
490
490
  const response = await fetch(url);
491
491
  if (!response.ok)
492
492
  throw new Error(`Download failed: ${response.status}`);
493
- const filename = fileId + "_" + (url.split("/").pop()?.split("?")[0] ?? "file");
493
+ const filename = `${Date.now()}-${fileId.slice(-8)}-${url.split("/").pop()?.split("?")[0] ?? "file"}`;
494
494
  const localPath = join(this.inboxDir, filename);
495
495
  const dest = createWriteStream(localPath);
496
496
  const body = response.body;
package/dist/index.d.ts CHANGED
@@ -7,9 +7,9 @@
7
7
  * channel:
8
8
  * type: discord
9
9
  */
10
- import type { ChannelAdapter } from "@suzuke/agend/channel";
11
- import type { ChannelConfig } from "@suzuke/agend/types";
12
- import type { AccessManager } from "@suzuke/agend/channel/access-manager";
10
+ import type { ChannelAdapter } from "@songsid/agend/channel";
11
+ import type { ChannelConfig } from "@songsid/agend/types";
12
+ import type { AccessManager } from "@songsid/agend/channel/access-manager";
13
13
  interface AdapterOpts {
14
14
  id: string;
15
15
  botToken: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@songsid/agend-plugin-discord",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Discord channel adapter plugin for AgEnD",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,7 +9,7 @@
9
9
  "build": "tsc"
10
10
  },
11
11
  "peerDependencies": {
12
- "@suzuke/agend": ">=1.13.0"
12
+ "@songsid/agend": ">=0.0.1"
13
13
  },
14
14
  "dependencies": {
15
15
  "discord.js": "^14.25.1"