@elizaos/plugin-discord 1.0.6 → 1.0.7
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/README.md +64 -56
- package/package.json +32 -2
package/README.md
CHANGED
|
@@ -4,12 +4,18 @@ A Discord plugin implementation for ElizaOS, enabling rich integration with Disc
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- Handle server join events and manage initial configurations
|
|
8
|
-
- Voice event management via the voice manager
|
|
9
|
-
- Manage and process new messages with the message manager
|
|
10
|
-
- Slash command registration and interaction handling
|
|
11
|
-
-
|
|
12
|
-
-
|
|
7
|
+
- Handle server join events and manage initial configurations
|
|
8
|
+
- Voice event management via the voice manager
|
|
9
|
+
- Manage and process new messages with the message manager
|
|
10
|
+
- Slash command registration and interaction handling
|
|
11
|
+
- Support for Discord attachments and media files
|
|
12
|
+
- Voice channel join/leave functionality
|
|
13
|
+
- Conversation summarization
|
|
14
|
+
- Media transcription capabilities
|
|
15
|
+
- Channel state and voice state providers
|
|
16
|
+
- Channel restriction support (limit bot to specific channels)
|
|
17
|
+
- Robust permissions management for bot functionality
|
|
18
|
+
- Event-driven architecture with comprehensive event handling
|
|
13
19
|
|
|
14
20
|
## Installation
|
|
15
21
|
|
|
@@ -24,7 +30,7 @@ bun install
|
|
|
24
30
|
The plugin requires the following environment variables:
|
|
25
31
|
|
|
26
32
|
```bash
|
|
27
|
-
# Discord API Credentials
|
|
33
|
+
# Discord API Credentials (Required)
|
|
28
34
|
DISCORD_APPLICATION_ID=your_application_id
|
|
29
35
|
DISCORD_API_TOKEN=your_api_token
|
|
30
36
|
|
|
@@ -36,73 +42,75 @@ CHANNEL_IDS=123456789012345678,987654321098765432
|
|
|
36
42
|
|
|
37
43
|
## Usage
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
```json
|
|
46
|
+
const character = {
|
|
47
|
+
"plugins": [
|
|
48
|
+
...otherPlugins,
|
|
49
|
+
"@elizaos/plugin-discord"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
46
52
|
```
|
|
47
53
|
|
|
48
|
-
###
|
|
54
|
+
### Available Actions
|
|
49
55
|
|
|
50
|
-
|
|
56
|
+
The plugin provides the following actions:
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
]);
|
|
60
|
-
```
|
|
58
|
+
1. **chatWithAttachments** - Handle messages with Discord attachments
|
|
59
|
+
2. **downloadMedia** - Download media files from Discord messages
|
|
60
|
+
3. **joinVoice** - Join a voice channel
|
|
61
|
+
4. **leaveVoice** - Leave a voice channel
|
|
62
|
+
5. **summarize** - Summarize conversation history
|
|
63
|
+
6. **transcribeMedia** - Transcribe audio/video media to text
|
|
61
64
|
|
|
62
|
-
###
|
|
65
|
+
### Providers
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
// Listen for new messages
|
|
66
|
-
await discordManager.message.handleNewMessage({
|
|
67
|
-
channelId: 'channel-id',
|
|
68
|
-
content: 'Hello Discord!',
|
|
69
|
-
});
|
|
70
|
-
```
|
|
67
|
+
The plugin includes two state providers:
|
|
71
68
|
|
|
72
|
-
|
|
69
|
+
1. **channelStateProvider** - Provides state information about Discord channels
|
|
70
|
+
2. **voiceStateProvider** - Provides state information about voice channels
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
// Join a voice channel
|
|
76
|
-
await discordManager.voice.joinChannel('channel-id');
|
|
72
|
+
### Event Types
|
|
77
73
|
|
|
78
|
-
|
|
79
|
-
await discordManager.voice.handleInteraction({
|
|
80
|
-
userId: 'user-id',
|
|
81
|
-
action: 'speak',
|
|
82
|
-
});
|
|
83
|
-
```
|
|
74
|
+
The plugin emits the following Discord-specific events:
|
|
84
75
|
|
|
85
|
-
|
|
76
|
+
- `GUILD_MEMBER_ADD` - When a new member joins a guild
|
|
77
|
+
- `GUILD_CREATE` - When the bot joins a guild
|
|
78
|
+
- `MESSAGE_CREATE` - When a message is created
|
|
79
|
+
- `INTERACTION_CREATE` - When an interaction is created
|
|
80
|
+
- `REACTION_RECEIVED` - When a reaction is added to a message
|
|
86
81
|
|
|
87
|
-
|
|
82
|
+
## Key Components
|
|
88
83
|
|
|
89
|
-
|
|
90
|
-
-
|
|
84
|
+
1. **DiscordService**
|
|
85
|
+
- Main service class that extends ElizaOS Service
|
|
86
|
+
- Handles authentication and session management
|
|
87
|
+
- Manages Discord client connection
|
|
88
|
+
- Processes events and interactions
|
|
91
89
|
|
|
92
90
|
2. **MessageManager**
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
- Supports message formatting and templating
|
|
91
|
+
- Processes incoming messages and responses
|
|
92
|
+
- Handles attachments and media files
|
|
93
|
+
- Supports message formatting and templating
|
|
94
|
+
- Manages conversation context
|
|
96
95
|
|
|
97
96
|
3. **VoiceManager**
|
|
97
|
+
- Manages voice channel interactions
|
|
98
|
+
- Handles joining and leaving voice channels
|
|
99
|
+
- Processes voice events and audio streams
|
|
100
|
+
- Integrates with transcription services
|
|
101
|
+
|
|
102
|
+
4. **Attachment Handler**
|
|
103
|
+
- Downloads and processes Discord attachments
|
|
104
|
+
- Supports various media types
|
|
105
|
+
- Integrates with media transcription
|
|
98
106
|
|
|
99
|
-
|
|
100
|
-
- Handles joining and leaving voice channels.
|
|
107
|
+
## Testing
|
|
101
108
|
|
|
102
|
-
|
|
103
|
-
- Registers and processes slash commands.
|
|
104
|
-
- Ensures permissions are validated.
|
|
109
|
+
The plugin includes a test suite (`DiscordTestSuite`) for validating functionality.
|
|
105
110
|
|
|
106
111
|
## Notes
|
|
107
112
|
|
|
108
|
-
Ensure that your `.env` file includes the required
|
|
113
|
+
- Ensure that your `.env` file includes the required `DISCORD_API_TOKEN` for proper functionality
|
|
114
|
+
- The bot requires appropriate Discord permissions to function correctly (send messages, connect to voice channels, etc.)
|
|
115
|
+
- If no token is provided, the plugin will load but remain non-functional with appropriate warnings
|
|
116
|
+
- The plugin uses Discord.js v14.18.0 with comprehensive intent support
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-discord",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -55,5 +55,35 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "646c632924826e2b75c2304a75ee56959fe4a460"
|
|
58
|
+
"gitHead": "646c632924826e2b75c2304a75ee56959fe4a460",
|
|
59
|
+
"agentConfig": {
|
|
60
|
+
"pluginType": "elizaos:plugin:1.0.0",
|
|
61
|
+
"pluginParameters": {
|
|
62
|
+
"DISCORD_APPLICATION_ID": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Discord application/client ID used for authenticating the bot with Discord API.",
|
|
65
|
+
"required": true
|
|
66
|
+
},
|
|
67
|
+
"DISCORD_API_TOKEN": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "Discord bot token used to authenticate and connect to Discord API.",
|
|
70
|
+
"required": true
|
|
71
|
+
},
|
|
72
|
+
"CHANNEL_IDS": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "Optional comma-separated list of Discord channel IDs the bot is allowed to operate in; if unset the bot works in all channels.",
|
|
75
|
+
"required": false
|
|
76
|
+
},
|
|
77
|
+
"DISCORD_TEST_CHANNEL_ID": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"description": "Discord channel ID for running tests; used if not supplied in runtime settings.",
|
|
80
|
+
"required": false
|
|
81
|
+
},
|
|
82
|
+
"DISCORD_VOICE_CHANNEL_ID": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"description": "Specifies the Discord voice channel ID that the bot should attempt to join before scanning for other available channels.",
|
|
85
|
+
"required": false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
59
89
|
}
|