\page firstbot Creating Your First Bot In this example we will create a C++ version of the [discord.js](https://discord.js.org/#/) example program. The two programs can be seen side by side below:
D++ | Discord.js |
---|---|
~~~~~~~~~~~~~~~{.cpp}
#include |
~~~~~~~~~~~~~~~{.cpp} let Discord = require('discord.js'); let BOT_TOKEN = 'add your token here'; let bot = new Discord.Client({ intents: [] }); bot.on('interactionCreate', (interaction) => { if (interaction.isCommand() && interaction.commandName === 'ping') { interaction.reply({content: 'Pong!'}); } }); bot.once('ready', async () => { await client.commands.create({ name: 'ping', description: "Ping pong!" }); }); bot.login(BOT_TOKEN); ~~~~~~~~~~~~~~~ |