Skip to main content

Discord plugin for elizaOS - Python implementation

Project description

elizaOS Discord Plugin (Python)

Python implementation of the Discord plugin for elizaOS agents.

Installation

pip install elizaos-plugin-discord

For voice support:

pip install elizaos-plugin-discord[voice]

Quick Start

import asyncio
from elizaos_plugin_discord import DiscordConfig, DiscordService

async def main():
    # Load config from environment
    config = DiscordConfig.from_env()

    # Create and start the service
    service = DiscordService(config)

    # Set up event handler
    @service.on_message
    async def handle_message(message):
        print(f"Received: {message.content}")

    # Start the bot
    await service.start()

asyncio.run(main())

Configuration

Set the following environment variables:

Variable Required Description
DISCORD_API_TOKEN Yes Bot token from Discord Developer Portal
DISCORD_APPLICATION_ID Yes Application ID from Discord Developer Portal
CHANNEL_IDS No Comma-separated list of channel IDs to monitor
DISCORD_SHOULD_IGNORE_BOT_MESSAGES No Ignore messages from other bots (default: true)
DISCORD_SHOULD_IGNORE_DIRECT_MESSAGES No Ignore DMs (default: false)
DISCORD_SHOULD_RESPOND_ONLY_TO_MENTIONS No Only respond when mentioned (default: false)

Actions

  • send_message - Send a message to a channel
  • send_dm - Send a direct message to a user
  • add_reaction - Add a reaction to a message

Providers

  • channel_state - Current channel information
  • voice_state - Voice channel state
  • guild_info - Server/guild information

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Type checking
mypy elizaos_plugin_discord

# Linting
ruff check elizaos_plugin_discord

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elizaos_plugin_discord-2.0.0a5.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elizaos_plugin_discord-2.0.0a5-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

File details

Details for the file elizaos_plugin_discord-2.0.0a5.tar.gz.

File metadata

  • Download URL: elizaos_plugin_discord-2.0.0a5.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for elizaos_plugin_discord-2.0.0a5.tar.gz
Algorithm Hash digest
SHA256 a482d3cab3fc1be17cfa38384286fd122cf814a142bb2ef99a44a85a4a3d0f39
MD5 1c4a24f9c58cadf24fc84c60667ba633
BLAKE2b-256 e4c460cc754f990034a7f41aed2033e0b5158d3b64f710a89f64b845fea8b726

See more details on using hashes here.

File details

Details for the file elizaos_plugin_discord-2.0.0a5-py3-none-any.whl.

File metadata

File hashes

Hashes for elizaos_plugin_discord-2.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 d3e37610f4b9521b9644d0a3367beda173e0bdb3204d3ed84be06c9cab28f9be
MD5 ff16cc28f95b3183e1e36c027c58915e
BLAKE2b-256 c2f4d9e398c61d50fecf8e20ce1cf2d60ec6896a73e9cb629c678734b0bcf344

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page