agent-messenger 1.6.0 → 1.7.0

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.
Files changed (117) hide show
  1. package/.claude-plugin/marketplace.json +13 -0
  2. package/.claude-plugin/plugin.json +2 -1
  3. package/.env.template +5 -0
  4. package/README.md +3 -1
  5. package/dist/package.json +3 -2
  6. package/dist/src/cli.d.ts.map +1 -1
  7. package/dist/src/cli.js +3 -0
  8. package/dist/src/cli.js.map +1 -1
  9. package/dist/src/platforms/discordbot/cli.d.ts +5 -0
  10. package/dist/src/platforms/discordbot/cli.d.ts.map +1 -0
  11. package/dist/src/platforms/discordbot/cli.js +24 -0
  12. package/dist/src/platforms/discordbot/cli.js.map +1 -0
  13. package/dist/src/platforms/discordbot/client.d.ts +41 -0
  14. package/dist/src/platforms/discordbot/client.d.ts.map +1 -0
  15. package/dist/src/platforms/discordbot/client.js +256 -0
  16. package/dist/src/platforms/discordbot/client.js.map +1 -0
  17. package/dist/src/platforms/discordbot/commands/auth.d.ts +30 -0
  18. package/dist/src/platforms/discordbot/commands/auth.d.ts.map +1 -0
  19. package/dist/src/platforms/discordbot/commands/auth.js +180 -0
  20. package/dist/src/platforms/discordbot/commands/auth.js.map +1 -0
  21. package/dist/src/platforms/discordbot/commands/channel.d.ts +21 -0
  22. package/dist/src/platforms/discordbot/commands/channel.d.ts.map +1 -0
  23. package/dist/src/platforms/discordbot/commands/channel.js +79 -0
  24. package/dist/src/platforms/discordbot/commands/channel.js.map +1 -0
  25. package/dist/src/platforms/discordbot/commands/file.d.ts +24 -0
  26. package/dist/src/platforms/discordbot/commands/file.d.ts.map +1 -0
  27. package/dist/src/platforms/discordbot/commands/file.js +78 -0
  28. package/dist/src/platforms/discordbot/commands/file.js.map +1 -0
  29. package/dist/src/platforms/discordbot/commands/index.d.ts +10 -0
  30. package/dist/src/platforms/discordbot/commands/index.d.ts.map +1 -0
  31. package/dist/src/platforms/discordbot/commands/index.js +10 -0
  32. package/dist/src/platforms/discordbot/commands/index.js.map +1 -0
  33. package/dist/src/platforms/discordbot/commands/message.d.ts +38 -0
  34. package/dist/src/platforms/discordbot/commands/message.d.ts.map +1 -0
  35. package/dist/src/platforms/discordbot/commands/message.js +191 -0
  36. package/dist/src/platforms/discordbot/commands/message.js.map +1 -0
  37. package/dist/src/platforms/discordbot/commands/reaction.d.ts +14 -0
  38. package/dist/src/platforms/discordbot/commands/reaction.d.ts.map +1 -0
  39. package/dist/src/platforms/discordbot/commands/reaction.js +65 -0
  40. package/dist/src/platforms/discordbot/commands/reaction.js.map +1 -0
  41. package/dist/src/platforms/discordbot/commands/server.d.ts +22 -0
  42. package/dist/src/platforms/discordbot/commands/server.d.ts.map +1 -0
  43. package/dist/src/platforms/discordbot/commands/server.js +94 -0
  44. package/dist/src/platforms/discordbot/commands/server.js.map +1 -0
  45. package/dist/src/platforms/discordbot/commands/shared.d.ts +11 -0
  46. package/dist/src/platforms/discordbot/commands/shared.d.ts.map +1 -0
  47. package/dist/src/platforms/discordbot/commands/shared.js +24 -0
  48. package/dist/src/platforms/discordbot/commands/shared.js.map +1 -0
  49. package/dist/src/platforms/discordbot/commands/snapshot.d.ts +31 -0
  50. package/dist/src/platforms/discordbot/commands/snapshot.d.ts.map +1 -0
  51. package/dist/src/platforms/discordbot/commands/snapshot.js +79 -0
  52. package/dist/src/platforms/discordbot/commands/snapshot.js.map +1 -0
  53. package/dist/src/platforms/discordbot/commands/thread.d.ts +25 -0
  54. package/dist/src/platforms/discordbot/commands/thread.d.ts.map +1 -0
  55. package/dist/src/platforms/discordbot/commands/thread.js +70 -0
  56. package/dist/src/platforms/discordbot/commands/thread.js.map +1 -0
  57. package/dist/src/platforms/discordbot/commands/user.d.ts +23 -0
  58. package/dist/src/platforms/discordbot/commands/user.d.ts.map +1 -0
  59. package/dist/src/platforms/discordbot/commands/user.js +74 -0
  60. package/dist/src/platforms/discordbot/commands/user.js.map +1 -0
  61. package/dist/src/platforms/discordbot/credential-manager.d.ts +19 -0
  62. package/dist/src/platforms/discordbot/credential-manager.d.ts.map +1 -0
  63. package/dist/src/platforms/discordbot/credential-manager.js +130 -0
  64. package/dist/src/platforms/discordbot/credential-manager.js.map +1 -0
  65. package/dist/src/platforms/discordbot/index.d.ts +4 -0
  66. package/dist/src/platforms/discordbot/index.d.ts.map +1 -0
  67. package/dist/src/platforms/discordbot/index.js +4 -0
  68. package/dist/src/platforms/discordbot/index.js.map +1 -0
  69. package/dist/src/platforms/discordbot/types.d.ts +356 -0
  70. package/dist/src/platforms/discordbot/types.d.ts.map +1 -0
  71. package/dist/src/platforms/discordbot/types.js +93 -0
  72. package/dist/src/platforms/discordbot/types.js.map +1 -0
  73. package/dist/src/platforms/slack/types.d.ts +4 -4
  74. package/dist/src/platforms/slackbot/types.d.ts +22 -22
  75. package/docs/content/docs/index.mdx +3 -2
  76. package/docs/content/docs/integrations/discordbot.mdx +267 -0
  77. package/docs/content/docs/integrations/meta.json +1 -1
  78. package/docs/content/docs/quick-start.mdx +3 -2
  79. package/e2e/config.ts +32 -0
  80. package/e2e/discordbot.e2e.test.ts +323 -0
  81. package/e2e/helpers.ts +15 -15
  82. package/package.json +3 -2
  83. package/skills/agent-discordbot/SKILL.md +421 -0
  84. package/skills/agent-discordbot/references/authentication.md +208 -0
  85. package/skills/agent-discordbot/references/common-patterns.md +229 -0
  86. package/skills/agent-discordbot/templates/monitor-channel.sh +104 -0
  87. package/skills/agent-discordbot/templates/post-message.sh +112 -0
  88. package/skills/agent-discordbot/templates/server-summary.sh +109 -0
  89. package/src/cli.ts +4 -0
  90. package/src/platforms/discordbot/cli.ts +39 -0
  91. package/src/platforms/discordbot/client.test.ts +501 -0
  92. package/src/platforms/discordbot/client.ts +341 -0
  93. package/src/platforms/discordbot/commands/auth.test.ts +311 -0
  94. package/src/platforms/discordbot/commands/auth.ts +225 -0
  95. package/src/platforms/discordbot/commands/channel.test.ts +237 -0
  96. package/src/platforms/discordbot/commands/channel.ts +103 -0
  97. package/src/platforms/discordbot/commands/file.test.ts +143 -0
  98. package/src/platforms/discordbot/commands/file.ts +108 -0
  99. package/src/platforms/discordbot/commands/index.ts +9 -0
  100. package/src/platforms/discordbot/commands/message.test.ts +313 -0
  101. package/src/platforms/discordbot/commands/message.ts +248 -0
  102. package/src/platforms/discordbot/commands/reaction.test.ts +79 -0
  103. package/src/platforms/discordbot/commands/reaction.ts +88 -0
  104. package/src/platforms/discordbot/commands/server.test.ts +249 -0
  105. package/src/platforms/discordbot/commands/server.ts +126 -0
  106. package/src/platforms/discordbot/commands/shared.ts +36 -0
  107. package/src/platforms/discordbot/commands/snapshot.test.ts +209 -0
  108. package/src/platforms/discordbot/commands/snapshot.ts +115 -0
  109. package/src/platforms/discordbot/commands/thread.test.ts +164 -0
  110. package/src/platforms/discordbot/commands/thread.ts +101 -0
  111. package/src/platforms/discordbot/commands/user.test.ts +205 -0
  112. package/src/platforms/discordbot/commands/user.ts +98 -0
  113. package/src/platforms/discordbot/credential-manager.test.ts +309 -0
  114. package/src/platforms/discordbot/credential-manager.ts +161 -0
  115. package/src/platforms/discordbot/index.ts +23 -0
  116. package/src/platforms/discordbot/types.test.ts +294 -0
  117. package/src/platforms/discordbot/types.ts +189 -0
@@ -46,6 +46,19 @@
46
46
  "homepage": "https://github.com/devxoul/agent-messenger",
47
47
  "keywords": ["slack", "slackbot", "bot", "messaging", "ai-agent", "cli", "ci-cd"]
48
48
  },
49
+ {
50
+ "name": "agent-discordbot",
51
+ "description": "Interact with Discord servers using bot tokens. Designed for server-side and CI/CD integrations. Supports message operations, channel management, reactions, and multi-bot/multi-guild credential management.",
52
+ "version": "0.1.0",
53
+ "author": {
54
+ "name": "devxoul",
55
+ "url": "https://github.com/devxoul"
56
+ },
57
+ "source": "./",
58
+ "category": "productivity",
59
+ "homepage": "https://github.com/devxoul/agent-messenger",
60
+ "keywords": ["discord", "discordbot", "bot", "messaging", "ai-agent", "cli", "ci-cd"]
61
+ },
49
62
  {
50
63
  "name": "agent-teams",
51
64
  "description": "Interact with Microsoft Teams through a CLI interface. Features credential extraction from Teams desktop app and browser, multi-team support, message operations, channel management, reactions, and file uploads.",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-messenger",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Messaging platform interaction skills for AI agents. Interact with Slack, Discord, and Microsoft Teams - send messages, read channels, manage reactions, upload files, and more through simple CLI interfaces.",
5
5
  "author": {
6
6
  "name": "devxoul",
@@ -25,6 +25,7 @@
25
25
  "./skills/agent-slack",
26
26
  "./skills/agent-slackbot",
27
27
  "./skills/agent-discord",
28
+ "./skills/agent-discordbot",
28
29
  "./skills/agent-teams"
29
30
  ]
30
31
  }
package/.env.template CHANGED
@@ -13,6 +13,11 @@ E2E_SLACKBOT_WORKSPACE_NAME=Agent Messenger
13
13
  E2E_DISCORD_TOKEN=
14
14
  E2E_DISCORD_SERVER_ID=1467039439770357844
15
15
 
16
+ # DiscordBot (bot token)
17
+ E2E_DISCORDBOT_TOKEN=
18
+ E2E_DISCORDBOT_SERVER_ID=1467039439770357844
19
+ E2E_DISCORDBOT_SERVER_NAME=Agent Messenger
20
+
16
21
  # Teams
17
22
  E2E_TEAMS_TEAM_ID=
18
23
  E2E_TEAMS_TEAM_NAME=Agent Messenger
package/README.md CHANGED
@@ -28,6 +28,7 @@ This installs:
28
28
  - `agent-slack` — Slack CLI (user token, zero-config)
29
29
  - `agent-slackbot` — Slack Bot CLI (bot token, for server-side/CI/CD)
30
30
  - `agent-discord` — Discord CLI
31
+ - `agent-discordbot` — Discord Bot CLI (bot token, for server-side/CI/CD)
31
32
  - `agent-teams` — Microsoft Teams CLI
32
33
 
33
34
  ## 🧠 Agent Skills
@@ -100,7 +101,7 @@ That's it. Credentials are extracted automatically from your Slack desktop app o
100
101
  | Saved items | ✅ | — | — |
101
102
  | Unread messages | ✅ | — | — |
102
103
  | Sidebar sections | ✅ | — | — |
103
- | Bot support | ✅ | | — |
104
+ | Bot support | ✅ | | — |
104
105
 
105
106
  > ⚠️ **Teams tokens expire in 60-90 minutes.** Re-run `agent-teams auth extract` to refresh. See [Teams Guide](skills/agent-teams/SKILL.md) for details.
106
107
 
@@ -109,6 +110,7 @@ That's it. Credentials are extracted automatically from your Slack desktop app o
109
110
  - **[Slack Guide](skills/agent-slack/SKILL.md)** — Full command reference for Slack
110
111
  - **[Slack Bot Guide](skills/agent-slackbot/SKILL.md)** — Bot token integration for server-side and CI/CD
111
112
  - **[Discord Guide](skills/agent-discord/SKILL.md)** — Full command reference for Discord
113
+ - **[Discord Bot Guide](skills/agent-discordbot/SKILL.md)** — Bot token integration for server-side and CI/CD
112
114
  - **[Teams Guide](skills/agent-teams/SKILL.md)** — Full command reference for Microsoft Teams
113
115
 
114
116
  ## 💡 Use Cases
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-messenger",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Multi-platform messaging CLI for AI agents (Slack, Discord, Teams)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,8 @@
15
15
  "agent-slack": "./src/platforms/slack/cli.ts",
16
16
  "agent-discord": "./src/platforms/discord/cli.ts",
17
17
  "agent-teams": "./src/platforms/teams/cli.ts",
18
- "agent-slackbot": "./src/platforms/slackbot/cli.ts"
18
+ "agent-slackbot": "./src/platforms/slackbot/cli.ts",
19
+ "agent-discordbot": "./src/platforms/discordbot/cli.ts"
19
20
  },
20
21
  "scripts": {
21
22
  "build": "tsc && tsc-alias --resolve-full-paths",
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,QAAA,MAAM,OAAO,SAAgB,CAAA;AAuB7B,eAAe,OAAO,CAAA"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,QAAA,MAAM,OAAO,SAAgB,CAAA;AA2B7B,eAAe,OAAO,CAAA"}
package/dist/src/cli.js CHANGED
@@ -21,6 +21,9 @@ program.command('teams', 'Interact with Microsoft Teams', {
21
21
  program.command('slackbot', 'Interact with Slack using bot tokens', {
22
22
  executableFile: join(__dirname, 'platforms', 'slackbot', `cli${ext}`),
23
23
  });
24
+ program.command('discordbot', 'Interact with Discord using bot tokens', {
25
+ executableFile: join(__dirname, 'platforms', 'discordbot', `cli${ext}`),
26
+ });
24
27
  program.parse(process.argv);
25
28
  export default program;
26
29
  //# sourceMappingURL=cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAEvD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AACrC,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AAEtD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,4CAA4C,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AAE9G,0CAA0C;AAC1C,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,gCAAgC,EAAE;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 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../src/platforms/discordbot/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAcnC,QAAA,MAAM,OAAO,SAAgB,CAAA;AAsB7B,eAAe,OAAO,CAAA"}
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env bun
2
+ import { Command } from 'commander';
3
+ import pkg from '../../../package.json' with { type: 'json' };
4
+ import { authCommand, channelCommand, fileCommand, messageCommand, reactionCommand, serverCommand, snapshotCommand, threadCommand, userCommand, } from './commands/index.js';
5
+ const program = new Command();
6
+ program
7
+ .name('agent-discordbot')
8
+ .description('CLI tool for Discord bot integration using bot tokens')
9
+ .version(pkg.version)
10
+ .option('--pretty', 'Pretty-print JSON output')
11
+ .option('--bot <id>', 'Bot ID to use')
12
+ .option('--server <id>', 'Server ID to use');
13
+ program.addCommand(authCommand);
14
+ program.addCommand(serverCommand);
15
+ program.addCommand(messageCommand);
16
+ program.addCommand(channelCommand);
17
+ program.addCommand(userCommand);
18
+ program.addCommand(reactionCommand);
19
+ program.addCommand(fileCommand);
20
+ program.addCommand(threadCommand);
21
+ program.addCommand(snapshotCommand);
22
+ program.parseAsync(process.argv);
23
+ export default program;
24
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../../src/platforms/discordbot/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,GAAG,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAC7D,OAAO,EACL,WAAW,EACX,cAAc,EACd,WAAW,EACX,cAAc,EACd,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,kBAAkB,CAAA;AAEzB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,kBAAkB,CAAC;KACxB,WAAW,CAAC,uDAAuD,CAAC;KACpE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;KACpB,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC;KACrC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAA;AAE9C,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;AACjC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;AACnC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;AACjC,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;AAEnC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAEhC,eAAe,OAAO,CAAA"}
@@ -0,0 +1,41 @@
1
+ import type { DiscordChannel, DiscordFile, DiscordGuild, DiscordMessage, DiscordUser } from './types.js';
2
+ export declare class DiscordBotClient {
3
+ private token;
4
+ private buckets;
5
+ private globalRateLimitUntil;
6
+ constructor(token: string);
7
+ private getHeaders;
8
+ private getBucketKey;
9
+ private waitForRateLimit;
10
+ private updateBucket;
11
+ private handleRateLimitResponse;
12
+ private sleep;
13
+ private handleErrorResponse;
14
+ private request;
15
+ private requestFormData;
16
+ testAuth(): Promise<DiscordUser>;
17
+ listGuilds(): Promise<DiscordGuild[]>;
18
+ getGuild(guildId: string): Promise<DiscordGuild>;
19
+ listChannels(guildId: string): Promise<DiscordChannel[]>;
20
+ getChannel(channelId: string): Promise<DiscordChannel>;
21
+ sendMessage(channelId: string, content: string, options?: {
22
+ thread_id?: string;
23
+ }): Promise<DiscordMessage>;
24
+ getMessages(channelId: string, limit?: number): Promise<DiscordMessage[]>;
25
+ getMessage(channelId: string, messageId: string): Promise<DiscordMessage>;
26
+ editMessage(channelId: string, messageId: string, content: string): Promise<DiscordMessage>;
27
+ deleteMessage(channelId: string, messageId: string): Promise<void>;
28
+ addReaction(channelId: string, messageId: string, emoji: string): Promise<void>;
29
+ removeReaction(channelId: string, messageId: string, emoji: string): Promise<void>;
30
+ listUsers(guildId: string): Promise<DiscordUser[]>;
31
+ getUser(userId: string): Promise<DiscordUser>;
32
+ uploadFile(channelId: string, filePath: string): Promise<DiscordFile>;
33
+ listFiles(channelId: string): Promise<DiscordFile[]>;
34
+ createThread(channelId: string, name: string, options?: {
35
+ auto_archive_duration?: number;
36
+ rate_limit_per_user?: number;
37
+ }): Promise<DiscordChannel>;
38
+ archiveThread(threadId: string, archived?: boolean): Promise<DiscordChannel>;
39
+ resolveChannel(guildId: string, channel: string): Promise<string>;
40
+ }
41
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/platforms/discordbot/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAarG,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,OAAO,CAA0C;IACzD,OAAO,CAAC,oBAAoB,CAAY;gBAE5B,KAAK,EAAE,MAAM;IAOzB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,YAAY;YASN,gBAAgB;IAa9B,OAAO,CAAC,YAAY;YAcN,uBAAuB;IAarC,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,mBAAmB;YAOb,OAAO;YA8DP,eAAe;IAwDvB,QAAQ,I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SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAmBrE,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAepD,YAAY,CAChB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QACR,qBAAqB,CAAC,EAAE,MAAM,CAAA;QAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAC7B,GACA,OAAO,CAAC,cAAc,CAAC;IAOpB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAIlF,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAUxE"}
@@ -0,0 +1,256 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { DiscordBotError } from './types.js';
3
+ const BASE_URL = 'https://discord.com/api/v10';
4
+ const MAX_RETRIES = 3;
5
+ const BASE_BACKOFF_MS = 100;
6
+ export class DiscordBotClient {
7
+ token;
8
+ buckets = new Map();
9
+ globalRateLimitUntil = 0;
10
+ constructor(token) {
11
+ if (!token) {
12
+ throw new DiscordBotError('Token is required', 'missing_token');
13
+ }
14
+ this.token = token;
15
+ }
16
+ getHeaders() {
17
+ return {
18
+ Authorization: `Bot ${this.token}`,
19
+ 'User-Agent': 'DiscordBot (https://github.com/devxoul/agent-messenger, 1.0)',
20
+ 'Content-Type': 'application/json',
21
+ };
22
+ }
23
+ getBucketKey(method, path) {
24
+ const normalized = path
25
+ .replace(/\/channels\/\d+/, '/channels/{channel_id}')
26
+ .replace(/\/guilds\/\d+/, '/guilds/{guild_id}')
27
+ .replace(/\/users\/\d+/, '/users/{user_id}')
28
+ .replace(/\/messages\/\d+/, '/messages/{message_id}');
29
+ return `${method}:${normalized}`;
30
+ }
31
+ async waitForRateLimit(bucketKey) {
32
+ const now = Date.now();
33
+ if (this.globalRateLimitUntil > now) {
34
+ await this.sleep(this.globalRateLimitUntil - now);
35
+ }
36
+ const bucket = this.buckets.get(bucketKey);
37
+ if (bucket && bucket.remaining === 0 && bucket.resetAt * 1000 > now) {
38
+ await this.sleep(bucket.resetAt * 1000 - now);
39
+ }
40
+ }
41
+ updateBucket(bucketKey, response) {
42
+ const remaining = response.headers.get('X-RateLimit-Remaining');
43
+ const reset = response.headers.get('X-RateLimit-Reset');
44
+ const bucketHash = response.headers.get('X-RateLimit-Bucket');
45
+ if (remaining !== null && reset !== null && bucketHash !== null) {
46
+ this.buckets.set(bucketKey, {
47
+ remaining: parseInt(remaining, 10),
48
+ resetAt: parseFloat(reset),
49
+ bucketHash,
50
+ });
51
+ }
52
+ }
53
+ async handleRateLimitResponse(response) {
54
+ const retryAfter = response.headers.get('Retry-After');
55
+ const isGlobal = response.headers.get('X-RateLimit-Global') === 'true';
56
+ const waitMs = parseFloat(retryAfter || '1') * 1000;
57
+ if (isGlobal) {
58
+ this.globalRateLimitUntil = Date.now() + waitMs;
59
+ }
60
+ await this.sleep(waitMs);
61
+ return waitMs;
62
+ }
63
+ sleep(ms) {
64
+ return new Promise((resolve) => setTimeout(resolve, ms));
65
+ }
66
+ handleErrorResponse(response, errorBody) {
67
+ throw new DiscordBotError(errorBody.message || `HTTP ${response.status}`, errorBody.code?.toString() || `http_${response.status}`);
68
+ }
69
+ async request(method, path, body) {
70
+ const url = `${BASE_URL}${path}`;
71
+ const bucketKey = this.getBucketKey(method, path);
72
+ let lastError;
73
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
74
+ await this.waitForRateLimit(bucketKey);
75
+ const headers = this.getHeaders();
76
+ const options = {
77
+ method,
78
+ headers,
79
+ };
80
+ if (body !== undefined) {
81
+ options.body = JSON.stringify(body);
82
+ }
83
+ let response;
84
+ try {
85
+ response = await fetch(url, options);
86
+ }
87
+ catch (error) {
88
+ lastError = error instanceof Error ? error : new Error(String(error));
89
+ if (attempt < MAX_RETRIES) {
90
+ await this.sleep(BASE_BACKOFF_MS * 2 ** attempt);
91
+ continue;
92
+ }
93
+ throw new DiscordBotError(`Network error: ${lastError.message}`, 'network_error');
94
+ }
95
+ this.updateBucket(bucketKey, response);
96
+ if (response.status === 429) {
97
+ if (attempt < MAX_RETRIES) {
98
+ await this.handleRateLimitResponse(response);
99
+ continue;
100
+ }
101
+ const errorBody = await response.json().catch(() => ({}));
102
+ throw new DiscordBotError(errorBody.message || 'Rate limited', 'rate_limited');
103
+ }
104
+ if (response.status >= 500 && attempt < MAX_RETRIES) {
105
+ await this.sleep(BASE_BACKOFF_MS * 2 ** attempt);
106
+ continue;
107
+ }
108
+ if (!response.ok) {
109
+ const errorBody = await response.json().catch(() => ({}));
110
+ this.handleErrorResponse(response, errorBody);
111
+ }
112
+ if (response.status === 204) {
113
+ return undefined;
114
+ }
115
+ return response.json();
116
+ }
117
+ throw lastError || new DiscordBotError('Request failed after retries', 'max_retries');
118
+ }
119
+ async requestFormData(path, formData) {
120
+ const url = `${BASE_URL}${path}`;
121
+ const bucketKey = this.getBucketKey('POST', path);
122
+ let lastError;
123
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
124
+ await this.waitForRateLimit(bucketKey);
125
+ const headers = {
126
+ Authorization: `Bot ${this.token}`,
127
+ 'User-Agent': 'DiscordBot (https://github.com/devxoul/agent-messenger, 1.0)',
128
+ };
129
+ let response;
130
+ try {
131
+ response = await fetch(url, {
132
+ method: 'POST',
133
+ headers,
134
+ body: formData,
135
+ });
136
+ }
137
+ catch (error) {
138
+ lastError = error instanceof Error ? error : new Error(String(error));
139
+ if (attempt < MAX_RETRIES) {
140
+ await this.sleep(BASE_BACKOFF_MS * 2 ** attempt);
141
+ continue;
142
+ }
143
+ throw new DiscordBotError(`Network error: ${lastError.message}`, 'network_error');
144
+ }
145
+ this.updateBucket(bucketKey, response);
146
+ if (response.status === 429) {
147
+ if (attempt < MAX_RETRIES) {
148
+ await this.handleRateLimitResponse(response);
149
+ continue;
150
+ }
151
+ const errorBody = await response.json().catch(() => ({}));
152
+ throw new DiscordBotError(errorBody.message || 'Rate limited', 'rate_limited');
153
+ }
154
+ if (response.status >= 500 && attempt < MAX_RETRIES) {
155
+ await this.sleep(BASE_BACKOFF_MS * 2 ** attempt);
156
+ continue;
157
+ }
158
+ if (!response.ok) {
159
+ const errorBody = await response.json().catch(() => ({}));
160
+ this.handleErrorResponse(response, errorBody);
161
+ }
162
+ return response.json();
163
+ }
164
+ throw lastError || new DiscordBotError('Request failed after retries', 'max_retries');
165
+ }
166
+ async testAuth() {
167
+ return this.request('GET', '/users/@me');
168
+ }
169
+ async listGuilds() {
170
+ return this.request('GET', '/users/@me/guilds');
171
+ }
172
+ async getGuild(guildId) {
173
+ return this.request('GET', `/guilds/${guildId}`);
174
+ }
175
+ async listChannels(guildId) {
176
+ return this.request('GET', `/guilds/${guildId}/channels`);
177
+ }
178
+ async getChannel(channelId) {
179
+ return this.request('GET', `/channels/${channelId}`);
180
+ }
181
+ async sendMessage(channelId, content, options) {
182
+ const body = { content };
183
+ if (options?.thread_id) {
184
+ body.thread_id = options.thread_id;
185
+ }
186
+ return this.request('POST', `/channels/${channelId}/messages`, body);
187
+ }
188
+ async getMessages(channelId, limit = 50) {
189
+ return this.request('GET', `/channels/${channelId}/messages?limit=${limit}`);
190
+ }
191
+ async getMessage(channelId, messageId) {
192
+ return this.request('GET', `/channels/${channelId}/messages/${messageId}`);
193
+ }
194
+ async editMessage(channelId, messageId, content) {
195
+ return this.request('PATCH', `/channels/${channelId}/messages/${messageId}`, { content });
196
+ }
197
+ async deleteMessage(channelId, messageId) {
198
+ return this.request('DELETE', `/channels/${channelId}/messages/${messageId}`);
199
+ }
200
+ async addReaction(channelId, messageId, emoji) {
201
+ const encodedEmoji = encodeURIComponent(emoji);
202
+ return this.request('PUT', `/channels/${channelId}/messages/${messageId}/reactions/${encodedEmoji}/@me`);
203
+ }
204
+ async removeReaction(channelId, messageId, emoji) {
205
+ const encodedEmoji = encodeURIComponent(emoji);
206
+ return this.request('DELETE', `/channels/${channelId}/messages/${messageId}/reactions/${encodedEmoji}/@me`);
207
+ }
208
+ async listUsers(guildId) {
209
+ const members = await this.request('GET', `/guilds/${guildId}/members?limit=1000`);
210
+ return members.map((m) => m.user);
211
+ }
212
+ async getUser(userId) {
213
+ return this.request('GET', `/users/${userId}`);
214
+ }
215
+ async uploadFile(channelId, filePath) {
216
+ const fileBuffer = await readFile(filePath);
217
+ const filename = filePath.split('/').pop() || 'file';
218
+ const formData = new FormData();
219
+ formData.append('files[0]', new Blob([fileBuffer]), filename);
220
+ const message = await this.requestFormData(`/channels/${channelId}/messages`, formData);
221
+ if (!message.attachments || message.attachments.length === 0) {
222
+ throw new DiscordBotError('Upload succeeded but no attachments returned', 'no_attachments');
223
+ }
224
+ return message.attachments[0];
225
+ }
226
+ async listFiles(channelId) {
227
+ const messages = await this.request('GET', `/channels/${channelId}/messages?limit=100`);
228
+ const files = [];
229
+ for (const msg of messages) {
230
+ if (msg.attachments && msg.attachments.length > 0) {
231
+ files.push(...msg.attachments);
232
+ }
233
+ }
234
+ return files;
235
+ }
236
+ async createThread(channelId, name, options) {
237
+ return this.request('POST', `/channels/${channelId}/threads`, {
238
+ name,
239
+ ...options,
240
+ });
241
+ }
242
+ async archiveThread(threadId, archived = true) {
243
+ return this.request('PATCH', `/channels/${threadId}`, { archived });
244
+ }
245
+ async resolveChannel(guildId, channel) {
246
+ if (/^\d+$/.test(channel))
247
+ return channel;
248
+ const channels = await this.listChannels(guildId);
249
+ const found = channels.find((c) => c.name === channel || c.name === channel.replace(/^#/, ''));
250
+ if (!found) {
251
+ throw new DiscordBotError(`Channel not found: "${channel}"`, 'channel_not_found');
252
+ }
253
+ return found.id;
254
+ }
255
+ }
256
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/platforms/discordbot/client.ts"],"names":[],"mappings":"AA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a,SAAS,UAAU,EAAE;YAC5E,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAgB,EAAE,WAAoB,IAAI;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAiB,OAAO,EAAE,aAAa,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IACrF,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAe,EAAE,OAAe;QACnD,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;YAAE,OAAO,OAAO,CAAA;QAEzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QACjD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAA;QAC9F,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,eAAe,CAAC,uBAAuB,OAAO,GAAG,EAAE,mBAAmB,CAAC,CAAA;QACnF,CAAC;QACD,OAAO,KAAK,CAAC,EAAE,CAAA;IACjB,CAAC;CACF"}
@@ -0,0 +1,30 @@
1
+ import { Command } from 'commander';
2
+ import { DiscordBotCredentialManager } from '../credential-manager.js';
3
+ interface ActionOptions {
4
+ pretty?: boolean;
5
+ bot?: string;
6
+ _credManager?: DiscordBotCredentialManager;
7
+ }
8
+ interface ActionResult {
9
+ success?: boolean;
10
+ error?: string;
11
+ bot_id?: string;
12
+ bot_name?: string;
13
+ server_id?: string;
14
+ server_name?: string;
15
+ valid?: boolean;
16
+ bots?: Array<{
17
+ bot_id: string;
18
+ bot_name: string;
19
+ is_current: boolean;
20
+ }>;
21
+ }
22
+ export declare function setAction(token: string, options: ActionOptions): Promise<ActionResult>;
23
+ export declare function clearAction(options: ActionOptions): Promise<ActionResult>;
24
+ export declare function statusAction(options: ActionOptions): Promise<ActionResult>;
25
+ export declare function listAction(options: ActionOptions): Promise<ActionResult>;
26
+ export declare function useAction(botId: string, options: ActionOptions): Promise<ActionResult>;
27
+ export declare function removeAction(botId: string, options: ActionOptions): Promise<ActionResult>;
28
+ export declare const authCommand: Command;
29
+ export {};
30
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/discordbot/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAEnE,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,2BAA2B,CAAA;CAC3C;AAED,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,KAAK,CAAC;QACX,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;QAChB,UAAU,EAAE,OAAO,CAAA;KACpB,CAAC,CAAA;CACH;AAED,wBAAsB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAkC5F;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAQ/E;AAED,wBAAsB,YAAY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