1. Discord Bot Registration and Setup
The first step in Discord bot development is registering your bot on the official Discord Developer Portal (Discord Developer Portal).
1.1. Creating a New Application
Log in to the Developer Portal, click 'New Application', and name your app. This application serves as the foundation for your bot.
1.2. Issuing Bot Token and Setting Intents
Navigate to the 'Bot' tab in your created application. Click 'Add Bot'. The bot token is visible only once, so you must copy and store it securely.
# The token must NEVER be exposed externally.
const TOKEN = "YOUR_SECRET_BOT_TOKEN_HERE";
Setting Intents: Starting with Discord API v6, the bot must have specific Gateway Intents enabled to receive certain types of events (e.g., reading message content). You need to enable 'MESSAGE CONTENT INTENT' and others as required.