I just have a general question.
I'm trying to create a discord bot that responds to slash commands and the book title within the Harry Potter series (e.g /Prince of Azkaban) and it will generate a random quote from the book to the channel (it would be nice to have it display a random image from the movie scene it derived the quote from ...but.... that seems too complicated lol).
I've set up the default discord bot that is within the set-up articles (/ping and get ping pong!--------that is embedded down below) but I actually have no idea where to start.
Should I be starting with creating the random generator and then later on finding out how to link it so random quotes can be chosen (i.e a text doc?) or should I figure out where/how I am going to get the book quotes?
Any help is appreciated on how to start!
`
#include "MyBot.h"
#include <dpp/dpp.h>
/* Be sure to place your token in the line below.
* Follow steps here to get a token:
* https://dpp.dev/creating-a-bot-application.html
* When you invite the bot, be sure to invite it with the
* scopes 'bot' and 'applications.commands', e.g.
* https://discord.com/oauth2/authorize?client_id=940762342495518720&scope=bot+applications.commands&permissions=139586816064
*/
const std::string BOT_TOKEN = "MY TOKEN";
int main()
{
/* Create bot cluster */
dpp::cluster bot(BOT_TOKEN);
/* Output simple log messages to stdout */
bot.on_log(dpp::utility::cout_logger());
/* Handle slash command */
bot.on_slashcommand([](const dpp::slashcommand_t& event) {
if (event.command.get_command_name() == "ping") {
event.reply("Pong!");
}
});
/* Register slash command here in on_ready */
bot.on_ready([&bot](const dpp::ready_t& event) {
/* Wrap command registration in run_once to make sure it doesnt run on every full reconnection */
if (dpp::run_once<struct register_bot_commands>()) {
bot.global_command_create(dpp::slashcommand("ping", "Ping pong!", bot.me.id));
}
});
}
`
Aucun commentaire:
Enregistrer un commentaire