feat: template now uses coro

This commit is contained in:
Archie Jaskowicz 2023-12-11 19:48:53 +00:00
parent e20b9e94b5
commit 7b421194df
No known key found for this signature in database
GPG Key ID: D5A0D60C95D3B7C9
2 changed files with 29 additions and 9 deletions

View File

@ -253,10 +253,19 @@
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = /opt/homebrew/include;
LIBRARY_SEARCH_PATHS = /opt/homebrew/lib;
HEADER_SEARCH_PATHS = (
/opt/homebrew/include,
/usr/local/include,
);
LIBRARY_SEARCH_PATHS = (
/opt/homebrew/lib,
/usr/local/lib,
);
OTHER_CFLAGS = "";
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"-DDPP_CORO",
);
OTHER_LDFLAGS = "-ldpp";
PRODUCT_NAME = "$(TARGET_NAME)";
};
@ -272,10 +281,19 @@
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = /opt/homebrew/include;
LIBRARY_SEARCH_PATHS = /opt/homebrew/lib;
HEADER_SEARCH_PATHS = (
/opt/homebrew/include,
/usr/local/include,
);
LIBRARY_SEARCH_PATHS = (
/opt/homebrew/lib,
/usr/local/lib,
);
OTHER_CFLAGS = "";
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"-DDPP_CORO",
);
OTHER_LDFLAGS = "-ldpp";
PRODUCT_NAME = "$(TARGET_NAME)";
};

View File

@ -1,5 +1,6 @@
#include <iostream>
#include <dpp/dpp.h>
#include <dpp/json.h>
/* Be sure to place your token in the line below.
* Follow steps here to get a token:
@ -17,11 +18,12 @@ int main() {
/* Output simple log messages to stdout */
bot.on_log(dpp::utility::cout_logger());
/* Handle slash command */
bot.on_slashcommand([](const dpp::slashcommand_t& event) {
/* Handle slash command with the most recent addition to D++ features, coroutines! */
bot.on_slashcommand([](const dpp::slashcommand_t& event) -> dpp::task<void> {
if (event.command.get_command_name() == "ping") {
event.reply("Pong!");
co_await event.co_reply("Pong!");
}
co_return;
});
/* Register slash command here in on_ready */