Skip to main content

Required Environment Variables

Aphonos requires a .env file in the root directory with the following configuration:

DISCORD_TOKEN

The Discord bot token is the only required environment variable for Aphonos to function.
DISCORD_TOKEN=your_discord_bot_token_here
The bot will immediately exit with an error if DISCORD_TOKEN is not found in environment variables. This is validated in src/index.ts:173-176.

Getting Your Discord Token

  1. Go to the Discord Developer Portal
  2. Select your application or create a new one
  3. Navigate to the Bot section
  4. Copy the token under TOKEN
  5. If you don’t see a token, click Reset Token to generate a new one
Never commit your .env file to version control. Keep your Discord token secret and regenerate it immediately if it’s ever exposed.

Setup Steps

1. Install Dependencies

npm install

2. Create Environment File

Create a .env file in the project root:
echo "DISCORD_TOKEN=your_token_here" > .env

3. Build the Bot

npm run build
This compiles TypeScript and copies required image assets (webhook.png, ship.png, ship2.png, deathbattle.png, deathbattle2.png, deathbattle3.png, russian.png) to the dist folder.

4. Start the Bot

npm start

NPM Scripts

Aphonos includes several npm scripts for different use cases:
ScriptCommandDescription
buildnpm run buildCompiles TypeScript and copies image assets to dist/
startnpm startRuns the compiled bot from dist/index.js
devnpm run devRuns the bot in development mode with tsx (no build required)
watchnpm run watchWatches for TypeScript changes and recompiles automatically
formatnpm run formatFormats code with Prettier

Discord Bot Intents

Aphonos requires the following Gateway Intents (configured in src/index.ts:34-41):
  • Guilds - Access to guild information
  • GuildMessages - Receive message events
  • MessageContent - Read message content (privileged intent)
  • GuildMembers - Access member join/leave events (privileged intent)
  • GuildModeration - Access moderation events
  • GuildMessageReactions - Reaction role functionality
MessageContent and GuildMembers are privileged intents. Enable them in the Discord Developer Portal under Bot > Privileged Gateway Intents.

Validation

When the bot starts successfully, you should see:
Altershaper bot hath awakened as YourBotName#1234
Registering divine slash commands...
Divine slash commands registered successfully!
Console command handler ready. Type "help" for options.
If the token is missing or invalid:
❌ Discord token not found in environment variables
or
❌ Failed to login: [error details]

Build docs developers (and LLMs) love