A clean Discord.js bot starter with slash commands, event loading, and room to add more features.
- Slash command loader
- Guild command deployment for fast testing
- Utility commands:
/ping,/server,/user - Fun command:
/coinflip - Moderation commands:
/ban,/kick,/timeout,/warn,/purge - Welcome messages
- Counting game with Sudden Death, goals, and No Double Count
- Ticket system with support roles and close buttons
- 24/7 music streaming
- Railway-friendly web panel
- Environment-based secrets
-
Install dependencies:
npm install
-
Copy
.env.exampleto.envand fill in:DISCORD_TOKEN: your bot tokenDISCORD_CLIENT_ID: your Discord application client IDDISCORD_GUILD_ID: your test server IDPANEL_KEY: a private password for the web panelPUBLIC_URL: your Railway public URL, once Railway gives you one
-
Deploy slash commands:
npm run deploy:commands
-
Start the bot:
npm start
- Create an application at https://discord.com/developers/applications
- Add a bot user
- Enable the bot token and copy it into
.env - Invite the bot with the
botandapplications.commandsscopes - Give it permissions for moderation, tickets, messages, and voice
- Enable the Server Members intent
- Enable the Message Content intent for the counting game
-
Push this project to GitHub.
-
Create a new Railway project from the GitHub repo.
-
Add these Railway variables:
DISCORD_TOKEN=your_bot_token DISCORD_CLIENT_ID=your_application_client_id DISCORD_GUILD_ID=your_test_server_id PANEL_KEY=a_long_private_password PUBLIC_URL=https://your-railway-url.up.railway.app -
Railway will install dependencies and run
npm start. -
Open the Railway public URL and enter your
PANEL_KEY.
Railway's filesystem can reset between deploys. For a production bot, move data/store.json to a database such as PostgreSQL or MongoDB. The JSON store is perfect for getting the bot built and tested quickly.
/ban target reason/kick target reason/timeout target duration reason/warn add target reason/warn list target/warn clear target/purge amount
/welcome setup channel message/welcome test/welcome disable
/counting setup channel goal sudden-death no-double-count/counting status/counting reset/counting disable
/ticket setup panel-channel support-role category transcript-channel/ticket status/ticket close
/music24 setup voice-channel stream-url text-channel/music24 start/music24 stop/music24 status
src/
commands/
config/
fun/
music/
moderation/
tickets/
utility/
events/
services/
web/
deploy-commands.js
index.js
Add a new command by creating a .js file under src/commands/<category>/ that exports data and execute.