@elizaos/plugin-discord 1.0.6 → 1.0.8

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 (2) hide show
  1. package/README.md +64 -56
  2. package/package.json +6 -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
- - Disconnect websocket and unbind all listeners when required.
12
- - Robust permissions management for bot functionality.
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
- ### Basic Initialization
40
-
41
- ```typescript
42
- import { DiscordClientInterface } from '@elizaos/client-discord';
43
-
44
- // Initialize the client
45
- const discordManager = await DiscordClientInterface.start(runtime);
45
+ ```json
46
+ const character = {
47
+ "plugins": [
48
+ ...otherPlugins,
49
+ "@elizaos/plugin-discord"
50
+ ]
51
+ }
46
52
  ```
47
53
 
48
- ### Slash Command Registration
54
+ ### Available Actions
49
55
 
50
- To register slash commands:
56
+ The plugin provides the following actions:
51
57
 
52
- ```typescript
53
- await discordManager.command.registerCommands([
54
- {
55
- name: 'example',
56
- description: 'An example slash command',
57
- options: [],
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
- ### Handling Messages
65
+ ### Providers
63
66
 
64
- ```typescript
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
- ### Managing Voice Events
69
+ 1. **channelStateProvider** - Provides state information about Discord channels
70
+ 2. **voiceStateProvider** - Provides state information about voice channels
73
71
 
74
- ```typescript
75
- // Join a voice channel
76
- await discordManager.voice.joinChannel('channel-id');
72
+ ### Event Types
77
73
 
78
- // Handle voice interactions
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
- ## Key Components
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
- 1. **ClientBase**
82
+ ## Key Components
88
83
 
89
- - Handles authentication and session management.
90
- - Manages websocket connections.
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
- - Processes incoming messages and responses.
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
- - Manages voice interactions and events.
100
- - Handles joining and leaving voice channels.
107
+ ## Testing
101
108
 
102
- 4. **CommandManager**
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 environment variables for proper functionality. Additional features or modules can be extended as part of the ElizaOS framework.
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.6",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -55,5 +55,9 @@
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
+ }
59
63
  }