必须自行安装 OpenSSL 和 zlib 开发包;语音功能需额外安装 libopus(Windows 预编译包已自带);需 cmake 3.13+ 和 g++ 8+/clang 6+ 等受支持编译器。

DPP
brainboxdotccApache-2.0活跃维护轻量级 C++ Discord Bot 开发库,封装 Discord API v10,小到个人玩具、大到大型机器人都能扛住。
C++ Discord API Bot Library - D++ is Lightweight and scalable for small and huge bots!
cmake -B build . && cmake --build buildREADME 未说明具体硬件要求;库可运行在 Linux、macOS、FreeBSD、OpenBSD、Windows 和树莓派(ARM64/ARM6/ARM7)上,未提及 GPU 或显存。
现代 C++ 写的轻量级 Discord 机器人库,内存占用极小,小机器人和大集群都能扛
轻量级 C++ Discord Bot 开发库,封装 Discord API v10,小到个人玩具、大到大型机器人都能扛住。
核心能力
- 支持 Discord API v10,几乎覆盖全部接口
- 为 guild、频道、成员、角色、用户提供高效缓存
- 支持分片与集群,多分片可跑在单进程
- 优化 ETF 解析,提升 websocket 吞吐
- 支持斜杠命令与语音收发(含 DAVE 端到端加密)
容易踩的坑
- v10.1.6v10.1.6 release最新正式版2026-08-05 · 2026-08-05 22:52 UTC
We're pleased to announce the release of D++ 10.1.6, bringing a number of new features, bug fixes, documentation improvements and build enhancements.
This version adds support for the new Discord API file type filtering option for file upload components.
This release also includes an important security improvement to the library's TLS client implementation. While the issue requires an attacker to be in a network position to intercept and modify traffic, we recommend that all users upgrade to 10.1.6 as soon as practical.
We would like to thank @EQSTLab for their professional and responsible disclosure of this issue, and @Ashthetik for independently reviewing and verifying the implemented fix. Their assistance helped ensure the issue was addressed thoroughly before release.
Further details are available in the accompanying GitHub Security Advisory.
The changelog is listed below:
Release Changelog
✨ New Features
- Added file type filtering to slashcommand attachments (#1630)
- Add nix flake (#1617)
- Add missed logic
🐞 Bug Fixes
- GHSA-2wjr-jv67-4m55 - Improper TLS Certificate Validation in DPP Client Connections
- Tighten up shell escaping to handle some edge cases (#1632)
- Race condition when destroying voice client (#1631)
- When receiving message update and cache policy set to
cp_none, ensure we receive the member details and roles (#1621) - Fix shard reconnection issue causing segfault (#1608)
- Should invalidate previous session data when got session expired/invalid error (#1614)
- Voice session reconnect (#1606)
- Fix shard reconnection issue
- Remove unused captures in example code (#1604)
- 100% busy main thread while bot is pausing audio playback in vc (#1594)
- Add protections against dataraces in socket engines, cluster timer and queues. (#1587)
📚 Documentation
- Revise vulnerability reporting instructions in
SECURITY.md(#1634)
🔧 Chore
- Replace
forloop withwhile(#1609) - Update nlohmann/json to 3.12.0 (#1596)
📜 Miscellaneous Changes
- Restore resume logic
👷 Build/CI
- Sitemap now uses a pinned version (#1615)
- Docker image for Linux ARM64 (#1619)
- Add static library builds (#1612)
Thank you for using D++!
- v10.1.5v10.1.5 release2026-05-20 · 2026-05-20 08:41 UTC
查看更新说明
We are proud to announce the release of D++ 10.1.5, which is a focused maintenance and quality-of-life release, bringing a mixture of new API coverage, stability improvements, and internal clean-ups across the board. This update adds new API features such as guild message search support and the missing BYPASS_SLOWMODE permission bit, while also resolving several voice, coroutine, and HTTP edge-case issues reported by the community.
The changelog is listed below:
Release Changelog
✨ New Features
- Add guild messages search endpoint (#1565)
- Add missing
BYPASS_SLOWMODEpermission (bit 52) (#1562) - Added
get_pathtohttp_server_requestso that the user can get the request path (#1552) - Added
DPP_EXPORTtobignum.hbn_deleterstruct (#1542)
🐞 Bug Fixes
- 100% busy main thread while bot is not playing audio in vc (#1578)
- Coro: fix an issue with coroutine lambdas with captures with
cluster::start_timer(#1576) - Fix connection issue when user force move bot to another channel (#1554)
- Fix hang when sending HTTP request with empty token and non-empty logger (#1543)
- Resolve warnings during build (#1532)
- Poll vote events and add missing poll intents (#1525)
♻️ Refactoring
- Corrected ColourReset to be the correct Ansi sequence, added
colour.cmaketo the documentation tests (#1577) - Fix typos and suppress unhandled
VOICE_CHANNEL_START_TIME_UPDATEevent (#1561)
📜 Miscellaneous Changes
- Wait for http request completion with condition variable (#1524)
Thank you for using D++!
- v10.1.4v10.1.4 release2025-12-17 · 2025-12-17 17:17 UTC
查看更新说明
D++ 10.1.4: Modal Power
D++ 10.1.4 is a refinement release that brings improved stability, better API coverage and meaningful quality-of-life upgrades. While there are a couple of small breaking changes, this release is largely about tightening loose ends and expanding Discord feature parity.
- Modal interactions receive a substantial boost. This release adds text display support and additional component types.
- Server tags are now supported, missing permissions have been filled in, and member editing has expanded to include banners, avatars, and bios.
- DAVE is now enabled by default for all voice. You can disable it, but be aware it will be mandatory as of Q1 2026.
- REST request dispatch no longer stalls when using
poll.
The changelog is listed below:
Release Changelog
💣 Breaking Changes
- Added fallback to component receiving (#1516)
- Rewrote
channel_get_pins, added Pin Message permission, updated pin endpoints. (#1480)
✨ New Features
- Added text display support to modal (#1515)
- Added more components to modal (#1514)
- Added missing permissions (#1501)
- Current Member Edit now supports banner, avatar and bio (#1502)
- DAVE is now default enabled. (#1500)
- Added
channel_invites_getto unit tests (#1499) - Added a handler for the Voice Channel Effect Send event (#1488)
- Server tags support (#1477)
- Add field
attachment_size_limittodpp::interaction(#1478)
🐞 Bug Fixes
- Fix segfault in
dpp::taskon g++ starting with 15.2 (gcc-mirror/gcca169a4718b5b621f1770789e55eb8c441f7d0fcd specifically) (#1512) dpp::cluster::register_commandwith coroutine handler on Windows (#1504)- Coro autogen now works again (#1503)
- Fix D++ from stalling for a second before sending REST requests using poll. (#1485)
- Get rid of poll macro (#1468)
- Fix
user::get_avatar_decoration_url()and parsing of the field (#1462)
♻️ Refactoring
- Async: Modernize coroutine helpers and add
follow_upfunctions (#1467)
📜 Miscellaneous Changes
- Replacing the const
uint32_tcolor values with static constexpr uint3… (#1520) - Replace
shared_ptrin bignum withunique_ptr(#1518) channel_invites_getincorrect endpoint (#1497)- Attempt a full reconnection when a resume attempt failed. (#1465)
👷 Build/CI
- Cpack now runs on g++13 instead of g++10 (#1483)
Thank you for using D++!
- v10.1.3v10.1.3 release2025-07-07 · 2025-07-07 10:22 UTC
查看更新说明
D++ 10.1.3 is here!
This update mainly smooths out edge cases for Windows bot, especially fixing a reconnect loop that could leave your bot stuck retrying forever after certain websocket disconnects. If you’ve ever seen that on Windows, this one’s for you.
One important note: GitHub no longer provides VS2019, so we can’t ship VS2019 prebuilt zips anymore. Only VS2022 builds are provided now. If you want to use D++ in VS2019, you need to build it yourself from source.
You’ll also find a new way to declare complex component groups, allowing you to design them on sites like discord.builders, and the usual round of small fixes to keep things running smooth.
The changelog is listed below:
Release Changelog
✨ New Features
- Support for pre-generated component json, in the same way we support pre-generated embed json (#1427)
- Implement event webhook fields in
dpp::applicationclass (#1425) - Add
avatar_urloverride for webhook struct, resolves #1416 (#1419)
🐞 Bug Fixes
- Socket readiness fixes for Windows, doesnt get stuck in reconnect loops any more (#1461)
- Add thread safety primitives to internal shard list (#1436)
- Breaking: voice connect doesnt break after a shard reconnect (#1435)
- Json parsing issues with string arrays in
dpp::application(#1426) - Fix tests build on Windows (#1414)
- Coro: fix
when_anywhen an awaitable is already finished beforeco_await(#1415)
♻️ Refactoring
- Improve socket error messages on Windows
- Make method and path in
http_server_requestprotected instead of private (#1423)
📚 Documentation
SORT_BRIEF_DOCS=YES (#1421)
📜 Miscellaneous Changes
- Persist and move the voice connections on shard reconnection. (#1449)
- In case of failure to initialise
discord_client, null the ptr - Execute
on_stopcallback of all timers on bot shutdown (#1424) - Require c++17 (#1404)
👷 Build/CI
- Remove vs2019 from release and actions (#1459)
- Only check changed files with npx cspell lint (#1437)
- Update armv6 build to ubuntu 24.04, remove clang-10 (#1420)
- Fix
DPP_NO_COROfromDPP_COROand explicitly set where we know it isn't supported (#1406)
Thank you for using D++!
- v10.1.2v10.1.2 release2025-03-20 · 2025-03-20 22:15 UTC
查看更新说明
We are happy to announce the release of D++ 10.1.2! This release is primarily a bugfix release. For very small bots with little activity, you may find that reconnections stop working in 10.1.1. If this bug effects you, you should upgrade to 10.1.2. This version also has improvements to performance of SSL handshakes which you will notice at scale.
The changelog is listed below:
Release Changelog
:sparkles: New Features
• Add
TCP_NODELAYto connections to speed up SSL handshakes (#1403):lady_beetle: Bug Fixes
• Timers stop firing if the reactor has no sockets, only happens on bots that have little activity (#1401)
♻️ Refactoring
• Better error reporting for failed ssl contexts (#1402)
Thank you for using D++!
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
D++ is a lightweight and efficient library for Discord written in modern C++, covering as much of the API specification as possible with an incredibly small memory footprint even when caching large amounts of data.
Library Features
- Support for Discord API v10
- Really small memory footprint
- Efficient caching system for guilds, channels, guild members, roles, users
- Sharding and clustering (Many shards, one process: specify the number of shards, or let the library decide)
- Highly optimised ETF (Erlang Term Format) support for very fast websocket throughput
- Slash Commands/Interactions support
- Voice support (sending and receiving audio) with DAVE End-To-End Encryption
- The entire Discord API is available for use in the library
- Stable Windows support
- Ready-made compiled packages for Windows, Raspberry Pi (ARM64/ARM7/ARMv6), Debian x86/x64, and RPM based distributions
- Highly scalable for large amounts of guilds and users
Want to help? Drop me a line or send a PR.
This library is in use on TriviaBot and Sporks bot and many other bots!
📚 Documentation
The documentation is constantly evolving and improving, generated from the code comments and markdown examples using Doxygen.
View the D++ library documentation
Example
This is a simple ping-pong example using slash commands.
#include <dpp/dpp.h>
#include <cstdlib>
int main() {
dpp::cluster bot(std::getenv("BOT_TOKEN"));
bot.on_slashcommand([](auto event) {
if (event.command.get_command_name() == "ping") {
event.reply("Pong!");
}
});
bot.on_ready([&bot](auto event) {
if (dpp::run_once<struct register_bot_commands>()) {
bot.global_command_create(
dpp::slashcommand("ping", "Ping pong!", bot.me.id)
);
}
});
bot.start(dpp::st_wait);
return 0;
}
You can find more examples in our example page.
💻 Supported Systems
We support the following OS families, as long as they are still officially supported by their provider. We will provide no support for operating systems past end-of-life.
Linux
The library runs ideally on Linux.
Mac OS X, FreeBSD, and OpenBSD
The library is well-functional and stable on Mac OS X, FreeBSD, and OpenBSD too!
Raspberry Pi
For running your bot on a Raspberry Pi, we offer a prebuilt .deb package for ARM64, ARM6, and ARM7 so that you do not have to wait for it to compile.
Windows
Windows is well-supported with ready-made compiled DLL and LIB files, please check out our Windows Bot Template repository. The Windows Bot repository can be cloned and integrated immediately into any Visual Studio 2019 and 2022 project in a matter of minutes.
Other OS
The library should work fine on other operating systems as well, and if you run a D++ bot on something not listed here, please let us know!
🔰 Getting Started
Installation
D++ can be easily installed using various package managers. Please refer to our documentation for installation tutorials based on your preferred package manager.
Building from Source
If you prefer to build the library from source, detailed instructions are available here.
FAQ
For frequently asked questions and their answers, please visit our FAQ page.
Nightly Builds
If you prefer to use Nightly Builds (This is only if you know what you are doing!) then you can use either our master nightly builds or our dev nightly builds.
🤝 Contributing
Contributions, issues and feature requests are welcome. After cloning and setting up the project locally, you can just submit a PR to this repo and it will be deployed once it's accepted.
Please read the D++ Code Style Guide for more information on how we format pull requests.
💬 Get in touch
If you have various suggestions, questions or want to discuss things with our community, Join our discord server! Make a humorous reference to brains in your nickname to get access to a secret brain cult channel! :)
💕 Show your support
We love people's support in growing and improving. Be sure to leave a ⭐️ if you like the project and also be sure to contribute, if you're interested!
📂 Dependencies
Build requirements
- cmake (version 3.13+)
- A supported C++ compiler from the list below
Supported compilers
- g++ (version 8 or higher)
- clang (version 6 or higher)
- AppleClang (12.0 or higher)
- Microsoft Visual Studio 2019 or 2022 (16.x/17.x)
- clang-cl (version 15 or higher)
Other compilers may work (either newer versions of those listed above, or different compilers entirely) but have not been tested by us.
External Dependencies (You must install these)
- OpenSSL (For HTTPS, will use whichever
-devpackage comes with your OS) - zlib (For websocket compression, will use whichever
-devpackage comes with your OS)
Optional Dependencies
For voice support you require:
- libopus (For audio encoding/decoding)
- Note that our windows zips come packaged with copies of this library - you do not need to install it yourself!
Included Dependencies (Packaged with the library)
- JSON for Modern C++ (You can bring your own nlohmann::json into D++ by setting a CMAKE flag)
- MLS++ (This is statically compiled into the library if voice support is enabled)