Skip to main content

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:

Installation

1

Clone or download the repository

Get the Aphonos source code on your local machine or server.
2

Install dependencies

Navigate to the project directory and install the required packages:
npm install
This will install:
  • discord.js (v14.25.1+) - Discord API wrapper
  • canvas - For image generation in fun commands
  • dotenv - Environment variable management
  • TypeScript and related dev dependencies
3

Configure environment variables

Create a .env file in the root directory with your Discord bot token:
.env
DISCORD_TOKEN=your_discord_bot_token_here
Never commit your .env file to version control. Keep your bot token secret!
4

Build the project

Compile the TypeScript code to JavaScript:
npm run build
This command compiles the TypeScript files and copies necessary assets (images for commands) to the dist/ directory.
5

Start the bot

Launch Aphonos with:
npm start
You should see a message confirming the bot is online:
Altershaper bot hath awakened as YourBotName#1234

Development mode

For development with hot-reloading, use:
npm run dev
This skips the compilation step and runs the TypeScript code directly using tsx, making development faster.

Discord Developer Portal setup

1

Create a new application

  1. Go to the Discord Developer Portal
  2. Click “New Application”
  3. Give your bot a name (e.g., “Aphonos”)
2

Create a bot user

  1. Navigate to the “Bot” tab
  2. Click “Add Bot”
  3. Copy your bot token (you’ll need this for the .env file)
3

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
4

Generate invite link

  1. Go to the “OAuth2” → “URL Generator” tab
  2. Select scopes:
    • bot
    • applications.commands
  3. Select permissions (see permissions page for details)
  4. 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:
# The bot will log visible channels and permissions on startup
# Look for output like:
Permissions:
================================
Server: Your Server Name (ID: ...)
  Text: #general (ID: ...) - CAN READ
================================

Troubleshooting

  • 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
  • Make sure you’ve created a .env file 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
  • 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
  • Make sure you have Node.js v16 or higher installed
  • Try deleting node_modules and package-lock.json, then run npm install again
  • Check that all dependencies are properly installed

Next steps

Now that Aphonos is running:
  1. Configure the required permissions
  2. Explore available commands
  3. Set up wiki integration if needed
  4. Customize bot behavior for your server

Package information

Aphonos uses the following key dependencies:
package.json
{
  "name": "altershaper-bot",
  "version": "1.0.0",
  "description": "A Discord moderation bot for ALTER EGO Wiki server",
  "dependencies": {
    "canvas": "^3.2.0",
    "discord.js": "^14.25.1",
    "dotenv": "^17.2.3"
  }
}

Build docs developers (and LLMs) love