diff --git a/CMakeLists.txt b/CMakeLists.txt index ed8472d..35dbed9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ add_executable(bot src/commands/code_cmd.cpp src/commands/project_cmd.cpp src/commands/rule_cmd.cpp + src/commands/beginner.cpp # utils src/utils/suggestion/suggestion.cpp diff --git a/src/commands/beginner.cpp b/src/commands/beginner.cpp new file mode 100644 index 0000000..cf073f2 --- /dev/null +++ b/src/commands/beginner.cpp @@ -0,0 +1,12 @@ +#include "commands.h" +#include "../globals/globals.h" + +void cmd::beginnerCommand(dpp::cluster& bot, const dpp::slashcommand_t& event) +{ + const dpp::embed embed = dpp::embed() + .set_color(globals::color::defaultColor) + .add_field("šŸ‘‹ New to C++? Start here!", "If you're learning C++, we recommend these resources:\n\nšŸ“˜ **Learn C++ (Best beginner tutorial)**\n- https://www.learncpp.com/\n\nšŸ“– **CPP Reference (Language & Standard library reference)**\n- https://en.cppreference.com/\n\nšŸ› ļø **Practice**\n1. Build small projects\n2. Read and write lots of code\n\n**Common advice:**\n* āœ… Learn modern C++, not C with classes\n* āœ… Avoid outdated books, videos, and random blog posts that teach old C++ practices\n* āŒ Don't ask ChatGPT or other AI to write your code\n\nIf you're stuck on something specific, ask in the help channels: <#1130494190615265342>\n* Be sure to include your code, any error messages, what you've tried already, and what you expected to happen."); + + const dpp::message message(event.command.channel_id, embed); + event.reply(message); +} diff --git a/src/commands/commands.h b/src/commands/commands.h index 0d13298..edfc965 100644 --- a/src/commands/commands.h +++ b/src/commands/commands.h @@ -63,6 +63,13 @@ namespace cmd * @param event slash command event */ void ruleCommand(dpp::cluster& bot, const dpp::slashcommand_t& event); + + /** + * @brief Replies with a beginner's guide to C++ + * @param bot cluster + * @param event slash command event + */ + void beginnerCommand(dpp::cluster& bot, const dpp::slashcommand_t& event); namespace utils { diff --git a/src/main.cpp b/src/main.cpp index c06f872..c1bacad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,6 +12,7 @@ using json = nlohmann::json; std::vector cmdList = { { "topic", "Get a topic question", cmd::topicCommand }, + { "beginner", "Get a beginner's guide to C++", cmd::beginnerCommand }, { "coding", "Get a coding question", cmd::codingCommand }, { "close", "Close a ticket or forum post", cmd::closeCommand }, { "ticket", "Open a ticket", cmd::ticketCommand, { dpp::command_option(dpp::command_option_type::co_user, "participant", "Add participant", false) }},