@songsid/agend-plugin-discord 0.0.1 → 0.0.3
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 +2 -2
- package/src/discord-adapter.ts +4 -4
- package/src/index.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@songsid/agend-plugin-discord",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
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
|
-
"@
|
|
12
|
+
"@songsid/agend": ">=0.0.1"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"discord.js": "^14.25.1"
|
package/src/discord-adapter.ts
CHANGED
|
@@ -24,9 +24,9 @@ import type {
|
|
|
24
24
|
PermissionPrompt,
|
|
25
25
|
Choice,
|
|
26
26
|
AlertData,
|
|
27
|
-
} from "@
|
|
28
|
-
import type { AccessManager } from "@
|
|
29
|
-
import { MessageQueue } from "@
|
|
27
|
+
} from "@songsid/agend/channel";
|
|
28
|
+
import type { AccessManager } from "@songsid/agend/channel/access-manager";
|
|
29
|
+
import { MessageQueue } from "@songsid/agend/channel/message-queue";
|
|
30
30
|
|
|
31
31
|
const DISCORD_MAX_LENGTH = 2000;
|
|
32
32
|
|
|
@@ -549,7 +549,7 @@ export class DiscordAdapter extends EventEmitter implements ChannelAdapter {
|
|
|
549
549
|
if (!url) throw new Error(`No URL for attachment: ${fileId}`);
|
|
550
550
|
const response = await fetch(url);
|
|
551
551
|
if (!response.ok) throw new Error(`Download failed: ${response.status}`);
|
|
552
|
-
const filename = fileId
|
|
552
|
+
const filename = `${Date.now()}-${fileId.slice(-8)}-${url.split("/").pop()?.split("?")[0] ?? "file"}`;
|
|
553
553
|
const localPath = join(this.inboxDir, filename);
|
|
554
554
|
const dest = createWriteStream(localPath);
|
|
555
555
|
const body = response.body;
|
package/src/index.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* channel:
|
|
8
8
|
* type: discord
|
|
9
9
|
*/
|
|
10
|
-
import type { ChannelAdapter } from "@
|
|
11
|
-
import type { ChannelConfig } from "@
|
|
12
|
-
import type { AccessManager } from "@
|
|
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
|
import { DiscordAdapter } from "./discord-adapter.js";
|
|
14
14
|
|
|
15
15
|
interface AdapterOpts {
|