Skip to content

fix: resolve build issues and update gitignore#11

Closed
ghost wants to merge 4 commits into
mainfrom
unknown repository
Closed

fix: resolve build issues and update gitignore#11
ghost wants to merge 4 commits into
mainfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Dec 15, 2024

WIP

What's new in this branch?:

  • Webhook feature
  • fixed build errors
  • (hopefully detailed docs soon)
  • tests (googletest)

@null8626 null8626 self-requested a review December 15, 2024 07:03
Copy link
Copy Markdown
Member

@null8626 null8626 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hai! There are sadly still many issues I have with this pull request. Most of which are docstrings related, others are code that still needs more polishing or consistency. Thanks buffer!

Comment thread CMakeLists.txt

set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type")
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(ENABLE_CORO "Support for C++20 coroutines" OFF)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove ENABLE_CORO?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option lets users of this library choose whether to utilize C++20 coroutines or not (done through callbacks, but compatible with C++17).

Comment thread cmake/FindDPP.cmake
@@ -1,15 +1,41 @@
if(WIN32 AND NOT EXISTS ${CMAKE_SOURCE_DIR}/deps/dpp.lib)
string(TOLOWER ${CMAKE_BUILD_TYPE} INSTALL_DPP_BUILD_TYPE)
execute_process(COMMAND powershell "-NoLogo" "-NoProfile" "-File" ".\\install_dpp_msvc.ps1" ${INSTALL_DPP_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The install_dpp_msvc.ps1 script here automatically installs the D++ library for Microsoft Visual C++ users. Why remove it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: I removed every DPP-related installation scripts because I cannot and don't know how to build it using that on Windows. It shows too much build errors when I first ran it, I don't know if I did something wrong or something. That was the first time I cloned the repository btw

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh? but it worked for me...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you show me what the errors are?

Comment thread include/topgg/client.h
#include <vector>
#include <string>
#include <map>
#include "topgg/export.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this should've been #include <topgg/export.h>. Not that big of an issue, but this would've made it consistent!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Comment thread include/topgg/models.h
virtual ~account() = default;

/**
* @brief The account's Discord ID.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the docstrings of this class' properties?

Comment thread include/topgg/models.h
~bot() override = default;

/**
* @brief The Discord bot's discriminator.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the docstrings of this class' properties?

Comment thread include/topgg/result.h

#ifdef DPP_CORO
/**
* @brief An async result class that gets returned from every C++20 coroutine HTTP response.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the docstrings of this class' properties?

Comment thread include/topgg/webhook.h
* @brief Data received from a bot vote webhook
*/
struct bot_vote_data {
dpp::snowflake user_id; ///< ID of the user who voted
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These docstrings should've used the proper format consistent with the other classes in this library (e.g: use @brief, @version, etc).

Comment thread include/topgg/webhook.h
bool is_weekend; ///< Whether the vote was done during weekend
std::string query; ///< Query string data if any

static bot_vote_data from_json(const nlohmann::json& j) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function body should be moved to webhook.cpp as it does not depend on any generics.

Comment thread include/topgg/webhook.h
: cluster_(cluster), port_(port), auth_token_(auth_token) {

// Set up interaction handler for webhooks
cluster_.on_interaction_create([this](const dpp::interaction_create_t& event) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function body should be moved to webhook.cpp as it does not depend on any generics.

Comment thread include/topgg/webhook.h

static bot_vote_data from_json(const nlohmann::json& j) {
bot_vote_data data;
data.user_id = dpp::snowflake(j["user"].get<std::string>());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try using those DESERIALIZE() macros!

@ghost ghost closed this by deleting the head repository Oct 10, 2025
This pull request was closed.
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.

2 participants