diff --git a/.github/workflows/MSVC-Windows-Binaries.yml b/.github/workflows/MSVC-Windows-Binaries.yml
new file mode 100644
index 000000000..8fc7e3b03
--- /dev/null
+++ b/.github/workflows/MSVC-Windows-Binaries.yml
@@ -0,0 +1,72 @@
+name: Build-and-Test-MSVC-Windows
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - main
+ - dev
+
+jobs:
+ Build:
+ runs-on: windows-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ msvc: [2022]
+ build_type: [Debug, Release]
+ std: [20]
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Update Vcpkg and install other dependencies
+ run: |
+ cd C:/vcpkg
+ ./bootstrap-vcpkg.bat
+ git stash
+ git pull
+ vcpkg update
+
+ - name: Install the dependencies
+ run: |
+ vcpkg install opus:x64-windows
+ vcpkg install libsodium:x64-windows
+ vcpkg install openssl:x64-windows
+
+ - name: Configure CMake
+ working-directory: ./
+ run: |
+ cmake -S . -B ./Build -DDEV=true -DVCPKG_ROOT_DIR=C:/vcpkg
+
+ - name: Build the Test
+ working-directory: ./Build
+ run: |
+ cmake --build . --config=${{matrix.build_type}}
+
+ - name: Install the Test
+ working-directory: ./Build/
+ run: |
+ cmake --install ./ --config=${{matrix.build_type}}
+
+ - name: Clone DiscordCoreAPI-Binaries repository
+ run: |
+ git clone https://github.com/RealTimeChris/DiscordCoreAPI-Binaries.git ./DiscordCoreAPI-Binaries
+ cd DiscordCoreAPI-Binaries
+ git config user.name "GitHub Action"
+ git config user.email "action@github.com"
+
+ - name: Copy build artifacts to DiscordCoreAPI-Binaries
+ run: |
+ cp -r -Force "C:/Program Files (x86)/DiscordCoreAPI/*" ./DiscordCoreAPI-Binaries/${{matrix.build_type}} -v
+ cd ./DiscordCoreAPI-Binaries/${{matrix.build_type}}
+ Remove-Item -Force ./bin/discordcoreapi.pdb
+
+ - name: Commit and push changes to DiscordCoreAPI-Binaries
+ working-directory: ./DiscordCoreAPI-Binaries
+ run: |
+ git add .
+ git commit -m "Update binaries for ${{matrix.build_type}} build"
+ git push https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/RealTimeChris/DiscordCoreAPI-Binaries.git main
+ continue-on-error: true
diff --git a/.github/workflows/MSVC-Windows.yml b/.github/workflows/MSVC-Windows.yml
index 3790ab3ea..961bb1667 100644
--- a/.github/workflows/MSVC-Windows.yml
+++ b/.github/workflows/MSVC-Windows.yml
@@ -65,7 +65,6 @@ jobs:
- name: Copy build artifacts to DiscordCoreAPI-Binaries
run: |
- mkdir -p ./DiscordCoreAPI-Binaries/${{matrix.build_type}}
cp -r ./Tests/Install/${{matrix.build_type}}/* ./DiscordCoreAPI-Binaries/${{matrix.build_type}}
- name: Commit and push changes to DiscordCoreAPI-Binaries
@@ -73,5 +72,5 @@ jobs:
run: |
git add .
git commit -m "Update binaries for ${{matrix.build_type}} build"
- git push https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/RealTimeChris/DiscordCoreAPI-Binaries.git main
+ git push https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/RealTimeChris/DiscordCoreAPI-Binaries.git main
continue-on-error: true
diff --git a/CMake/DCADetectArchitecture.cmake b/CMake/DCADetectArchitecture.cmake
index 5edd8a3fa..f4b44e5ff 100644
--- a/CMake/DCADetectArchitecture.cmake
+++ b/CMake/DCADetectArchitecture.cmake
@@ -34,8 +34,19 @@ execute_process(
RESULT_VARIABLE DCA_CPU_INSTRUCTIONS_NEW
)
-set(AVX_FLAG "")
+function(is_numeric value result_var)
+ string(REGEX MATCH "^[0-9]+(\\.[0-9]+)?$" is_numeric_match "${value}")
+ if(is_numeric_match)
+ set(${result_var} TRUE PARENT_SCOPE)
+ else()
+ set(${result_var} FALSE PARENT_SCOPE)
+ endif()
+endfunction()
+
+is_numeric("${DCA_CPU_INSTRUCTIONS_NEW}" is_numeric_result)
+set(AVX_FLAG "")
+if (is_numeric_result)
math(EXPR DCA_CPU_INSTRUCTIONS_NUMERIC "${DCA_CPU_INSTRUCTIONS_NEW}")
math(EXPR DCA_CPU_INSTRUCTIONS 0)
@@ -99,6 +110,8 @@ else()
check_instruction_set("Avx2" "-mavx2;-mavx;-mlzcnt;-mpopcnt;-mbmi;-mbmi2" 0x40)
check_instruction_set("Avx512" "-mavx512f;-mavx2;-mavx;-mlzcnt;-mpopcnt;-mbmi;-mbmi2" 0x80)
endif()
-
+else()
+set(DCA_CPU_INSTRUCTIONS "0")
+endif()
set(AVX_FLAG "${AVX_FLAG}" CACHE STRING "AVX flags" FORCE)
set(DCA_CPU_INSTRUCTIONS "${DCA_CPU_INSTRUCTIONS}" CACHE STRING "CPU Instruction Sets" FORCE)
diff --git a/Documentation/Doxygen/Docs/Index.md b/Documentation/Doxygen/Docs/Index.md
index aa5ed0c5f..ca840302c 100644
--- a/Documentation/Doxygen/Docs/Index.md
+++ b/Documentation/Doxygen/Docs/Index.md
@@ -1,8 +1,8 @@
\mainpage DiscordCoreAPI
[![Codacy Badge](https://img.shields.io/codacy/grade/1e5ae970aed34d0b96249cdfd02099cf?color=lightblue&label=Code%20Quality&style=plastic)](https://www.codacy.com/gh/RealTimeChris/DiscordCoreAPI/dashboard?utm_source=github.com&utm_medium=referral&utm_content=RealTimeChris/DiscordCoreAPI&utm_campaign=Badge_Grade)
-[![Discord](https://img.shields.io/discord/931640556814237706?color=red&label=Discord%20Server&style=plastic)](https://discord.gg/adgMqeBuhP)
+[![Discord](https://img.shields.io/discord/931640556814237706?color=red&label=Discord%20Server&style=plastic)](https://discord.gg/c33GH5BUe8)
![Commit Activity](https://img.shields.io/github/commit-activity/y/realtimechris/discordcoreapi?color=green&label=Commits&style=plastic)
-![Lines of Code](https://tokei.rs/b1/github/RealTimeChris/DiscordCoreAPI?color=light-blue&label=Lines%20Of%20Code%20&style=plastic)
+![Lines of Code](https://tokei.rs/b1/github/RealTimeChris/DiscordCoreAPI-Code-Only?color=light-blue&label=Lines%20Of%20Code%20&style=plastic)
Hello, and welcome to DiscordCoreAPI! This is a Discord bot library, written in C++, that leverages custom asynchronous \ref discord_core_api::co_routine "CoRoutines", as well as a home-brew set of \ref discord_core_api::discord_core_internal::https_client "Https",
\ref discord_core_api::discord_core_internal::websocket_client "WebSocket", and \ref discord_core_api::voice_connection "Datagram" socket clients - all to deliver the utmost performance and efficiency for your bot. It uses roughly 0.1% of an Intel i7 9750h CPU to stream audio in high quality (Opus @ 48Khz, 16-bit) to a single server.
@@ -10,20 +10,20 @@ Hello, and welcome to DiscordCoreAPI! This is a Discord bot library, written in
![imageDiscordCoreAPI](./TheLogo.png "A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.")
## Compiler Support
-![MSVC_20922](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/MSVC_2022-Windows.yml?style=plastic&logo=microsoft&logoColor=green&label=MSVC_2022&labelColor=pewter&color=blue)
-![CLANG_18](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/CLANG_18-Ubuntu.yml?style=plastic&logo=linux&logoColor=green&label=CLANG_18&labelColor=pewter&color=blue)
-![GCC_13](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/GCC_13-MacOS.yml?style=plastic&logo=apple&logoColor=green&label=GCC_13&labelColor=pewter&color=blue)
+![MSVC_20922](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/MSVC-Windows.yml?style=plastic&logo=microsoft&logoColor=green&label=MSVC_2022&labelColor=pewter&color=blue)
+![CLANG_18](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/CLANG-Ubuntu.yml?style=plastic&logo=linux&logoColor=green&label=CLANG_18&labelColor=pewter&color=blue)
+![GCC_13](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/GCC-MacOS.yml?style=plastic&logo=apple&logoColor=green&label=GCC_13&labelColor=pewter&color=blue)
## Operating System Support
-![Windows](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/MSVC_2022-Windows.yml?style=plastic&logo=microsoft&logoColor=green&label=Windows&labelColor=pewter&color=blue)
-![Linux](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/CLANG_18-Ubuntu.yml?style=plastic&logo=linux&logoColor=green&label=Linux&labelColor=pewter&color=blue)
-![Mac](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/GCC_13-MacOS.yml?style=plastic&logo=apple&logoColor=green&label=MacOS&labelColor=pewter&color=blue)
+![Windows](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/MSVC-Windows.yml?style=plastic&logo=microsoft&logoColor=green&label=Windows&labelColor=pewter&color=blue)
+![Linux](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/CLANG-Ubuntu.yml?style=plastic&logo=linux&logoColor=green&label=Linux&labelColor=pewter&color=blue)
+![Mac](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/GCC-MacOS.yml?style=plastic&logo=apple&logoColor=green&label=MacOS&labelColor=pewter&color=blue)
# Documentation/Examples
\ref documentation_examples
# Discord Server
-[This is a link to the Discord server!](https://discord.gg/adgMqeBuhP)
+[This is a link to the Discord server!](https://discord.gg/c33GH5BUe8)
# Bot Template
[A template for utilizing this library.](https://github.com/RealTimeChris/Bot-Template-for-DiscordCoreAPI)
diff --git a/Include/discordcoreapi/FoundationEntities.hpp b/Include/discordcoreapi/FoundationEntities.hpp
index ce54f4108..0f4304785 100644
--- a/Include/discordcoreapi/FoundationEntities.hpp
+++ b/Include/discordcoreapi/FoundationEntities.hpp
@@ -30,6 +30,7 @@
#pragma once
#include
+#include
namespace discord_core_api {
@@ -321,23 +322,27 @@ namespace discord_core_api {
};
struct websocket_message {
- jsonifier::string t{};
+ std::optional t{};
+ std::optional s{};
int64_t op{ -1 };
- int64_t s{};
};
template struct websocket_message_data {
unordered_set jsonifierExcludedKeys{};
- jsonifier::string t{};
+ std::optional t{};
+ std::optional s{};
value_type d{};
int64_t op{};
- int64_t s{};
DCA_INLINE operator discord_core_internal::etf_serializer() {
etf_serializer data{};
data["op"] = op;
- data["s"] = s;
- data["t"] = t;
+ if (s.has_value()) {
+ data["s"] = s.value();
+ }
+ if (t.has_value()) {
+ data["t"] = t.value();
+ }
data["d"] = d.operator discord_core_internal::etf_serializer();
return data;
}
@@ -407,18 +412,20 @@ namespace discord_core_api {
template class flag_entity {
public:
- template DCA_INLINE auto setFlagValue(value_type02 theFlagToSet, bool enabled) {
- auto newValue = static_cast(static_cast(this)->flags);
+ template DCA_INLINE void setFlagValue(flag_type theFlagToSet, bool enabled) {
+ using underlying_type = std::underlying_type_t;
+ auto newValue = static_cast(static_cast(this)->flags);
if (enabled) {
- newValue |= static_cast(theFlagToSet);
+ newValue |= static_cast(theFlagToSet);
} else {
- newValue &= ~static_cast(theFlagToSet);
+ newValue &= ~static_cast(theFlagToSet);
}
- static_cast(this)->flags = static_cast(newValue);
+ static_cast(this)->flags = static_cast(newValue);
}
- template DCA_INLINE bool getFlagValue(value_type02 theFlagToCheckFor) const {
- return static_cast(static_cast(this)->flags) & static_cast(theFlagToCheckFor);
+ template DCA_INLINE bool getFlagValue(flag_type theFlagToCheckFor) const {
+ using underlying_type = std::underlying_type_t;
+ return static_cast(static_cast(this)->flags) & static_cast(theFlagToCheckFor);
}
protected:
@@ -426,6 +433,7 @@ namespace discord_core_api {
DCA_INLINE ~flag_entity() = default;
};
+
enum class user_image_types {
Banner = 0,
Default_Avatar = 1,
diff --git a/Include/discordcoreapi/JsonSpecializations.hpp b/Include/discordcoreapi/JsonSpecializations.hpp
index d68bb5950..2d2abbf67 100644
--- a/Include/discordcoreapi/JsonSpecializations.hpp
+++ b/Include/discordcoreapi/JsonSpecializations.hpp
@@ -41,8 +41,8 @@ namespace discord_core_api {
websocket_message_data(const update_voice_state_data& data);
unordered_set jsonifierExcludedKeys{};
using type = update_voice_state_data;
+ std::optional t{};
int64_t op{ -1 };
- jsonifier::string t{};
int32_t s{};
type d{};
operator etf_serializer();
@@ -53,8 +53,8 @@ namespace discord_core_api {
websocket_message_data(const update_voice_state_data& data);
unordered_set jsonifierExcludedKeys{};
using type = update_voice_state_data_dc;
+ std::optional t{};
int64_t op{ -1 };
- jsonifier::string t{};
int32_t s{};
type d{};
operator etf_serializer();
@@ -65,7 +65,7 @@ namespace discord_core_api {
namespace jsonifier_internal {
template
- concept snowflake_t = std::same_as>;
+ concept snowflake_t = std::same_as>;
template
struct serialize_impl {
@@ -88,7 +88,7 @@ namespace jsonifier_internal {
};
template
- concept time_stamp_t = std::same_as>;
+ concept time_stamp_t = std::same_as>;
template
struct serialize_impl {
diff --git a/Include/discordcoreapi/Utilities/Etf.hpp b/Include/discordcoreapi/Utilities/Etf.hpp
index 6540805e1..8f366a59b 100644
--- a/Include/discordcoreapi/Utilities/Etf.hpp
+++ b/Include/discordcoreapi/Utilities/Etf.hpp
@@ -454,8 +454,8 @@ namespace discord_core_api {
/// @brief Concept for array types excluding etf_serializer.
template
- concept array_t = jsonifier::concepts::range && jsonifier::concepts::has_resize> &&
- jsonifier::concepts::has_emplace_back> && jsonifier::concepts::vector_subscriptable> &&
+ concept array_t = jsonifier::concepts::range && jsonifier::concepts::has_resize> &&
+ jsonifier::concepts::has_emplace_back> && jsonifier::concepts::vector_subscriptable> &&
requires(value_type&& data) { typename value_type::value_type; };
/// @brief Concept for object (associative container) types excluding etf_serializer.
diff --git a/Include/discordcoreapi/Utilities/RingBuffer.hpp b/Include/discordcoreapi/Utilities/RingBuffer.hpp
index a7134eba6..90de1f4bd 100644
--- a/Include/discordcoreapi/Utilities/RingBuffer.hpp
+++ b/Include/discordcoreapi/Utilities/RingBuffer.hpp
@@ -63,10 +63,10 @@ namespace discord_core_api {
arrayValue.resize(size);
}
- DCA_INLINE ring_buffer_interface& operator=(ring_buffer_interface&&) noexcept = default;
- DCA_INLINE ring_buffer_interface(ring_buffer_interface&&) noexcept = default;
- DCA_INLINE ring_buffer_interface& operator=(const ring_buffer_interface&) noexcept = default;
- DCA_INLINE ring_buffer_interface(const ring_buffer_interface&) noexcept = default;
+ DCA_INLINE ring_buffer_interface& operator=(ring_buffer_interface&&) noexcept = default;
+ DCA_INLINE ring_buffer_interface(ring_buffer_interface&&) noexcept = default;
+ DCA_INLINE ring_buffer_interface& operator=(const ring_buffer_interface&) noexcept = default;
+ DCA_INLINE ring_buffer_interface(const ring_buffer_interface&) noexcept = default;
// forward declaration to grant friendship to the ring_buffer class.
template friend class ring_buffer;
@@ -125,7 +125,7 @@ namespace discord_core_api {
}
protected:
- jsonifier::vector> arrayValue{};///< The underlying data array.
+ jsonifier::vector> arrayValue{};///< The underlying data array.
size_type tail{};///< The tail position in the buffer.
size_type head{};///< The head position in the buffer.
};
@@ -134,18 +134,18 @@ namespace discord_core_api {
/// @tparam value_type the type of data stored in the buffer.
/// @tparam slice_count the number of slices.
template class ring_buffer
- : public ring_buffer_interface, 1024 * 16>, slice_count> {
+ : public ring_buffer_interface, 1024 * 16>, slice_count> {
public:
- using base_type = ring_buffer_interface, 1024 * 16>, slice_count>;
- using value_type = typename ring_buffer_interface, 1024 * 16>::value_type;
+ using base_type = ring_buffer_interface, 1024 * 16>, slice_count>;
+ using value_type = typename ring_buffer_interface, 1024 * 16>::value_type;
using const_pointer = const value_type*;
using pointer = value_type*;
using size_type = uint64_t;
/// @brief Default constructor. initializes the buffer size.
- DCA_INLINE ring_buffer() noexcept = default;
- DCA_INLINE ring_buffer& operator=(ring_buffer&&) noexcept = default;
- DCA_INLINE ring_buffer(ring_buffer&&) noexcept = default;
+ DCA_INLINE ring_buffer() noexcept = default;
+ DCA_INLINE ring_buffer& operator=(ring_buffer&&) noexcept = default;
+ DCA_INLINE ring_buffer(ring_buffer&&) noexcept = default;
DCA_INLINE ring_buffer& operator=(const ring_buffer&) noexcept = default;
DCA_INLINE ring_buffer(const ring_buffer&) noexcept = default;
@@ -166,11 +166,11 @@ namespace discord_core_api {
/// @brief Read data from the buffer.
/// @return a string view containing the read data.
- DCA_INLINE jsonifier::string_view_base> readData() {
- jsonifier::string_view_base> returnData{};
+ DCA_INLINE jsonifier::string_view_base> readData() {
+ jsonifier::string_view_base> returnData{};
if (base_type::getCurrentTail()->getUsedSpace() > 0) {
- returnData = jsonifier::string_view_base>{ base_type::getCurrentTail()->getCurrentTail(),
- base_type::getCurrentTail()->getUsedSpace() };
+ returnData =
+ jsonifier::string_view_base>{ base_type::getCurrentTail()->getCurrentTail(), base_type::getCurrentTail()->getUsedSpace() };
base_type::getCurrentTail()->clear();
base_type::modifyReadOrWritePosition(ring_buffer_access_type::read, 1);
}
diff --git a/Include/discordcoreapi/Utilities/UnboundedMessageBlock.hpp b/Include/discordcoreapi/Utilities/UnboundedMessageBlock.hpp
index d938b6670..c4c2029ca 100644
--- a/Include/discordcoreapi/Utilities/UnboundedMessageBlock.hpp
+++ b/Include/discordcoreapi/Utilities/UnboundedMessageBlock.hpp
@@ -34,7 +34,7 @@
namespace discord_core_api {
template
- concept copyable_or_movable = std::copyable> || std::movable>;
+ concept copyable_or_movable = std::copyable> || std::movable>;
/// @brief A thread-safe messaging block for data-structures.
/// @tparam value_type the type of object that will be sent over the message block.
@@ -87,7 +87,7 @@ namespace discord_core_api {
std::mutex accessMutex{};
};
- template DCA_INLINE bool waitForTimeToPass(unbounded_message_block>& outBuffer, value_type& argOne, uint64_t timeInMsNew) {
+ template DCA_INLINE bool waitForTimeToPass(unbounded_message_block>& outBuffer, value_type& argOne, uint64_t timeInMsNew) {
stop_watch stopWatch{ milliseconds{ timeInMsNew } };
stopWatch.reset();
while (!outBuffer.tryReceive(argOne)) {
diff --git a/Include/discordcoreapi/Utilities/UnorderedSet.hpp b/Include/discordcoreapi/Utilities/UnorderedSet.hpp
index bfa465513..033e7bff2 100644
--- a/Include/discordcoreapi/Utilities/UnorderedSet.hpp
+++ b/Include/discordcoreapi/Utilities/UnorderedSet.hpp
@@ -36,7 +36,7 @@ namespace discord_core_api {
template class unordered_set;
template
- concept set_container_iterator_t = std::same_as::iterator, jsonifier_internal::unwrap_t>;
+ concept set_container_iterator_t = std::same_as::iterator, std::remove_cvref_t>;
template
class unordered_set : protected hash_policy>, protected jsonifier_internal::alloc_wrapper, protected object_compare {
@@ -309,7 +309,7 @@ namespace discord_core_api {
}
template DCA_INLINE uint64_t getKey(value_type_newer&& keyValue) const {
- return key_accessor>::getHashKey(std::forward(keyValue));
+ return key_accessor>::getHashKey(std::forward(keyValue));
}
DCA_INLINE void resize(size_type capacityNew) {
diff --git a/Library/CMake/BuildFeatureTester.bat b/Library/CMake/BuildFeatureTester.bat
deleted file mode 100644
index 62c7a1dd1..000000000
--- a/Library/CMake/BuildFeatureTester.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-"C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe" -S ./ -B ./Build -DCMAKE_BUILD_TYPE=Release
-"C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe" --build ./Build --config=Release
\ No newline at end of file
diff --git a/ReadMe.md b/ReadMe.md
index 0f946bc58..70c83c5ad 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -1,6 +1,6 @@
# DiscordCoreAPI
[![Codacy Badge](https://img.shields.io/codacy/grade/1e5ae970aed34d0b96249cdfd02099cf?color=lightblue&label=Code%20Quality&style=plastic)](https://www.codacy.com/gh/RealTimeChris/DiscordCoreAPI/dashboard?utm_source=github.com&utm_medium=referral&utm_content=RealTimeChris/DiscordCoreAPI&utm_campaign=Badge_Grade)
-[![Discord](https://img.shields.io/discord/931640556814237706?color=red&label=Discord%20Server&style=plastic)](https://discord.gg/adgMqeBuhP)
+[![Discord](https://img.shields.io/discord/931640556814237706?color=red&label=Discord%20Server&style=plastic)](https://discord.gg/c33GH5BUe8)
![Commit Activity](https://img.shields.io/github/commit-activity/y/realtimechris/discordcoreapi?color=green&label=Commits&style=plastic)
![Lines of Code](https://tokei.rs/b1/github/RealTimeChris/DiscordCoreAPI-Code-Only?color=light-blue&label=Lines%20Of%20Code%20&style=plastic)
@@ -11,20 +11,20 @@ Hello, and welcome to DiscordCoreAPI! This is a Discord bot library, written in
alt="DiscordCoreAPI WebSite" width="500"/>
## Compiler Support
-![MSVC_20922](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/MSVC_2022-Windows.yml?style=plastic&logo=microsoft&logoColor=green&label=MSVC_2022&labelColor=pewter&color=blue)
-![CLANG_18](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/CLANG_18-Ubuntu.yml?style=plastic&logo=linux&logoColor=green&label=CLANG_18&labelColor=pewter&color=blue)
-![GCC_13](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/GCC_13-MacOS.yml?style=plastic&logo=apple&logoColor=green&label=GCC_13&labelColor=pewter&color=blue)
+![MSVC_20922](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/MSVC-Windows.yml?style=plastic&logo=microsoft&logoColor=green&label=MSVC_2022&labelColor=pewter&color=blue)
+![CLANG_18](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/CLANG-Ubuntu.yml?style=plastic&logo=linux&logoColor=green&label=CLANG_18&labelColor=pewter&color=blue)
+![GCC_13](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/GCC-MacOS.yml?style=plastic&logo=apple&logoColor=green&label=GCC_13&labelColor=pewter&color=blue)
## Operating System Support
-![Windows](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/MSVC_2022-Windows.yml?style=plastic&logo=microsoft&logoColor=green&label=Windows&labelColor=pewter&color=blue)
-![Linux](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/CLANG_18-Ubuntu.yml?style=plastic&logo=linux&logoColor=green&label=Linux&labelColor=pewter&color=blue)
-![Mac](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/GCC_13-MacOS.yml?style=plastic&logo=apple&logoColor=green&label=MacOS&labelColor=pewter&color=blue)
+![Windows](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/MSVC-Windows.yml?style=plastic&logo=microsoft&logoColor=green&label=Windows&labelColor=pewter&color=blue)
+![Linux](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/CLANG-Ubuntu.yml?style=plastic&logo=linux&logoColor=green&label=Linux&labelColor=pewter&color=blue)
+![Mac](https://img.shields.io/github/actions/workflow/status/RealTimeChris/DiscordCoreAPI/GCC-MacOS.yml?style=plastic&logo=apple&logoColor=green&label=MacOS&labelColor=pewter&color=blue)
# Documentation/Examples
[Documentation/Examples](https://discordcoreapi.com/documentation_examples.html)
# Discord Server
-[This is a link to the Discord server!](https://discord.gg/adgMqeBuhP)
+[This is a link to the Discord server!](https://discord.gg/c33GH5BUe8)
# Bot Template
[A template for utilizing this library.](https://github.com/RealTimeChris/Bot-Template-for-DiscordCoreAPI)
diff --git a/Source/WebSocketClient.cpp b/Source/WebSocketClient.cpp
index dfbb6cdaf..8b9683d23 100644
--- a/Source/WebSocketClient.cpp
+++ b/Source/WebSocketClient.cpp
@@ -460,6 +460,10 @@ namespace discord_core_api {
bool websocket_client::onMessageReceived(jsonifier::string_view_base dataNew) {
try {
+ std::string newString{};
+ newString.resize(dataNew.size());
+ std::memcpy(newString.data(), dataNew.data(), dataNew.size());
+ std::cout << "CURRENT DATA: " << newString << std::endl;
if (areWeConnected() && currentMessage.size() > 0 && dataNew.size() > 0) {
websocket_message message{};
if (configManager->getTextFormat() == text_format::etf) {
@@ -484,453 +488,466 @@ namespace discord_core_api {
}
}
- if (message.s != 0) {
- lastNumberReceived = static_cast(message.s);
+ if (message.s.has_value()) {
+ std::cout << "CURRENT S: " << message.s.value() << std::endl;
+ if (message.s.value() != 0) {
+ lastNumberReceived = static_cast(message.s.value());
+ }
+ }
+
+ if (message.t.has_value()) {
+ std::cout << "CURRENT T: " << message.t.value() << std::endl;
}
+
message_printer::printSuccess("Message received from websocket [" + jsonifier::toString(shard.at(0)) + "," +
jsonifier::toString(shard.at(1)) + jsonifier::string("]: ") + jsonifier::string{ dataNew });
switch (static_cast(message.op)) {
case websocket_op_codes::dispatch: {
- if (message.t != "") {
- switch (event_converter{ message.t }) {
- case 1: {
- websocket_message_data data{};
- if (dataOpCode == websocket_op_code::Op_Text) {
- data.d.jsonifierExcludedKeys.emplace("shard");
- }
- currentState.store(websocket_state::authenticated, std::memory_order_release);
- parser.parseJson(data, dataNew);
- if (auto result = parser.getErrors(); result.size() > 0) {
- for (auto& valueNew: result) {
- message_printer::printError(valueNew.reportError());
+ if (message.t.has_value()) {
+ if (message.t.value() != "") {
+ switch (event_converter{ message.t.value() }) {
+ case 1: {
+ websocket_message_data data{};
+ if (dataOpCode == websocket_op_code::Op_Text) {
+ data.d.jsonifierExcludedKeys.emplace("shard");
+ }
+ currentState.store(websocket_state::authenticated, std::memory_order_release);
+ parser.parseJson(data, dataNew);
+ if (auto result = parser.getErrors(); result.size() > 0) {
+ for (auto& valueNew: result) {
+ message_printer::printError(valueNew.reportError());
+ }
}
+ sessionId = data.d.sessionId;
+ if (data.d.resumeGatewayUrl.find("wss://") != jsonifier::string::npos) {
+ resumeUrl = data.d.resumeGatewayUrl.substr(data.d.resumeGatewayUrl.find("wss://") + jsonifier::string{ "wss://" }.size());
+ }
+ discord_core_client::getInstance()->currentUser = bot_user{ data.d.user,
+ discord_core_client::getInstance()
+ ->baseSocketAgentsMap[static_cast(floor(static_cast(shard.at(0)) %
+ static_cast(discord_core_client::getInstance()->baseSocketAgentsMap.size())))]
+ .get() };
+ users::insertUser(static_cast(std::move(data.d.user)));
+ currentReconnectTries = 0;
+ break;
}
- sessionId = data.d.sessionId;
- if (data.d.resumeGatewayUrl.find("wss://") != jsonifier::string::npos) {
- resumeUrl = data.d.resumeGatewayUrl.substr(data.d.resumeGatewayUrl.find("wss://") + jsonifier::string{ "wss://" }.size());
+ case 2: {
+ currentState.store(websocket_state::authenticated, std::memory_order_release);
+ currentReconnectTries = 0;
+ break;
}
- discord_core_client::getInstance()->currentUser = bot_user{ data.d.user,
- discord_core_client::getInstance()
- ->baseSocketAgentsMap[static_cast(floor(
- static_cast(shard.at(0)) % static_cast(discord_core_client::getInstance()->baseSocketAgentsMap.size())))]
- .get() };
- users::insertUser(static_cast(std::move(data.d.user)));
- currentReconnectTries = 0;
- break;
- }
- case 2: {
- currentState.store(websocket_state::authenticated, std::memory_order_release);
- currentReconnectTries = 0;
- break;
- }
- case 3: {
- if (discord_core_client::getInstance()->eventManager.onApplicationCommandPermissionsUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(
- parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onApplicationCommandPermissionsUpdateEvent(*dataPackage);
+ case 3: {
+ if (discord_core_client::getInstance()->eventManager.onApplicationCommandPermissionsUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(
+ parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onApplicationCommandPermissionsUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 4: {
- if (discord_core_client::getInstance()->eventManager.onAutoModerationRuleCreationEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onAutoModerationRuleCreationEvent(*dataPackage);
+ case 4: {
+ if (discord_core_client::getInstance()->eventManager.onAutoModerationRuleCreationEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onAutoModerationRuleCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 5: {
- if (discord_core_client::getInstance()->eventManager.onAutoModerationRuleUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onAutoModerationRuleUpdateEvent(*dataPackage);
+ case 5: {
+ if (discord_core_client::getInstance()->eventManager.onAutoModerationRuleUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onAutoModerationRuleUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 6: {
- if (discord_core_client::getInstance()->eventManager.onAutoModerationRuleDeletionEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onAutoModerationRuleDeletionEvent(*dataPackage);
+ case 6: {
+ if (discord_core_client::getInstance()->eventManager.onAutoModerationRuleDeletionEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onAutoModerationRuleDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 7: {
- if (discord_core_client::getInstance()->eventManager.onAutoModerationActionExecutionEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser,
- dataNew) };
- discord_core_client::getInstance()->eventManager.onAutoModerationActionExecutionEvent(*dataPackage);
+ case 7: {
+ if (discord_core_client::getInstance()->eventManager.onAutoModerationActionExecutionEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser,
+ dataNew) };
+ discord_core_client::getInstance()->eventManager.onAutoModerationActionExecutionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 8: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onChannelCreationEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onChannelCreationEvent(*dataPackage);
+ case 8: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onChannelCreationEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onChannelCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 9: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onChannelUpdateEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onChannelUpdateEvent(*dataPackage);
+ case 9: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onChannelUpdateEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onChannelUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 10: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onChannelDeletionEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onChannelDeletionEvent(*dataPackage);
+ case 10: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onChannelDeletionEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onChannelDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 11: {
- if (discord_core_client::getInstance()->eventManager.onChannelPinsUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onChannelPinsUpdateEvent(*dataPackage);
+ case 11: {
+ if (discord_core_client::getInstance()->eventManager.onChannelPinsUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onChannelPinsUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 12: {
- if (discord_core_client::getInstance()->eventManager.onThreadCreationEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onThreadCreationEvent(*dataPackage);
+ case 12: {
+ if (discord_core_client::getInstance()->eventManager.onThreadCreationEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onThreadCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 13: {
- if (discord_core_client::getInstance()->eventManager.onThreadUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onThreadUpdateEvent(*dataPackage);
+ case 13: {
+ if (discord_core_client::getInstance()->eventManager.onThreadUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onThreadUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 14: {
- if (discord_core_client::getInstance()->eventManager.onThreadDeletionEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onThreadDeletionEvent(*dataPackage);
+ case 14: {
+ if (discord_core_client::getInstance()->eventManager.onThreadDeletionEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onThreadDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 15: {
- if (discord_core_client::getInstance()->eventManager.onThreadListSyncEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onThreadListSyncEvent(*dataPackage);
+ case 15: {
+ if (discord_core_client::getInstance()->eventManager.onThreadListSyncEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onThreadListSyncEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 16: {
- if (discord_core_client::getInstance()->eventManager.onThreadMemberUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onThreadMemberUpdateEvent(*dataPackage);
+ case 16: {
+ if (discord_core_client::getInstance()->eventManager.onThreadMemberUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onThreadMemberUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 17: {
- if (discord_core_client::getInstance()->eventManager.onThreadMembersUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onThreadMembersUpdateEvent(*dataPackage);
+ case 17: {
+ if (discord_core_client::getInstance()->eventManager.onThreadMembersUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onThreadMembersUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 18: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onGuildCreationEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onGuildCreationEvent(*dataPackage);
+ case 18: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onGuildCreationEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onGuildCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 19: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onGuildUpdateEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onGuildUpdateEvent(*dataPackage);
+ case 19: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onGuildUpdateEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onGuildUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 20: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onGuildDeletionEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onGuildDeletionEvent(*dataPackage);
+ case 20: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onGuildDeletionEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onGuildDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 21: {
- if (discord_core_client::getInstance()->eventManager.onGuildBanAddEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildBanAddEvent(*dataPackage);
+ case 21: {
+ if (discord_core_client::getInstance()->eventManager.onGuildBanAddEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildBanAddEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 22: {
- if (discord_core_client::getInstance()->eventManager.onGuildBanRemoveEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildBanRemoveEvent(*dataPackage);
+ case 22: {
+ if (discord_core_client::getInstance()->eventManager.onGuildBanRemoveEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildBanRemoveEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 23: {
- if (discord_core_client::getInstance()->eventManager.onGuildEmojisUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildEmojisUpdateEvent(*dataPackage);
+ case 23: {
+ if (discord_core_client::getInstance()->eventManager.onGuildEmojisUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildEmojisUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 24: {
- if (discord_core_client::getInstance()->eventManager.onGuildStickersUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildStickersUpdateEvent(*dataPackage);
+ case 24: {
+ if (discord_core_client::getInstance()->eventManager.onGuildStickersUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildStickersUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 25: {
- if (discord_core_client::getInstance()->eventManager.onGuildIntegrationsUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildIntegrationsUpdateEvent(*dataPackage);
+ case 25: {
+ if (discord_core_client::getInstance()->eventManager.onGuildIntegrationsUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildIntegrationsUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 26: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onGuildMemberAddEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onGuildMemberAddEvent(*dataPackage);
+ case 26: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onGuildMemberAddEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onGuildMemberAddEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 27: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onGuildMemberRemoveEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onGuildMemberRemoveEvent(*dataPackage);
+ case 27: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onGuildMemberRemoveEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onGuildMemberRemoveEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 28: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onGuildMemberUpdateEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onGuildMemberUpdateEvent(*dataPackage);
+ case 28: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onGuildMemberUpdateEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onGuildMemberUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 29: {
- if (discord_core_client::getInstance()->eventManager.onGuildMembersChunkEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildMembersChunkEvent(*dataPackage);
+ case 29: {
+ if (discord_core_client::getInstance()->eventManager.onGuildMembersChunkEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildMembersChunkEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 30: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onRoleCreationEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onRoleCreationEvent(*dataPackage);
+ case 30: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onRoleCreationEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onRoleCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 31: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onRoleUpdateEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onRoleUpdateEvent(*dataPackage);
+ case 31: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onRoleUpdateEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onRoleUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 32: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onRoleDeletionEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onRoleDeletionEvent(*dataPackage);
+ case 32: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onRoleDeletionEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onRoleDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 33: {
- if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventCreationEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildScheduledEventCreationEvent(*dataPackage);
+ case 33: {
+ if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventCreationEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser,
+ dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildScheduledEventCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 34: {
- if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildScheduledEventUpdateEvent(*dataPackage);
+ case 34: {
+ if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildScheduledEventUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 35: {
- if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventDeletionEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildScheduledEventDeletionEvent(*dataPackage);
+ case 35: {
+ if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventDeletionEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser,
+ dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildScheduledEventDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 36: {
- if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventUserAddEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildScheduledEventUserAddEvent(*dataPackage);
+ case 36: {
+ if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventUserAddEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser,
+ dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildScheduledEventUserAddEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 37: {
- if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventUserRemoveEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser,
- dataNew) };
- discord_core_client::getInstance()->eventManager.onGuildScheduledEventUserRemoveEvent(*dataPackage);
+ case 37: {
+ if (discord_core_client::getInstance()->eventManager.onGuildScheduledEventUserRemoveEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser,
+ dataNew) };
+ discord_core_client::getInstance()->eventManager.onGuildScheduledEventUserRemoveEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 38: {
- if (discord_core_client::getInstance()->eventManager.onIntegrationCreationEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onIntegrationCreationEvent(*dataPackage);
+ case 38: {
+ if (discord_core_client::getInstance()->eventManager.onIntegrationCreationEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onIntegrationCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 39: {
- if (discord_core_client::getInstance()->eventManager.onIntegrationUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onIntegrationUpdateEvent(*dataPackage);
+ case 39: {
+ if (discord_core_client::getInstance()->eventManager.onIntegrationUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onIntegrationUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 40: {
- if (discord_core_client::getInstance()->eventManager.onIntegrationDeletionEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onIntegrationDeletionEvent(*dataPackage);
+ case 40: {
+ if (discord_core_client::getInstance()->eventManager.onIntegrationDeletionEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onIntegrationDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 41: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onInteractionCreationEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onInteractionCreationEvent(*dataPackage);
+ case 41: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onInteractionCreationEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onInteractionCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 42: {
- if (discord_core_client::getInstance()->eventManager.onInviteCreationEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onInviteCreationEvent(*dataPackage);
+ case 42: {
+ if (discord_core_client::getInstance()->eventManager.onInviteCreationEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onInviteCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 43: {
- if (discord_core_client::getInstance()->eventManager.onInviteDeletionEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onInviteDeletionEvent(*dataPackage);
+ case 43: {
+ if (discord_core_client::getInstance()->eventManager.onInviteDeletionEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onInviteDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 44: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onMessageCreationEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onMessageCreationEvent(*dataPackage);
+ case 44: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onMessageCreationEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onMessageCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 45: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onMessageUpdateEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onMessageUpdateEvent(*dataPackage);
+ case 45: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onMessageUpdateEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onMessageUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 46: {
- if (discord_core_client::getInstance()->eventManager.onMessageDeletionEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onMessageDeletionEvent(*dataPackage);
+ case 46: {
+ if (discord_core_client::getInstance()->eventManager.onMessageDeletionEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onMessageDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 47: {
- if (discord_core_client::getInstance()->eventManager.onMessageDeleteBulkEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onMessageDeleteBulkEvent(*dataPackage);
+ case 47: {
+ if (discord_core_client::getInstance()->eventManager.onMessageDeleteBulkEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onMessageDeleteBulkEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 48: {
- if (discord_core_client::getInstance()->eventManager.onReactionAddEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onReactionAddEvent(*dataPackage);
+ case 48: {
+ if (discord_core_client::getInstance()->eventManager.onReactionAddEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onReactionAddEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 49: {
- if (discord_core_client::getInstance()->eventManager.onReactionRemoveEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onReactionRemoveEvent(*dataPackage);
+ case 49: {
+ if (discord_core_client::getInstance()->eventManager.onReactionRemoveEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onReactionRemoveEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 50: {
- if (discord_core_client::getInstance()->eventManager.onReactionRemoveAllEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onReactionRemoveAllEvent(*dataPackage);
+ case 50: {
+ if (discord_core_client::getInstance()->eventManager.onReactionRemoveAllEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onReactionRemoveAllEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 51: {
- if (discord_core_client::getInstance()->eventManager.onReactionRemoveEmojiEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onReactionRemoveEmojiEvent(*dataPackage);
+ case 51: {
+ if (discord_core_client::getInstance()->eventManager.onReactionRemoveEmojiEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onReactionRemoveEmojiEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 52: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- if (discord_core_client::getInstance()->eventManager.onPresenceUpdateEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onPresenceUpdateEvent(*dataPackage);
+ case 52: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ if (discord_core_client::getInstance()->eventManager.onPresenceUpdateEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onPresenceUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 53: {
- if (discord_core_client::getInstance()->eventManager.onStageInstanceCreationEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onStageInstanceCreationEvent(*dataPackage);
+ case 53: {
+ if (discord_core_client::getInstance()->eventManager.onStageInstanceCreationEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onStageInstanceCreationEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 54: {
- if (discord_core_client::getInstance()->eventManager.onStageInstanceUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onStageInstanceUpdateEvent(*dataPackage);
+ case 54: {
+ if (discord_core_client::getInstance()->eventManager.onStageInstanceUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onStageInstanceUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 55: {
- if (discord_core_client::getInstance()->eventManager.onStageInstanceDeletionEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onStageInstanceDeletionEvent(*dataPackage);
+ case 55: {
+ if (discord_core_client::getInstance()->eventManager.onStageInstanceDeletionEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onStageInstanceDeletionEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 56: {
- if (discord_core_client::getInstance()->eventManager.onTypingStartEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onTypingStartEvent(*dataPackage);
+ case 56: {
+ if (discord_core_client::getInstance()->eventManager.onTypingStartEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onTypingStartEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 57: {
- if (discord_core_client::getInstance()->eventManager.onUserUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onUserUpdateEvent(*dataPackage);
+ case 57: {
+ if (discord_core_client::getInstance()->eventManager.onUserUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onUserUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 58: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew, this) };
- if (discord_core_client::getInstance()->eventManager.onVoiceStateUpdateEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onVoiceStateUpdateEvent(*dataPackage);
+ case 58: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew, this) };
+ if (discord_core_client::getInstance()->eventManager.onVoiceStateUpdateEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onVoiceStateUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 59: {
- unique_ptr dataPackage{ makeUnique(parser, dataNew, this) };
- if (discord_core_client::getInstance()->eventManager.onVoiceServerUpdateEvent.functions.size() > 0) {
- discord_core_client::getInstance()->eventManager.onVoiceServerUpdateEvent(*dataPackage);
+ case 59: {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew, this) };
+ if (discord_core_client::getInstance()->eventManager.onVoiceServerUpdateEvent.functions.size() > 0) {
+ discord_core_client::getInstance()->eventManager.onVoiceServerUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
- }
- case 60: {
- if (discord_core_client::getInstance()->eventManager.onWebhookUpdateEvent.functions.size() > 0) {
- unique_ptr dataPackage{ makeUnique(parser, dataNew) };
- discord_core_client::getInstance()->eventManager.onWebhookUpdateEvent(*dataPackage);
+ case 60: {
+ if (discord_core_client::getInstance()->eventManager.onWebhookUpdateEvent.functions.size() > 0) {
+ unique_ptr dataPackage{ makeUnique(parser, dataNew) };
+ discord_core_client::getInstance()->eventManager.onWebhookUpdateEvent(*dataPackage);
+ }
+ break;
}
- break;
}
}
}
@@ -1178,6 +1195,7 @@ namespace discord_core_api {
}
}
- base_socket_agent::~base_socket_agent(){}
+ base_socket_agent::~base_socket_agent() {
+ }
}// namespace discord_core_internal
}// namespace discord_core_api
diff --git a/Vcpkg/ports/discordcoreapi/portfile.cmake b/Vcpkg/ports/discordcoreapi/portfile.cmake
index 1f4e97fce..7a2585a05 100644
--- a/Vcpkg/ports/discordcoreapi/portfile.cmake
+++ b/Vcpkg/ports/discordcoreapi/portfile.cmake
@@ -6,13 +6,12 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO RealTimeChris/DiscordCoreAPI
REF "v${VERSION}"
- SHA512 678f2cf892139582cf5d77a33d4f03cfb2d264d5f0af3912ffd378ab05ee40f27703c9ad5496a72af68fb8ea2ab66192701f911b0d1bfff53542fd1d7e9ec65e
+ SHA512 344e960491e17e9626f6ab4a42f28fe59842c0c15cf32ef2508e850099105667c651feaa6dd642207413fbeac43283310fe2b9a98a2ebfd4a49716da43e5cade
HEAD_REF main
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
- DISABLE_PARALLEL_CONFIGURE
)
vcpkg_cmake_install()
diff --git a/Vcpkg/ports/discordcoreapi/vcpkg.json b/Vcpkg/ports/discordcoreapi/vcpkg.json
index ce090aafa..7c43aed13 100644
--- a/Vcpkg/ports/discordcoreapi/vcpkg.json
+++ b/Vcpkg/ports/discordcoreapi/vcpkg.json
@@ -1,6 +1,6 @@
{
"name": "discordcoreapi",
- "version": "2.0.2",
+ "version": "2.0.7",
"description": "A Discord bot library written in C++ using custom asynchronous coroutines.",
"homepage": "https://discordcoreapi.com",
"license": "MIT",
diff --git a/Vcpkg/versions/d-/discordcoreapi.json b/Vcpkg/versions/d-/discordcoreapi.json
index fb065baf9..e1c6e62ff 100644
--- a/Vcpkg/versions/d-/discordcoreapi.json
+++ b/Vcpkg/versions/d-/discordcoreapi.json
@@ -1,5 +1,30 @@
{
"versions": [
+ {
+ "git-tree": "cf7406d145c55d85306226b283a9d7b3224e62c2",
+ "version": "2.0.6",
+ "port-version": 0
+ },
+ {
+ "git-tree": "4cfa99c19a8811ae210dc76d37a27dae5c636aca",
+ "version": "2.0.5",
+ "port-version": 0
+ },
+ {
+ "git-tree": "9ee6373146d5c81a3e7bd75e4f32da5ec846299d",
+ "version": "2.0.4",
+ "port-version": 0
+ },
+ {
+ "git-tree": "a836f4645f8f1dd567ed87160f62c4026b8db784",
+ "version": "2.0.3",
+ "port-version": 0
+ },
+ {
+ "git-tree": "4105594f2f8aef84bb0aa20917d473727e0d9700",
+ "version": "2.0.2",
+ "port-version": 0
+ },
{
"git-tree": "3b4e38bd8dd9683ee4923d31a64426a01e8b3466",
"version": "2.0.1",