Installing Node and your tools
This page is for people who have never set up a JavaScript project before. If you already have Node.js and an editor, skip to Getting Started.
This page is for people who have never set up a JavaScript project before. If you already have Node.js and an editor, skip to Getting Started.
By the end you will have: Node.js installed, a code editor, and an empty project folder ready for a bot.
1. Install Node.js
Node.js is the program that runs JavaScript on your computer (outside a web browser). A Discord bot is a Node.js program.
- Go to nodejs.org and download the LTS ("Long Term Support") version.
- Install it like any other app.
- Athena needs Node 22.15 or newer. Newer is fine.
Check it worked. Open a terminal (on Windows use "PowerShell" or "Windows Terminal", on macOS use "Terminal", on Linux your usual shell) and run:
node --version
npm --versionYou should see two version numbers. node runs your code; npm installs libraries (like Athena).
2. Install a code editor
Visual Studio Code (VS Code) is free and the most common choice. Install it. When you open a .ts file it will understand TypeScript and show you helpful popups, which makes learning Athena much easier.
3. Make a project folder
Pick a folder for your bot and open a terminal inside it. Then:
mkdir my-bot
cd my-bot
npm init -ynpm init -y creates a package.json file. That file is a list of your project's settings and the libraries it depends on. You do not need to understand all of it yet.
4. Install Athena and TypeScript
npm install athena@npm:athena-prime
npm install --save-dev typescript tsx @types/nodeWhat these are:
athena@npm:athena-prime- the Discord library this wiki is about. It is published under the nameathena-prime; this command installs it under the shorter aliasathena, so your code can writeimport { Client } from 'athena'. Copy the command exactly as written.typescript- lets you write TypeScript, a friendlier version of JavaScript that catches mistakes as you type.tsx- runs TypeScript files directly so you do not have to compile first while learning.@types/node- type information for Node's built-in features.
The --save-dev flag means "these are only needed while developing, not when the bot finally runs."
5. Create a TypeScript config
Run:
npx tsc --init --target ES2022 --module CommonJS --strictThis creates tsconfig.json, which tells TypeScript how to understand your code. The defaults from that command are good for a bot.
6. You are ready
Your folder now has package.json, tsconfig.json, and a node_modules folder (the installed libraries). Next:
- If JavaScript is new to you, read JavaScript and TypeScript basics first.
- Otherwise jump straight to Your first bot.
A note on the bot token and Discord setup
You also need a Discord application and a bot token before the bot can log in. That part is covered in Your first bot, step 1.