Skip to content

Commit 972360a

Browse files
committed
Fixed two typos in the cpp file, fixed the issue where bot couldn't be constructed, changed Populate to MakeAvailable to avoid deprecation issues (god I hope this doesn't backfire)
1 parent c6af373 commit 972360a

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,7 @@ else()
6161

6262
FetchContent_GetProperties(libdpp)
6363
if(NOT libdpp_POPULATED)
64-
FetchContent_Populate(libdpp)
65-
target_include_directories(${BOT_NAME} PUBLIC
66-
${libdpp_SOURCE_DIR}/include
67-
)
68-
add_subdirectory(
69-
${libdpp_SOURCE_DIR}
70-
${libdpp_BINARY_DIR}
71-
EXCLUDE_FROM_ALL)
64+
FetchContent_MakeAvailable(libdpp)
7265
endif()
7366

7467
target_link_libraries(${BOT_NAME} dpp)

src/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <templatebot/templatebot.h>
2-
#include <sstream>
32

43
/* When you invite the bot, be sure to invite it with the
54
* scopes 'bot' and 'applications.commands', e.g.
@@ -8,14 +7,15 @@
87

98
using json = nlohmann::json;
109

11-
int main(int argc, char const *argv[])
12-
{
10+
int main(int argc, char const *argv[]) {
1311
json configdocument;
1412
std::ifstream configfile("../config.json");
1513
configfile >> configdocument;
1614

17-
/* Setup the bot */
18-
dpp::cluster bot(configdocument["token"]);
15+
const std::string BOT_TOKEN = configdocument["token"];
16+
17+
/* Set up the bot */
18+
dpp::cluster bot(BOT_TOKEN);
1919

2020
/* Output simple log messages to stdout */
2121
bot.on_log(dpp::utility::cout_logger());
@@ -29,7 +29,7 @@ int main(int argc, char const *argv[])
2929

3030
/* Register slash command here in on_ready */
3131
bot.on_ready([&bot](const dpp::ready_t& event) {
32-
/* Wrap command registration in run_once to make sure it doesnt run on every full reconnection */
32+
/* Wrap command registration in run_once to make sure it doesn't run on every full reconnection */
3333
if (dpp::run_once<struct register_bot_commands>()) {
3434
bot.global_command_create(dpp::slashcommand("ping", "Ping pong!", bot.me.id));
3535
}

0 commit comments

Comments
 (0)