Skip to content

Upgraded beginner command, tested - #39

Open
Gag91 wants to merge 3 commits into
cppdiscord:mainfrom
Gag91:main
Open

Upgraded beginner command, tested#39
Gag91 wants to merge 3 commits into
cppdiscord:mainfrom
Gag91:main

Conversation

@Gag91

@Gag91 Gag91 commented Aug 11, 2026

Copy link
Copy Markdown

Modifed

beginner.cpp

From

#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>.\nBe 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);
}

To

#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)
        .set_title("👋 New to C++? Start here!")
        .set_url("https://www.learncpp.com/")
        .set_description("Essential resources for C++ beginners")
        .add_field("📘 **Best Beginner Tutorial**", 
            "LearnCpp.com is widely considered the best free resource:\nhttps://www.learncpp.com/", false)
        .add_field("📖 **CPP Reference**", 
            "The definitive C++ language reference:\nhttps://en.cppreference.com/", false)
        .add_field("🛠️ **Practice**", 
            "Start with small projects:\n"
            "- Calculator\n"
            "- Guess game\n"
            "- Dice game", false)
        .add_field("✅ **Do this**", 
            "- Learn Modern C++\n"
            "- Use a great IDE\n"
            "- Practice what you learn\n"
            "- Learn OOP basics\n"
            "- Write clean, readable code", true)
        .add_field("❌ **Dont do this**", 
            "- Don't learn from outdated C++ resources\n"
            "- Don't let AI write code for you\n"
            "- Don't use `using namespace std;` (it's bad practice)\n"
            "- Don't ignore compiler warnings", true)
        .set_footer(dpp::embed_footer()
            .set_text("Need help? Ask in <#" + std::to_string(globals::channels::HELP_CHANNEL_ID) + ">"))
        .set_timestamp(dpp::utility::time_f());

    dpp::message message(event.command.channel_id, embed);
    message.add_component(
        dpp::component()
            .add_component(
                dpp::component()
                    .set_type(dpp::cot_button)
                    .set_label("Learn C++")
                    .set_url("https://www.learncpp.com/")
                    .set_style(dpp::cos_link)
            )
            .add_component(
                dpp::component()
                    .set_type(dpp::cot_button)
                    .set_label("CPP Reference")
                    .set_url("https://en.cppreference.com/")
                    .set_style(dpp::cos_link)
            )
    );
    event.reply(message);
}

commands.h

From

std::list<dpp::command_option> args;

To

std::vector<dpp::command_option> args;

Added

globals.h

    namespace channels 
    {
        constexpr dpp::snowflake HELP_CHANNEL_ID = 1130466207431135394ULL;
    }

@transicle

transicle commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Changing std::list to std::vector may have unintended consequences, did you validate your code actually works in all scenarios?

@xNoerPlaysCodes

Copy link
Copy Markdown
Contributor

Changing std::vector to std::list may have unintended consequences, did you validate your code actually works in all scenarios?

They use it like a vector; the original authors did not know that a list is actually a linked list. I also changed std::list to std::vector in main.cpp for my first PR and everything worked the same.

@Gag91

Gag91 commented Aug 13, 2026

Copy link
Copy Markdown
Author

Edit: everything was tested and everything works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants