Getting started

For developers comfortable with Node and TypeScript. If you are new, start with Your first bot instead.

For developers comfortable with Node and TypeScript. If you are new, start with Your first bot instead.

Install

npm install athena@npm:athena-prime

Compression and the WebSocket transport are built in; run npm install ws only if you need proxy agents or custom headers via options.ws.

Athena is published as athena-prime; installing it under the alias athena keeps every import as from 'athena'. (A plain npm install athena resolves the frozen legacy 2.8.0 package.)

Athena 3.0 targets Node 22.15+. Types come from discord-api-types/v10 and are re-exported, so you rarely import that package directly.

Two ways to build

Plain Client gives you the gateway, REST helpers, and the cache. You wire events yourself.

import { Client, GatewayIntentBits } from 'athena';
 
const client = new Client(`Bot ${process.env.DISCORD_TOKEN}`, {
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});
 
client.on('ready', () => console.log(`Up as ${client.user.username}`));
client.on('messageCreate', (m) => {
  if (m.content === '!ping') void client.createMessage(m.channel.id, 'Pong!');
});
client.on('error', console.error);
 
void client.connect();

CommandClient extends Client and adds slash command registration, deployment, dispatch, cooldowns, and middleware. Most bots want this. See Commands framework.

The token

The first argument is the token and it must include the Bot prefix. Athena uses the prefix to detect a bot account.

new Client(`Bot ${process.env.DISCORD_TOKEN}`, options);

Connecting and readiness

connect() opens the gateway. The ready event fires once after every shard has finished its initial GUILD_CREATE burst. Do startup work (such as deploying commands) in ready.

Always handle error

Athena extends an EventEmitter. An unhandled error event throws. Attach a listener even if you only log it.

Where next