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.0a4.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.0a4-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for elizaos_plugin_discord-2.0.0a4.tar.gz
Algorithm Hash digest
SHA256 bbcc5aa46e97648fe9d4cdba8e073049c68cbed3bfcd3075954735167f5f87b2
MD5 c6de87866cb8c843d1f030447ddb2f99
BLAKE2b-256 1b9a3d487ffb5eab12a47d9743b2ee685b5b2507c92c1db2f69c0e45aa12fea8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for elizaos_plugin_discord-2.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 f76036ef20953aa26d83a3793d067a8d7a5afb860d197b324726a79d9e1d6ab9
MD5 cccf945f1e276e537be92c926e0b27e9
BLAKE2b-256 94eb5bd60d627383fc89307389754f1579ca18af0bc82997c59cdf291cb36455

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