forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix-plugin-thirdweb
- Loading branch information
Showing
93 changed files
with
4,533 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ | |
"@0glabs/0g-ts-sdk": "0.2.1", | ||
"@coinbase/coinbase-sdk": "0.10.0", | ||
"@deepgram/sdk": "^3.9.0", | ||
"@okxweb3/coin-bitcoin": "1.2.0", | ||
"@okxweb3/crypto-lib": "1.0.10", | ||
"@injectivelabs/sdk-ts": "^1.14.33", | ||
"@vitest/eslint-plugin": "1.0.1", | ||
"amqplib": "0.10.5", | ||
|
@@ -74,7 +76,9 @@ | |
"pnpm": "9.14.4", | ||
"sharp": "0.33.5", | ||
"tslog": "4.9.3", | ||
"bs58": "4.0.0" | ||
"bs58": "4.0.0", | ||
"tiny-secp256k1": "2.2.3", | ||
"tslog": "4.9.3" | ||
}, | ||
"packageManager": "[email protected]+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee", | ||
"workspaces": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# @elizaos/client-discord | ||
|
||
A Discord client implementation for ElizaOS, enabling rich integration with Discord servers for managing interactions, voice, and message handling. | ||
|
||
## Features | ||
|
||
- Handle server join events and manage initial configurations. | ||
- Voice event management via the voice manager. | ||
- Manage and process new messages with the message manager. | ||
- Slash command registration and interaction handling. | ||
- Disconnect websocket and unbind all listeners when required. | ||
- Robust permissions management for bot functionality. | ||
|
||
## Installation | ||
|
||
As this is a workspace package, it's installed as part of the ElizaOS monorepo: | ||
|
||
```bash | ||
pnpm install | ||
``` | ||
|
||
## Configuration | ||
|
||
The client requires the following environment variables: | ||
|
||
```bash | ||
# Discord API Credentials | ||
DISCORD_APPLICATION_ID=your_application_id | ||
DISCORD_API_TOKEN=your_api_token | ||
|
||
# Optional Settings (add any additional details here if necessary) | ||
``` | ||
|
||
## Usage | ||
|
||
### Basic Initialization | ||
|
||
```typescript | ||
import { DiscordClientInterface } from '@elizaos/client-discord'; | ||
|
||
// Initialize the client | ||
const discordManager = await DiscordClientInterface.start(runtime); | ||
``` | ||
|
||
### Slash Command Registration | ||
|
||
To register slash commands: | ||
|
||
```typescript | ||
await discordManager.command.registerCommands([ | ||
{ | ||
name: 'example', | ||
description: 'An example slash command', | ||
options: [] | ||
} | ||
]); | ||
``` | ||
|
||
### Handling Messages | ||
|
||
```typescript | ||
// Listen for new messages | ||
await discordManager.message.handleNewMessage({ | ||
channelId: 'channel-id', | ||
content: 'Hello Discord!' | ||
}); | ||
``` | ||
|
||
### Managing Voice Events | ||
|
||
```typescript | ||
// Join a voice channel | ||
await discordManager.voice.joinChannel('channel-id'); | ||
|
||
// Handle voice interactions | ||
await discordManager.voice.handleInteraction({ | ||
userId: 'user-id', | ||
action: 'speak' | ||
}); | ||
``` | ||
|
||
## Key Components | ||
|
||
1. **ClientBase** | ||
- Handles authentication and session management. | ||
- Manages websocket connections. | ||
|
||
2. **MessageManager** | ||
- Processes incoming messages and responses. | ||
- Supports message formatting and templating. | ||
|
||
3. **VoiceManager** | ||
- Manages voice interactions and events. | ||
- Handles joining and leaving voice channels. | ||
|
||
4. **CommandManager** | ||
- Registers and processes slash commands. | ||
- Ensures permissions are validated. | ||
|
||
## Notes | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.