Crypto.com AI Agent SDK
  • Getting Started
    • Introduction
    • Quick Start Guide: Simulation Entry Point
  • Core Concepts Overview
    • Plugins
      • Messaging Platform Plugins
        • Telegram Plugin
        • Discord Plugin
    • Tools
    • Blockchain Functions
      • Wallet Management
      • Token Interaction
      • Transaction Queries
      • Block Information
      • Contract Operations
      • CronosID Operations
      • Defi Operations
      • Crypto.com Exchange
    • Advanced Usage: Custom Instructions
    • Dynamic AI Model Manager
  • Crypto.com On-Chain Developer Platform
    • Developer Platform API Methods
  • On-Chain Functions and Examples
    • AI Agent Chatbot
    • "Magic Link" Signer
  • Resources for Developers
Powered by GitBook
On this page
  • Introduction
  • Prerequisites
  • Get a Discord Bot Token
  • Invite the Bot to Your Server
  • Discord Plugin
  • Run everything
  • Troubleshooting

Was this helpful?

  1. Core Concepts Overview
  2. Plugins
  3. Messaging Platform Plugins

Discord Plugin

PreviousTelegram PluginNextTools

Last updated 2 days ago

Was this helpful?

Introduction

Crypto.com AI Agent SDK Discord plugin allows users to create interactive blockchain experiences within Discord communities. By setting up a custom bot, users can interact with the Cronos network using natural language to access wallet data, track transactions, and execute commands directly in server channels.

This guide provides step-by-step instructions to get your Discord bot up and running in no time.

A video demo is available in .

Prerequisites

  • Python installed (version >= 3.12)

Get a Discord Bot Token

  1. Click on "New Application", enter a name for your bot (e.g., CryptoHelper), and click "Create".

  2. In the left sidebar, select "Bot", then click "Add Bot" and confirm by clicking "Yes, do it!"

  3. Under the "Token" section, click "Click to Reveal Token" to view your bot's token.

  4. Copy and securely store this token (e.g., MTM3Mjc0MjI3MzUzNTcwNTE5MA.GHuA_M.dSXMKfwfXxd1kWZ8fBPLvB7EwuWcM6StENS43g). Never share this token publicly, as it grants control over your bot

Invite the Bot to Your Server

  1. In the Developer Portal, navigate to the "OAuth2" section and select "URL Generator".

  2. Under "Scopes", check the boxes for "bot" and "applications.commands".

  3. Under "Bot Permissions", select the permissions your bot needs (e.g., "Send Messages", "Read Message History").

  4. Copy the generated URL at the bottom of the page.

  5. Paste the URL into your browser, select the server you want to add the bot to, and click "Continue".

  6. Review the permissions and click "Authorize".

  7. Complete any CAPTCHA verification if prompted.

Discord Plugin

Add Discord plugin when initializing the Agent:

import os
from crypto_com_agent_client import Agent
from dotenv import load_dotenv

load_dotenv()

# Initialize the agent with LLM and blockchain configurations
# Current chainID refers to Cronos zkEVM Testnet, optionally change it to other Cronos networks
agent = Agent.init(
   llm_config={
       "provider": "OpenAI",
       "model": "gpt-4o-mini",
       "provider-api-key": os.getenv("OPENAI_API_KEY"),
       "temperature": "float-controlling-output-randomness",
   },
   blockchain_config={
       "chainId": "240", 
       "explorer-api-key": os.getenv("EXPLORER_API_KEY"),
       "private-key": os.getenv("PRIVATE_KEY"),
       "sso-wallet-url": "your-sso-wallet-url",
   },
   plugins={
       "instructions": "You are a humorous assistant that always includes a joke in your responses.",
       "discord": {"bot_token": os.getenv("DISCORD_BOT_TOKEN")},
   },
)

agent.start_discord()
import os
from crypto_com_agent_client import Agent
from dotenv import load_dotenv
​
load_dotenv()
​
# Initialize the agent with LLM and blockchain configurations
# Current chainID refers to Cronos zkEVM Testnet, optionally change it to other Cronos networks
agent = Agent.init(
  llm_config={
      "provider": "GoogleGenAI",
      "model": "gemini-2.0-flash",
      "provider-api-key": os.getenv("GEMINI_API_KEY"),
      "temperature": "float-controlling-output-randomness",
  },
  blockchain_config={
      "chainId": "240",
      "explorer-api-key": os.getenv("EXPLORER_API_KEY"),
      "private-key": os.getenv("PRIVATE_KEY"),
      "sso-wallet-url": "your-sso-wallet-url",
  },
  plugins={
      "instructions": "You are a humorous assistant that always includes a joke in your responses.",
      "discord": {"bot_token": os.getenv("DISCORD_BOT_TOKEN")},
   },
)

agent.start_discord()

Run everything

As shown in the example code, we start the Discord bot by invoking the Agent's built-in function:

agent.start_discord()

Once the bot is running, test it to ensure it’s working as expected:

  • Ensure your bot is running and connected to Discord.

  • Open Discord and navigate to the server where you've added your bot.

  • Interact with the bot and observe if it responds appropriately to confirm it's functioning correctly.

Troubleshooting

If you encounter issues during setup or execution, follow these tips:

  • Check your API keys to ensure they are correctly set in the environment variables.

  • Review Discord Bot API limitations to ensure compliance with rate limits and usage guidelines.

installed.

API Key for or

API Keys of AI provider, refer to the to see which providers are supported by the AI Agent SDK.

Required account: .

Open your browser and navigate to the .

Crypto.com AI Agent SDK
Cronos EVM Blockchain Explorer
Cronos zkEVM Blockchain Explorer
Dynamic AI Model Manager
Discord Bot Token
Discord Developer Portal
Crypto.com AI Agent SDK X post