/DiscordCoreAPI

A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.

Primary LanguageC++OtherNOASSERTION

DiscordCoreAPI

A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.

Features

CPU Efficient


  • It only uses about 0.1% of an Intel i7 9750h to stream audio in high quality (@Opus 48Khz 16-bit Stereo) to a single server.

Entire Discord API Covered


  • All of the Discord API endpoints are covered in this library, including voice communication.

Concurrent Discord API Access


  • As a result of using custom asynchronous coroutines, this library has the ability to make fully asynchronous/concurrent requests to the Discord API.

Slash Commands and Buttons


Select Menus


User Commands


Message Commands


A Unified "Input-Event" System


  • Both user messages and user interactions are accepted via the onInputEventCreation event.
  • They can all be responded to using the DiscordCoreAPI::InputEvents::respondToEvent() function.
EmbedData newEmbed;
newEmbed.setAuthor(args->eventData.getUserName(), args->eventData.getAvatarURL());
newEmbed.setDescription("------\n__**Sorry, but there's already something playing!**__\n------");
newEmbed.setTimeStamp(getTimeAndDate());
newEmbed.setTitle("__**Playing Issue:**__");
newEmbed.setColor(discordGuild.data.borderColor);
embedsFromSearch.push_back(newEmbed);
RespondToInputEventData dataPackage(args->eventData);
dataPackage.addMessageEmbed(newEmbed);
if (args->eventData.eventType == InputEventType::REGULAR_MESSAGE) {
	dataPackage.type = DesiredInputEventResponseType::RegularMessage;
}
else {
	dataPackage.type = DesiredInputEventResponseType::EphemeralInteractionResponse;
}
newEvent = InputEvents::respondToEvent(dataPackage);
InputEvents::deleteInputEventResponseAsync(newEvent, 20000).get();

Supported Platforms

  • This library currently supports being built within Visual Studio 2022/MSVC on the Windows platform as well as g++-11 on the Linux platform.

Dependencies

  • CMake
  • NOTE: I installed these using the vcpkg installer.
  • OpenSSL (.\vcpkg install openssl:x64-windows/x64-linux)
  • Nlohmann Json (.\vcpkg install nlohmann-json:x64-windows/x64-linux)
  • LibCurl (.\vcpkg install curl:x64-windows/x64-linux)
  • LibSodium (.\vcpkg install libsodium:x64-windows/x64-linux)
  • FFMPEG (.\vcpkg install ffmpeg:x64-windows/x64-linux)
  • Glib (.\vcpkg install glib:x64-windows/x64-linux)
  • Cpp-Base64 (.\vcpkg install cpp-base64:x64-windows/x64-linux)
  • Opus (.\vcpkg install opus:x64-windows/x64-linux)

Roadmap

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!