← All Templates

Discord Bot

JavaScriptIntermediateBots

Discord bot with slash commands, event handlers, and embedded messages. Uses discord.js v14.

Features

Code Preview

import { Client, GatewayIntentBits } from 'discord.js';

const client = new Client({
  intents: [GatewayIntentBits.Guilds]
});

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}`);
});

client.on('interactionCreate', async (i) => {
  if (i.commandName === 'ping')
    await i.reply('Pong!');
});

client.login(process.env.TOKEN);
Open in RoadCode

Related Templates

Slack Bot
JavaScript · Intermediate