Merge pull request #1 from Jaskowicz1/coro-template
This commit is contained in:
commit
150ea1587b
@ -253,10 +253,19 @@
|
|||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = "";
|
FRAMEWORK_SEARCH_PATHS = "";
|
||||||
HEADER_SEARCH_PATHS = /opt/homebrew/include;
|
HEADER_SEARCH_PATHS = (
|
||||||
LIBRARY_SEARCH_PATHS = /opt/homebrew/lib;
|
/opt/homebrew/include,
|
||||||
|
/usr/local/include,
|
||||||
|
);
|
||||||
|
LIBRARY_SEARCH_PATHS = (
|
||||||
|
/opt/homebrew/lib,
|
||||||
|
/usr/local/lib,
|
||||||
|
);
|
||||||
OTHER_CFLAGS = "";
|
OTHER_CFLAGS = "";
|
||||||
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
|
OTHER_CPLUSPLUSFLAGS = (
|
||||||
|
"$(OTHER_CFLAGS)",
|
||||||
|
"-DDPP_CORO",
|
||||||
|
);
|
||||||
OTHER_LDFLAGS = "-ldpp";
|
OTHER_LDFLAGS = "-ldpp";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
};
|
};
|
||||||
@ -272,10 +281,19 @@
|
|||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = "";
|
FRAMEWORK_SEARCH_PATHS = "";
|
||||||
HEADER_SEARCH_PATHS = /opt/homebrew/include;
|
HEADER_SEARCH_PATHS = (
|
||||||
LIBRARY_SEARCH_PATHS = /opt/homebrew/lib;
|
/opt/homebrew/include,
|
||||||
|
/usr/local/include,
|
||||||
|
);
|
||||||
|
LIBRARY_SEARCH_PATHS = (
|
||||||
|
/opt/homebrew/lib,
|
||||||
|
/usr/local/lib,
|
||||||
|
);
|
||||||
OTHER_CFLAGS = "";
|
OTHER_CFLAGS = "";
|
||||||
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
|
OTHER_CPLUSPLUSFLAGS = (
|
||||||
|
"$(OTHER_CFLAGS)",
|
||||||
|
"-DDPP_CORO",
|
||||||
|
);
|
||||||
OTHER_LDFLAGS = "-ldpp";
|
OTHER_LDFLAGS = "-ldpp";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
};
|
};
|
||||||
|
|||||||
@ -17,11 +17,12 @@ int main() {
|
|||||||
/* Output simple log messages to stdout */
|
/* Output simple log messages to stdout */
|
||||||
bot.on_log(dpp::utility::cout_logger());
|
bot.on_log(dpp::utility::cout_logger());
|
||||||
|
|
||||||
/* Handle slash command */
|
/* Handle slash command with the most recent addition to D++ features, coroutines! */
|
||||||
bot.on_slashcommand([](const dpp::slashcommand_t& event) {
|
bot.on_slashcommand([](const dpp::slashcommand_t& event) -> dpp::task<void> {
|
||||||
if (event.command.get_command_name() == "ping") {
|
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 */
|
/* Register slash command here in on_ready */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user