@mastra/discord 1.1.0-alpha.0 → 1.1.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.
- package/CHANGELOG.md +38 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @mastra/discord
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added `@mastra/discord` for connecting Mastra agents to Discord. One Discord app serves many servers, and agents respond to slash commands, DMs, and @mentions. Set `encryptionKey` or `MASTRA_ENCRYPTION_KEY` to encrypt the stored bot token at rest. ([#25002](https://github.com/mastra-ai/mastra/pull/25002))
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Mastra } from '@mastra/core';
|
|
11
|
+
import { DiscordProvider } from '@mastra/discord';
|
|
12
|
+
|
|
13
|
+
// App credentials from the Discord Developer Portal (or the DISCORD_BOT_TOKEN /
|
|
14
|
+
// DISCORD_PUBLIC_KEY / DISCORD_APPLICATION_ID env vars):
|
|
15
|
+
const discord = new DiscordProvider({
|
|
16
|
+
app: {
|
|
17
|
+
botToken: process.env.DISCORD_BOT_TOKEN!,
|
|
18
|
+
publicKey: process.env.DISCORD_PUBLIC_KEY!,
|
|
19
|
+
applicationId: process.env.DISCORD_APPLICATION_ID!,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const mastra = new Mastra({
|
|
24
|
+
agents: { support },
|
|
25
|
+
channels: { discord },
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Bind an agent. If the bot is already in DISCORD_GUILD_ID, this binds the
|
|
29
|
+
// agent to that guild and registers its slash commands immediately. Otherwise
|
|
30
|
+
// it returns an OAuth2 bot-invite URL and the install stays pending until the
|
|
31
|
+
// bot joins a guild — the first interaction from that guild activates it.
|
|
32
|
+
const result = await discord.connect('support', { guildId: process.env.DISCORD_GUILD_ID });
|
|
33
|
+
// → { type: 'immediate' } OR { type: 'oauth', authorizationUrl, installationId }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`fc7d2c1`](https://github.com/mastra-ai/mastra/commit/fc7d2c102e911f43f70f425e67c970231ea19363), [`4607046`](https://github.com/mastra-ai/mastra/commit/460704663e2869183e7dfff7efec49a4f2f47503), [`1e435dc`](https://github.com/mastra-ai/mastra/commit/1e435dc84a9c1b35aa58d0ab9b14ff39fe13aab0), [`9ba23a2`](https://github.com/mastra-ai/mastra/commit/9ba23a23893622b72c76189199d02432590606c1), [`b757896`](https://github.com/mastra-ai/mastra/commit/b757896872edd74f71ec104be92273c5406265da), [`7f64865`](https://github.com/mastra-ai/mastra/commit/7f648656d2b24b214a899e8835b8286333c80a19), [`f751e65`](https://github.com/mastra-ai/mastra/commit/f751e659f496e5e53ed38632c59c296fec2ccbe5)]:
|
|
39
|
+
- @mastra/core@1.71.0
|
|
40
|
+
|
|
3
41
|
## 1.1.0-alpha.0
|
|
4
42
|
|
|
5
43
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/discord",
|
|
3
|
-
"version": "1.1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Discord integration for Mastra agents — a ChannelProvider over @chat-adapter/discord with Ed25519 interaction verification, guild command registration, and streaming replies",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typescript": "^7.0.2",
|
|
32
32
|
"undici": "^6.0.0",
|
|
33
33
|
"vitest": "^4.1.10",
|
|
34
|
-
"@mastra/core": "1.71.0
|
|
34
|
+
"@mastra/core": "1.71.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@mastra/core": ">=1.22.0 <2.0.0"
|