• Product Introduction
  • Quick Start
    • Agent Development
    • Importing a Git Repository
    • Starting From a Template
    • Direct Upload
    • Start with AI
  • Framework Guide
    • Agent
    • Frontends
      • Vite
      • React
      • Vue
      • Hugo
      • Other Frameworks
    • Backends
    • Full-stack
      • Next.js
      • Nuxt
      • Astro
      • React Router
      • SvelteKit
      • TanStack Start
      • Vike
    • Custom 404 Page
  • Project Guide
    • Project Management
    • edgeone.json
    • Configuring Cache
    • Building Output Configuration
    • Domain Management
      • Overview
      • Custom Domain
      • HTTPS Configuration
        • Overview
        • Apply for Free Certificate
        • Using Managed SSL Certificate
      • Configure DNS CNAME Record
    • Error Codes
  • Build Guide
  • Deployment Guide
    • Overview
    • Create Deploys
    • Manage Deploys
    • Deploy Button
    • Using Github Actions
    • Using Gitlab CI/CD
    • Using CNB Plugin
    • Using IDE PlugIn
    • Using CodeBuddy IDE
  • Makers for Platforms
    • Platform and Multi-Tenancy
    • Vibe Coding Solution
    • Template Example
      • Vibe Coding General Template
      • Vibe Coding Platform Template
  • Observability
    • Overview
    • Metric Analysis
    • Log Analysis
  • Functions
    • Overview
    • Edge Functions
    • Cloud Functions
      • Overview
      • Node.js
      • Python
      • Go
  • Agents
    • Overview
    • Quick Start
    • Conversation Management
    • Observability
    • Sandbox Tool
      • Overview
      • Using the Agent Framework
      • Sandbox Atomic API
      • Network Search Tool
    • Agent Authentication
  • Models
    • Overview
    • Models and Vendors
      • Overview
      • Using the Zhuque Model
      • Using the Jev Model
      • Using Vendor Keys
        • OpenAI
        • Anthropic
        • Google AI Studio
        • DeepSeek
        • MiniMax
        • Hunyuan
        • Zhipu
        • MoonShot AI
    • FAQs
  • Storage
    • Overview
    • KV
    • Blob
  • Middleware
  • AI-Native Development
    • Skills
    • MCP
    • Plugin
  • Copilot
    • Overview
    • Quick Start
  • API Token
  • EdgeOne CLI
  • Makers SDK
    • Overview
    • Examples
      • Creating a Deployment
      • Deploying via the CLI
      • Project Management
    • Projects
      • Project Operations
      • Environment Variable
    • Deployment
  • Message Notification
  • Integration Guide
    • AI
      • Makers Models Integration
      • Large Models for Images Integration
    • Database
      • Supabase Integration
      • Pages KV Integration
    • Ecommerce
      • Shopify Integration
      • WooCommerce Integration
    • Payment
      • Stripe Integration
      • Integrating Paddle
    • CMS
      • WordPress Integration
      • Contentful Integration
      • Sanity Integration
      • Payload Integration
    • Authentication
      • Supabase Integration
      • Clerk Integration
    • IM
      • Overview
      • WeCom
      • Feishu
      • DingTalk
      • Telegram
      • slack
      • Discord
  • Best Practices
    • Adding an AI Chat Assistant to a Website
    • AI Dialogue Deployment: Deploy Project with One Sentence Using Skill
    • Building Agent Applications Quickly with Makers Agents
    • Building an Ecommerce Platform with Shopify
    • Building a SaaS Site Using Supabase and Stripe
    • Building a Company Brand Site Quickly
    • How to Quickly Build a Blog Site
    • Quick Launch via Login-Free Deployment in WorkBuddy
  • Migration Guides
    • Migrating from Vercel to EdgeOne Makers
    • Migrating from Cloudflare Pages to EdgeOne Makers
    • Migrating from Netlify to EdgeOne Makers
  • Troubleshooting
  • FAQs
  • Limits
  • Pricing
  • Contact Us
  • Release Notes

Discord

This document describes how to create a Discord app, send Slash Commands from a server to Tencent Cloud EdgeOne Makers through HTTP Interactions, and return the result to the current channel after the Agent processes it. After Command testing is complete, you can use the Gateway endpoint included in the template to verify regular messages and @Bot mentions.

Prerequisites and Scope of Application

You must have a Discord account and a test server, along with the Manage Server permission for that server.
You can log in to the Discord Developer Portal to create an app.
Makers has been activated.
Python 3 has been installed locally to register test commands.
This document uses Guild Install to first verify /ask in a regular text channel of the server, without covering user installation, voice, or attachment processing.

Creating an Application and Obtaining Credentials

1. Log in to the Developer Portal, click New Application, enter a name such as Makers Assistant, and complete the creation.
2. Go to General Information and copy the Application ID and Public Key.
3. Go to Bot and generate or reset the Token in the Token section as prompted on the page, then save it securely immediately. Resetting an existing Token invalidates the old Token.
Configuration
Purpose
Sensitive or Not
Application ID
Identify applications and register commands.
No.
Public Key
Verify Ed25519 signatures of HTTP Interactions.
No.
Bot Token
Call Discord APIs and log in to Gateway.
Yes.
For the creation and installation process, refer to the Discord Getting Started documentation. The Bot Token is not the Client Secret, and the Public Key is not the Bot Token.

Configuring Installation Permissions and Adding to the Server

1. Go to Installation and enable Guild Install in Installation Contexts.
2. Set Install Link to Discord Provided Link.
3. In Default Install Settings > Guild Install, choose applications.commands and bot.
4. Configure the following Bot permissions for testing in the regular text channel of this tutorial.
Permissions
Purpose
Range
View Channels
Access test channels.
Required
Send Messages
Send replies.
Required
Read Message History
Used to read messages or locate historical messages
Optional. Add this scope only when the capability is required.
Create Public Threads
Create threads when the current Adapter processes Gateway mentions.
Optional. Required only for Gateway testing.
Send Messages in Threads
Send messages in threads.
Required only for testing thread conversations.
Manage Threads
Delete empty threads generated when the current template processes Gateway mentions.
Optional. Required only for Gateway mention testing.
5. Copy the Install Link, open it in a browser, select Add to server, choose a test server, and complete the authorization.
6. Confirm that the Bot appears in the server member list. In the test channel, check the permission override rules to ensure that viewing or sending messages is not explicitly denied.



In the Guild Install section shown in the figure, select applications.commands and bot. Complete the permissions by adding View Channels and Send Messages as listed in the table above.

Do not grant Administrator. When adding new permissions later, re-authorize using the updated install link, or have an administrator adjust the Bot role and channel permissions. Installing applications.commands does not mean that the /ask command has been created. Step 5 registers the command.

Deploying the Makers Template

2. In the project environment variable settings, fill in the following variables (copy .env.example to .env).
Environment Variable
Required
Description
DISCORD_APPLICATION_ID
Yes
Application ID
DISCORD_PUBLIC_KEY
Yes
Public Key
DISCORD_BOT_TOKEN
Yes
Bot Token
3. Save the configuration and deploy it.
4. Copy the production HTTPS domain name, and append /discord to the end.
5. Note that the service should be deployed in a global AZ so that discord can access it correctly.

Step 4: Save the Interactions Endpoint URL

1. Return to General Information in the Developer Portal.
2. In Interactions Endpoint URL, enter the full URL from step 3 and save the configuration.
3. Confirm that the address is verified successfully. Discord will send a signed PING, and the template will return PONG after the signature is verified using the Public Key.



Registering the /ask Command for the Test Server

1. In the Discord client, go to User Settings > Advanced and enable Developer Mode.
2. Right-click the test server icon, select Copy Server ID, and note the server ID (Guild ID).
3. Run the following command in a local terminal to create and run the registration script. Enter the Application ID from step 1, the test server ID, and the Bot Token. The Token is entered through hidden input and is not written to any file.

cat > register-discord-command.py <<'PY'
import getpass
import json
import urllib.error
import urllib.request

application_id = input('Application ID:').strip()
guild_id = input('Test server ID: ').strip()
bot_token = getpass.getpass('Bot Token (hidden input):').strip()
if not application_id.isdigit() or not guild_id.isdigit():
raise SystemExit('Application ID and server ID must be numeric.')
command = {
'name': 'ask',
'type': 1,
'description': 'Ask Makers Agent a question',
'options': [{
'name': 'question',
'type': 3,
'description': 'Enter your question',
'required': True,
}],
}
url = ('https://discord.com/api/v10/applications/' + application_id
+ '/guilds/' + guild_id + '/commands')
request = urllib.request.Request(
url,
data=json.dumps(command).encode(),
headers={
'Authorization': 'Bot ' + bot_token,
'Content-Type': 'application/json',
'User-Agent': 'Makers-IM-Setup/1.0',
},
method='POST',
)
try:
with urllib.request.urlopen(request, timeout=30) as response:
result = json.load(response)
except urllib.error.HTTPError as error:
raise SystemExit(f'Discord HTTP {error.code}. Check the credentials, installation status, and request parameters.') from None
except urllib.error.URLError:
raise SystemExit('Unable to connect to the Discord API. Check your network.') from None
print('Registered command: /' + result['name'])
print('Command ID: ' + result['id'])
PY
python3 register-discord-command.py

The script calls the API for creating server commands to create or update the /ask command with the same name only on the specified test server, without overwriting other commands in batches. If a command with the same name already exists, use a separate test application first. For API reference, see Application Commands.
The template has registered onSlashCommand, which passes the question parameter text to the Agent, so there is no need to write a separate command handler function.

Sending Commands and Verifying Them

1. Open a text channel on the test server that the Bot has permission to access, and enter /ask.
2. Select the command for the current application from the command list, enter Please introduce Tencent Cloud EdgeOne Makers in one sentence. in the question parameter, and send the command.
3. Confirm that Thinking… appears, and then it is updated with the Agent's final reply.
4. Execute /ask again, enter Please shorten the previous answer to no more than ten words., and confirm the second-round reply.



ai-agent