Skip to content

Commit f29bca8

Browse files
committed
DiscordCoreAPI Release v2.0.1
-Made the members of EventManager static. -Modifed the VoiceConnection's send logic. -Improved the parsing of ETF character strings. -Improved the byte-swapping functions for ETF parsing to improve performance.Improved the polling logic of the TCP connection sockets. -Fixed a couple serialization key exclusions. -Updating to accommodate for camel-case swapped casing of Jsonifier classes. -Modified the CoRoutineThreadPool class to derive from its container. -Modified the socket read/write logic. -Updated the DetectArchitecture.cmake script. -Improved the logic of the SongAPI and related classes. -Fixed an issue where timeout was enabled on CoRoutines that it should not have been. -Improved the voice connection's connection logic. -Replaced local instances of DiscordCoreClient* with the statically held version.
1 parent ee84cdb commit f29bca8

File tree

120 files changed

+12982
-3175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+12982
-3175
lines changed

BuildTools/Classes/Packager/Vcpkg.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,16 @@ function constructPortAndVersionFile(string $sha512 = "0"): string
160160
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
161161
endif()
162162
163-
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/License.md")';
163+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/License.md")
164+
';
164165

165166
$versionFileContent = '{
166167
"name": "discordcoreapi",
167168
"version": ' . json_encode($this->getVersion()) . ',
168169
"description": "A Discord bot library written in C++ using custom asynchronous coroutines.",
169170
"homepage": "https://discordcoreapi.com",
170171
"license": "MIT",
171-
"supports": "(windows & x64 & !xbox) | (linux & x64)",
172+
"supports": "(windows & x64 & !xbox) | (linux & x64) | (osx & x64)",
172173
"dependencies": [
173174
"jsonifier",
174175
"libsodium",

CMake/CollectVersion.cmake

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,27 @@
2222
# May 13, 2021
2323
# https://discordcoreapi.com
2424

25-
function(collect_version)
25+
function(collect_version project_name)
2626

27-
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../Vcpkg/ports/discordcoreapi/vcpkg.json" JSON_STRING)
27+
set(PRODUCT_VERSION "")
28+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/Vcpkg/ports/${project_name}/vcpkg.json" JSON_STRING)
2829
foreach(IDX RANGE 1)
2930
string(JSON PRODUCT_VERSION GET "${JSON_STRING}" "version")
3031
endforeach()
31-
set(PRODUCT_VERSION "${PRODUCT_VERSION}" PARENT_SCOPE)
3232
string(REPLACE "." ";" PRODUCT_VERSION_LIST "${PRODUCT_VERSION}")
3333
list(GET PRODUCT_VERSION_LIST 0 VERSION_MAJOR)
34+
list(APPEND PRODUCT_VERSION_NEW "${VERSION_MAJOR}")
3435
set(VERSION_MAJOR "${VERSION_MAJOR}" PARENT_SCOPE)
3536
list(GET PRODUCT_VERSION_LIST 1 VERSION_MINOR)
37+
list(APPEND PRODUCT_VERSION_NEW "${VERSION_MINOR}")
3638
set(VERSION_MINOR "${VERSION_MINOR}" PARENT_SCOPE)
39+
list(LENGTH PRODUCT_VERSION_LIST LIST_SIZE)
40+
if (LIST_SIZE GREATER 2)
41+
list(GET PRODUCT_VERSION_LIST 2 VERSION_PATCH)
42+
set(VERSION_PATCH "${VERSION_PATCH}" PARENT_SCOPE)
43+
list(APPEND PRODUCT_VERSION_NEW "${VERSION_PATCH}")
44+
endif()
45+
string(REPLACE ";" "." PRODUCT_VERSION_NEW "${PRODUCT_VERSION_NEW}")
46+
set(PRODUCT_VERSION "${PRODUCT_VERSION_NEW}" PARENT_SCOPE)
3747

3848
endfunction()

CMake/DetectArchitecture.cmake

Lines changed: 0 additions & 69 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
# CMakeLists.txt - The CMake script for building this library.
2222
# May 13, 2021
2323
# https://discordcoreapi.com
24-
set(VCPKG_ROOT_DIR "C:/Vcpkg")
2524
set(Opus_DIR "C:/Vcpkg/installed/x64-windows/share/opus") # Set this one to the folder location of the file "OpusConfig.cmake".
2625
set(unofficial-sodium_DIR "C:/Vcpkg/installed/x64-windows/share/unofficial-sodium") # Set this one to the folder location of the file "unofficial-sodiumConfig.cmake".
27-
set(Jsonifier_DIR "C:/vcpkg2/installed/x64-windows/share/jsonifier/") # Set this one to the folder location of the file "JsonifierConfig.cmake".
26+
set(Jsonifier_DIR "C:/vcpkg2/Users/Chris/source/repos/Jsonifier/Install/Windows-Release/share/jsonifier") # Set this one to the folder location of the file "JsonifierConfig.cmake".
2827
set(OPENSSL_ROOT_DIR "C:/Vcpkg/installed/x64-windows/") # Set this one to the folder location of the include folder and library folders of OpenSSL.
2928

3029
if (EXISTS "${VCPKG_ROOT_DIR}")
@@ -41,11 +40,21 @@ elseif(APPLE)
4140
endif()
4241
if (NOT "$ENV{VCPKG_INSTALLATION_ROOT}" STREQUAL "")
4342
set(VCPKG_INSTALLATION_ROOT_NEW "$ENV{VCPKG_INSTALLATION_ROOT}")
44-
set(OPENSSL_ROOT_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/")
45-
set(OpenSSL_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/openssl")
46-
set(Jsonifier_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/jsonifier")
47-
set(Opus_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/opus")
48-
set(unofficial-sodium_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/unofficial-sodium")
43+
if (NOT EXISTS "${OPENSSL_ROOT_DIR}")
44+
set(OPENSSL_ROOT_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/")
45+
endif()
46+
if (NOT EXISTS "${OpenSSL_DIR}")
47+
set(OpenSSL_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/openssl")
48+
endif()
49+
if (NOT EXISTS "${Jsonifier_DIR}")
50+
set(Jsonifier_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/jsonifier")
51+
endif()
52+
if (NOT EXISTS "${Opus_DIR}")
53+
set(Opus_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/opus")
54+
endif()
55+
if (NOT EXISTS "${unofficial_sodium_DIR}" STREQUAL "")
56+
set(unofficial_sodium_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/unofficial-sodium")
57+
endif()
4958
include("${VCPKG_INSTALLATION_ROOT_NEW}/scripts/buildsystems/vcpkg.cmake")
5059
set(OS_NAME "${CMAKE_SYSTEM_NAME}")
5160
string(TOLOWER "${OS_NAME}" OS_NAME)
@@ -55,9 +64,13 @@ else()
5564
set(VCPKG_INSTALLATION_ROOT_NEW "${VCPKG_ROOT_DIR}")
5665
endif()
5766

67+
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/CMake;")
68+
69+
include("CollectVersion")
70+
collect_version("discordcoreapi")
71+
5872
set(PROJECT_NAME "DiscordCoreAPI")
5973
set(LIB_NAME "${PROJECT_NAME}")
60-
set(PRODUCT_VERSION "${VERSION}")
6174
set(DESCRIPTION "A Discord bot library, written in C++, using custom asynchronous coroutines.")
6275

6376
project(
@@ -67,7 +80,6 @@ project(
6780
HOMEPAGE_URL "https://discordcoreapi.com"
6881
DESCRIPTION "${DESCRIPTION}"
6982
)
70-
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/CMake;")
7183
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}")
7284

7385
add_subdirectory(Library)

Documentation/Doxygen/Documentation-Examples/Application-Command-Stuff/Batch Edit Guild Application Command Permissions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Batch Editing Guild Application Command's Permissions {#batcheditguildcommandpermissions}
22
============
3-
- Execute the `ApplicationCommands::batchEditGuildApplicationCommandPermissionsAsync()` function, while passing in a data structure of type `BatchEditGuildApplicationCommandPermissionsData`, with a return value of type `auto` or `Jsonifier::Vector<GuildApplicationCommandPermissionsData>`.
3+
- Execute the `ApplicationCommands::batchEditGuildApplicationCommandPermissionsAsync()` function, while passing in a data structure of type `BatchEditGuildApplicationCommandPermissionsData`, with a return value of type `auto` or `jsonifier::vector<GuildApplicationCommandPermissionsData>`.
44
- Call the function with `.get()` added to the end in order to wait for the results now.
55

66
```cpp
@@ -34,7 +34,7 @@ namespace DiscordCoreAPI {
3434
InputEvents::deleteInputEventResponseAsync(args.eventData).get();
3535

3636
BatchEditGuildApplicationCommandPermissionsData dataPackage01;
37-
Jsonifier::Vector<EditGuildApplicationCommandPermissionsData> dataPackage02 {
37+
jsonifier::vector<EditGuildApplicationCommandPermissionsData> dataPackage02 {
3838
{.permissions = {{.type = ApplicationCommandPermissionType::User, .permission = false, .id = "859853159115259905"}},
3939
.commandName = "selldrugs"}};
4040
dataPackage01.guildId = args.eventData.getGuildId();

Documentation/Doxygen/Documentation-Examples/Application-Command-Stuff/Bulk Overwrite Global Application Commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Bulk Overwriting Global Application Commands {#bulkoverwriteglobalcommands}
22
============
3-
- Execute the `ApplicationCommands::bulkOverwriteGlobalApplicationCommandsAsync()` function, while passing in a data structure of type `BulkOverwriteGlobalApplicationCommandsData`, with a return value of `auto` or `Jsonifier::Vector<ApplicationCommand>`.
3+
- Execute the `ApplicationCommands::bulkOverwriteGlobalApplicationCommandsAsync()` function, while passing in a data structure of type `BulkOverwriteGlobalApplicationCommandsData`, with a return value of `auto` or `jsonifier::vector<ApplicationCommand>`.
44
- Call the function with `.get()` added to the end in order to wait for the results now.
55

66
```cpp

Documentation/Doxygen/Documentation-Examples/Application-Command-Stuff/Bulk Overwrite Guild Application Commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Bulk Overwriting Guild Application Commands {#bulkoverwriteguildcommands}
22
============
3-
- Execute the `ApplicationCommands::bulkOverwriteGuildApplicationCommandsAsync()` function and execute it, while passing in a data structure of type `BulkOverwriteGuildApplicationCommandsData`, with a return value of `auto` or `Jsonifier::Vector<ApplicationCommand>`.
3+
- Execute the `ApplicationCommands::bulkOverwriteGuildApplicationCommandsAsync()` function and execute it, while passing in a data structure of type `BulkOverwriteGuildApplicationCommandsData`, with a return value of `auto` or `jsonifier::vector<ApplicationCommand>`.
44
- Call the function with `.get()` added to the end in order to wait for the results now.
55

66
```cpp

Documentation/Doxygen/Documentation-Examples/Application-Command-Stuff/Creating a Global Application Command.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ namespace DiscordCoreAPI {
5050
5151
CreateGlobalApplicationCommandData registerApplicationCommandsCommandData;
5252
registerApplicationCommandsCommandData.dmPermission = true;
53-
registerApplicationCommandsCommandData.applicationId = argsNew.discordCoreClient->getBotUser().id;
53+
registerApplicationCommandsCommandData.applicationId = DiscordCoreClient::getInstance()->getBotUser().id;
5454
registerApplicationCommandsCommandData.type = ApplicationCommandType::Chat_Input;
5555
registerApplicationCommandsCommandData.description = "Register the programmatically designated slash commands.";
5656
registerApplicationCommandsCommandData.name = "registerapplicationcommands";
5757
ApplicationCommands::createGlobalApplicationCommandAsync(registerApplicationCommandsCommandData);
5858

5959
CreateGlobalApplicationCommandData createTestData;
6060
createTestData.dmPermission = true;
61-
createTestData.applicationId = argsNew.discordCoreClient->getBotUser().id;
61+
createTestData.applicationId = DiscordCoreClient::getInstance()->getBotUser().id;
6262
createTestData.type = ApplicationCommandType::Chat_Input;
6363
createTestData.name = "test";
6464
createTestData.description = "Test command.";

Documentation/Doxygen/Documentation-Examples/Application-Command-Stuff/Get Global Application Commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Getting Global Application Commands {#getglobalcommands}
22
=============
3-
- Execute the `ApplicationCommands::getGlobalApplicationCommandsAsync()` function, with a return value of type `auto` or `Jsonifier::Vector<ApplicationCommand>`.
3+
- Execute the `ApplicationCommands::getGlobalApplicationCommandsAsync()` function, with a return value of type `auto` or `jsonifier::vector<ApplicationCommand>`.
44
- Call the function with `.get()` added to the end in order to wait for the results now.
55

66
```cpp

Documentation/Doxygen/Documentation-Examples/Application-Command-Stuff/Get Guild Application Commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Getting Guild Application Commands {#getguildcommands}
22
=============
3-
- Execute the `ApplicationCommands::getGuildApplicationCommandsAsync()` function, while passing in an argument of type `GetGuildApplicationCommandsData`, with a return value of type `auto` or `Jsonifier::Vector<ApplicationCommand>`.
3+
- Execute the `ApplicationCommands::getGuildApplicationCommandsAsync()` function, while passing in an argument of type `GetGuildApplicationCommandsData`, with a return value of type `auto` or `jsonifier::vector<ApplicationCommand>`.
44
- Call the function with `.get()` added to the end in order to wait for the results now.
55

66
```cpp

0 commit comments

Comments
 (0)