Skip to content

Commit

Permalink
[Update]: Library BETA update
Browse files Browse the repository at this point in the history
  • Loading branch information
harshfeudal committed Nov 28, 2022
1 parent 8a6127c commit 22397a9
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

### 📚 Libraries and version
These are libraries that we're using in this project:
- [Dpp](https://github.com/brainboxdotcc/DPP) - version `10.0.21` (latest)
- [Dpp](https://github.com/brainboxdotcc/DPP) - version `10.0.22` (BETA)
- [Spdlog](https://github.com/gabime/spdlog) - version `1.11.0` (latest)
- [Base64](https://gist.github.com/tomykaira/f0fd86b6c73063283afe550bc5d77594)

Expand Down
2 changes: 0 additions & 2 deletions include/dpp/appcommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@ enum interaction_response_type {
ir_update_message = 7, //!< for components, edit the message the component was attached to
ir_autocomplete_reply = 8, //!< Reply to autocomplete interaction. Be sure to do this within 500ms of the interaction!
ir_modal_dialog = 9, //!< A modal dialog box

ir_default = 0, /// From Harshfeudal's shorten
};

/**
Expand Down
13 changes: 11 additions & 2 deletions include/dpp/automod.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ enum automod_trigger_type : uint8_t {
*/
struct DPP_EXPORT automod_metadata : public json_interface<automod_metadata> {
/**
* @brief @brief Substrings which will be searched for in content.
* @brief @brief Substrings which will be searched for in content (Maximum of 1000).
*
* Each keyword can be a phrase which contains multiple words. All keywords are case insensitive.
* Each keyword can be a phrase which contains multiple words.
* All keywords are case insensitive and can be up to 30 characters.
*
* Wildcard symbols (`*`) can be used to customize how each keyword will be matched.
*
Expand Down Expand Up @@ -146,6 +147,14 @@ struct DPP_EXPORT automod_metadata : public json_interface<automod_metadata> {
*/
std::vector<std::string> keywords;

/**
* @brief Regular expression patterns which will be matched against content (Maximum of 10).
*
* Only Rust flavored regex is currently supported, which can be tested in online editors such as [Rustexp](https://rustexp.lpil.uk/).
* Each regex pattern must be 75 characters or less.
*/
std::vector<std::string> regex_patterns;

/**
* @brief Preset keyword list types to moderate
* @see automod_preset_type
Expand Down
2 changes: 0 additions & 2 deletions include/dpp/dpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,3 @@
#include <dpp/discordevents.h>
#include <dpp/timed_listener.h>
#include <dpp/collector.h>

#include <harshfeudal/harshfeudal.h>
4 changes: 0 additions & 4 deletions include/dpp/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -979,10 +979,6 @@ enum message_flags : uint16_t {
m_loading = 1 << 7,
/// this message failed to mention some roles and add their members to the thread
m_thread_mention_failed = 1 << 8,

/// this null enum was added by @harshfeudal, to use `#include <harshfeudal/shorten.h>` for shorten code
/// this message is just a normal message, no ephemeral, no any cosmetic
m_default = 0,
};

/**
Expand Down
8 changes: 8 additions & 0 deletions include/dpp/user.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ enum user_flags : uint32_t {
u_bot_http_interactions = 0b00100000000000000000000,
/// User has nitro basic
u_nitro_basic = 0b01000000000000000000000,
/// User has the active developer badge
u_active_developer = 0b10000000000000000000000,
};

/**
Expand Down Expand Up @@ -136,6 +138,12 @@ class DPP_EXPORT user : public managed, public json_interface<user> {
*/
std::string get_mention() const;

/**
* @brief Return true if user has the active Developer badge
*
* @return true if has active developer
*/
bool is_active_developer() const;
/**
* @brief User is a bot
*
Expand Down
6 changes: 3 additions & 3 deletions include/dpp/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#pragma once

#if !defined(DPP_VERSION_LONG)
#define DPP_VERSION_LONG 0x00100021
#define DPP_VERSION_SHORT 100021
#define DPP_VERSION_TEXT "D++ 10.0.21 (02-Oct-2022)"
#define DPP_VERSION_LONG 0x00100022
#define DPP_VERSION_SHORT 100022
#define DPP_VERSION_TEXT "D++ 10.0.22 (01-Nov-2022)"

#define DPP_VERSION_MAJOR ((DPP_VERSION_LONG & 0x00ff0000) >> 16)
#define DPP_VERSION_MINOR ((DPP_VERSION_LONG & 0x0000ff00) >> 8)
Expand Down
Binary file modified lib/dpp.lib
Binary file not shown.
22 changes: 19 additions & 3 deletions src/information/userInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ void userInfo(dpp::cluster& client, const dpp::slashcommand_t& event)
if (std::holds_alternative<dpp::snowflake>(event.get_parameter("user")) == true)
usrId = std::get<dpp::snowflake>(event.get_parameter("user"));

dpp::user_identified tgtId = client.user_get_sync(usrId);

// If cannot find the user
if (!dpp::find_user(usrId))
if (dpp::find_user(usrId) == false)
{
EmbedBuild(embed, 0xFF7578, errorTitle, warnTitle, "User not found!", event.command.usr);
event.reply(
Expand All @@ -80,6 +78,8 @@ void userInfo(dpp::cluster& client, const dpp::slashcommand_t& event)
return;
}

dpp::user_identified tgtId = client.user_get_sync(usrId);

// This is under-investigation [Library bug]
if (tgtId.is_discord_employee())
hasStaffBadge = StaffBadge;
Expand Down Expand Up @@ -115,6 +115,22 @@ void userInfo(dpp::cluster& client, const dpp::slashcommand_t& event)
if (tgtId.has_nitro_basic() || tgtId.has_nitro_classic() || tgtId.has_nitro_full())
hasNitroBadge = NitroSubscriber;

std::cout << "member object: " << std::endl;
std::cout << "id " << tgtId.id << std::endl;
std::cout << "username " << tgtId.username << std::endl;
std::cout << "flags " << tgtId.flags << std::endl;
std::cout << "bravery " << tgtId.is_house_bravery() << std::endl;
std::cout << "brilliance " << tgtId.is_house_brilliance() << std::endl;
std::cout << "balance " << tgtId.is_house_balance() << std::endl;
std::cout << "is_bot " << tgtId.is_bot() << std::endl;
std::cout << "is_active_developer " << tgtId.is_active_developer() << std::endl;
std::cout << "has_nitro_basic " << tgtId.has_nitro_basic() << std::endl;
std::cout << "has_nitro_classic " << tgtId.has_nitro_classic() << std::endl;
std::cout << "has_nitro_full " << tgtId.has_nitro_full() << std::endl;
std::cout << "is_verified_bot_dev " << tgtId.is_verified_bot_dev() << std::endl;
std::cout << "is_bughunter_1 " << tgtId.is_bughunter_1() << std::endl;
std::cout << "is_bughunter_2 " << tgtId.is_bughunter_2() << std::endl;

const auto avatar = tgtId.get_avatar_url();
const auto usrID = fmt::format("{}", tgtId.id);
const auto created = fmt::format("<t:{}:R>", round(tgtId.get_creation_time()));
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <map>
#include <spdlog/spdlog.h>
#include <dpp/nlohmann/json.hpp>
#include <harshfeudal/harshfeudal.h>
#include <dpp/dpp.h>
#include <Windows.h>

Expand Down

0 comments on commit 22397a9

Please sign in to comment.