New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@elizaos/client-discord

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elizaos/client-discord

  • 0.25.6-alpha.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

@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:

pnpm install

Configuration

The client requires the following environment variables:

# 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

import { DiscordClientInterface } from '@elizaos/client-discord';

// Initialize the client
const discordManager = await DiscordClientInterface.start(runtime);

Slash Command Registration

To register slash commands:

await discordManager.command.registerCommands([
  {
    name: 'example',
    description: 'An example slash command',
    options: []
  }
]);

Handling Messages

// Listen for new messages
await discordManager.message.handleNewMessage({
  channelId: 'channel-id',
  content: 'Hello Discord!'
});

Managing Voice Events

// 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.

FAQs

Package last updated on 06 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc