-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
24 lines (21 loc) · 819 Bytes
/
main.cpp
File metadata and controls
24 lines (21 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <dpp/dpp.h>
#include <iostream>
const std::string BOT_TOKEN = "Bot_Token_Here"; // Bot Token
const std::string PREFIX = "!"; // Command Prefix
int main() {
dpp::cluster bot(BOT_TOKEN, dpp::i_all_intents);
bot.on_log(dpp::utility::cout_logger());
bot.on_ready([&bot](const dpp::ready_t& event) {
std::cout << "Bot is online as " << bot.me.username << std::endl;
});
bot.on_message_create([&bot](const dpp::message_create_t& event) {
const std::string& content = event.msg.content;
if (content.rfind(PREFIX, 0) == 0) {
std::string command = content.substr(PREFIX.size());
if (command == "ping") {
bot.message_create(dpp::message(event.msg.channel_id, "Pong!"));
}
}
});
bot.start(dpp::st_wait);
}