Setup
Get Aphonos up and running in your Discord server with this step-by-step guide.Prerequisites
Before you begin, ensure you have the following installed:- Node.js (v16 or higher recommended)
- npm (comes with Node.js)
- A Discord bot token from the Discord Developer Portal
Installation
Install dependencies
Navigate to the project directory and install the required packages:This will install:
discord.js(v14.25.1+) - Discord API wrappercanvas- For image generation in fun commandsdotenv- Environment variable management- TypeScript and related dev dependencies
Configure environment variables
Create a
.env file in the root directory with your Discord bot token:.env
Build the project
Compile the TypeScript code to JavaScript:This command compiles the TypeScript files and copies necessary assets (images for commands) to the
dist/ directory.Development mode
For development with hot-reloading, use:tsx, making development faster.
Discord Developer Portal setup
Create a new application
- Go to the Discord Developer Portal
- Click “New Application”
- Give your bot a name (e.g., “Aphonos”)
Create a bot user
- Navigate to the “Bot” tab
- Click “Add Bot”
- Copy your bot token (you’ll need this for the
.envfile)
Configure bot settings
Enable the following Privileged Gateway Intents:
- Server Members Intent - Required for member join events and member management
- Message Content Intent - Required for reading message content
Generate invite link
- Go to the “OAuth2” → “URL Generator” tab
- Select scopes:
botapplications.commands
- Select permissions (see permissions page for details)
- Copy the generated URL and use it to invite the bot to your server
Verifying the installation
Once the bot is running, you can verify it’s working correctly:Troubleshooting
Bot is not responding to commands
Bot is not responding to commands
- Ensure the bot is online and shows as active in your server
- Check that you’ve enabled the required Privileged Gateway Intents
- Verify the bot has the necessary permissions in your server
- Check the console for any error messages
DISCORD_TOKEN not found error
DISCORD_TOKEN not found error
- Make sure you’ve created a
.envfile in the root directory - Verify the file is named exactly
.env(not.env.txt) - Confirm the token is on a line that starts with
DISCORD_TOKEN= - Ensure there are no extra spaces or quotes around the token
Permission errors when using commands
Permission errors when using commands
- Review the permissions page for required permissions
- Ensure the bot’s role is positioned high enough in the role hierarchy
- Check channel-specific permission overrides
Build errors
Build errors
- Make sure you have Node.js v16 or higher installed
- Try deleting
node_modulesandpackage-lock.json, then runnpm installagain - Check that all dependencies are properly installed
Next steps
Now that Aphonos is running:- Configure the required permissions
- Explore available commands
- Set up wiki integration if needed
- Customize bot behavior for your server
Package information
Aphonos uses the following key dependencies:package.json