C++ Discord API Bot Library
This library powers the bot TriviaBot which has over 100,000 servers, and Sporks which has over 2,700 severs. The library's use in these bots shows that the library is production ready for bots of all sizes.
During testing this library takes approximately 400 megabytes of ram to cache 1,000,000 (1 million) users and 7700 guilds, with their respective roles and emojis, in production. This is half the memory of a similar C++ Discord library, Aegis.cpp (version 2).
All REST calls (outbound commands) are completed including slash commands, and all Discord events are available. The library also has voice support.
The best place to do this is on the discord server. You most likely won't get an answer immediately (we have lives, and need to sleep sometimes), so feel free to lurk and join the community!
Just star and fork a copy of the repository, and submit a Pull Request! We won't bite! Authors of accepted pull requests get a special role on the support server.
A simple search can find some learning tools, however not all are good. Here is a list of learning resources:
If you don't understand something then feel free to ask in the discord server ...*we don't bite!*
NO! Definitely not! We have tried to keep things as simple as possible. We only use language features where they make sense, not just because they exist. Take a look at the example program (
test.cpp and you'll see just how simple it is to get up and running quickly). We use a small subset of C++17 and C++14 features.
DPP is short for Discord Plus Plus (D++), a play on the Discord and C++ names.
No, D++ is a classically designed library which installs itself to your library directory/system directory as a shared object or dll. You must link to its .lib file and include its header files to make use of it. We have no plans for a single-header build.
Yes! This library supports slash commands. For more information please see Using Slash Commands and Interactions.
Yes! This library supports button message components, e.g. interactive buttons on the bottom of messages. For more information please see our Using component interactions and Using component interactions (advanced) examples.
All functions within D++ are multi-threaded. You should still avoid doing long operations within event handlers or within callbacks, to prevent starvation of the threads managing each shard. Various blocking operations such as running files and making HTTP requests are offered as library functions (for example dpp::utility::exec)
Yes! This library supports voice and will automatically enable voice if your system has the libopus and libsodium libraries. When running
cmake the script will identify if these libraries are found. See the example programs for information on how to send audio.
Yes! D++ supports sharding and also clustering (grouping of shards into one process) to ensure it is scalable for small and large bots alike.
The documentation and website are built using Doxygen. To contribute to site pages, submit a Pull Request to the main repository. The site pages can be found within the
docpages directory. Details of classes, variables, namespaces etc are auto generated from Doxygen comments within the library source code in the
D++ Only supports Discord API v9, the latest version.
Yes! D++ supports the new discord Threads. You can create, edit and delete threads and also attach events watching for messages within threads.
No, at present we do not use any C++20 features. Some C++17 features are used, which are available in all recent compilers.
To fix this issue, as root run
sudo ldconfig. Log out if your SSH session and log back in, and the bot should be able to find the library.
The libsodium package requires pkg-config, but does not check for it when installed. Install it as root, e.g.
sudo apt install pkg-config. Rerun cmake again, and rebuild the library.