@songsid/agend-plugin-discord 0.0.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.
- package/dist/discord-adapter.d.ts +53 -0
- package/dist/discord-adapter.js +614 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +11 -0
- package/package.json +24 -0
- package/src/discord-adapter.ts +694 -0
- package/src/index.ts +32 -0
- package/tsconfig.json +14 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgEnD Discord adapter plugin.
|
|
3
|
+
*
|
|
4
|
+
* Install: npm install agend-plugin-discord
|
|
5
|
+
*
|
|
6
|
+
* fleet.yaml:
|
|
7
|
+
* channel:
|
|
8
|
+
* type: discord
|
|
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";
|
|
13
|
+
import { DiscordAdapter } from "./discord-adapter.js";
|
|
14
|
+
|
|
15
|
+
interface AdapterOpts {
|
|
16
|
+
id: string;
|
|
17
|
+
botToken: string;
|
|
18
|
+
accessManager: AccessManager;
|
|
19
|
+
inboxDir: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Plugin factory — default export for AgEnD plugin loader. */
|
|
23
|
+
export default function createAdapter(config: ChannelConfig, opts: AdapterOpts): ChannelAdapter {
|
|
24
|
+
return new DiscordAdapter({
|
|
25
|
+
...opts,
|
|
26
|
+
guildId: config.group_id != null ? String(config.group_id) : "",
|
|
27
|
+
categoryName: (config.options?.category_name as string) ?? undefined,
|
|
28
|
+
generalChannelId: (config.options?.general_channel_id as string) ?? undefined,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { DiscordAdapter } from "./discord-adapter.js";
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"rootDir": "src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|