A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.
Hello, and welcome to DiscordCoreAPI! This is a Discord bot library, written in C++, that leverages custom asynchronous CoRoutines, as well as a home-brew set of Https, WebSocket, and 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.
This is a link to the Discord server!
A template for utilizing this library.
discord_core_api::snowflake::toEntity()
function of the snowflake
class allows for converting the entity's id directly into the data structure represented by it.discord_core_api::snowflake someChannelId{};
discord_core_api::channel_data newChannel = someChannelId.toEntity<discord_core_api::channel_data>();
std::cout << "CHANNEL NAME: " + newChannel.name << std::endl;
StreamInfo
member of the VoiceConnectInitData
structure, with the VoiceConnection
class.
event_manager::onInputEventCreation
event.input_events::respondToInputEventAsync()
function.event_manager::onInteractionCreation
or event_manager::onMessageCreation
events.EmbedData newEmbed{};
newEmbed.setAuthor(args.eventData.getUserName(), args.eventData.getAvatarURL());
newEmbed.setDescription("------\\n__**Sorry, but there's already something play
ing!**__\\n------");
newEmbed.setTimeStamp(getTimeAndDate());
newEmbed.setTitle("__**Playing Issue:**__");
newEmbed.setColor(discordGuild.data.borderColor);
RespondToInputEventData dataPackage{ args.eventData };
dataPackage.addMessageEmbed(newEmbed);
dataPackage.setResponseType(InputEventResponseType::Ephemeral_Interaction_Response);
InputEventData newEvent = input_events::respondToInputEvent(dataPackage);
input_events::deleteInputEventResponseAsync(newEvent, 20000).get();
vcpkg integrate install
.vcpkg install discordcoreapi:x64-windows_OR_linux
.discordcoreapi/Index.hpp
._VCPKG_ROOT_DIR
, or the Opus_DIR
, unofficial-sodium_DIR
paths to wherever each of the respective dependency files are located and they are as follows:
cmake -S . --preset Linux_OR_Windows-Debug_OR_Release
.cmake --build --preset Linux_OR_Windows-Debug_OR_Release
.cmake --install ./Build/Debug_OR_Release
.cmake --install ./Build/Debug_OR_Release
, you will be given a cmake package, which can be used to build from this library, using other cmake projects.DiscordCoreAPI_DIR
to wherever the DiscordCoreAPIConfig.cmake file would have been installed on your system by having run the cmake --install
command, and then using find_package()
on DiscordCoreAPI
.DiscordCoreAPI
- this is the library target which can be linked to from other targets in cmake, and on Windows; $<TARGET_RUNTIME_DLLS:DiscordCoreAPI-Bot>
- which is a list of dll files to be copied into your executable's final location after building. As well as RELEASE_PDB_FILE_PATH
, DEBUG_PDB_FILE_PATH
, RELEASE_PDB_FILE_NAME
, and DEBUG_PDB_FILE_NAME
, which are full file/directory paths/filenames to the library's PDB files.VCPKG_ROOT_DIR
, or the CMAKE_CONFIG_FILE_DIR
, Opus_DIR
, and unofficial-sodium_DIR
paths to wherever each of the respective dependency files are located and they are as follows:
discordcoreapi/Index.hpp
.cmake -S . --preset Linux_OR_Windows-Debug_OR_Release
.cmake --build --preset Linux_OR_Windows-Debug_OR_Release
.cmake --install ./Build/Debug_OR_Release
.I am currently working on getting this thing to be used by people like you! So, if you have any suggestions for the library that would make it more usable - don't hesitate to let me know! I can be easily found on the Discord server that is linked to above! Cheers and thanks for your time.