feat: template now uses coro
This commit is contained in:
parent
e20b9e94b5
commit
7b421194df
@ -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)";
|
||||
};
|
||||
|
||||
@ -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 */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user