D++ (DPP)
C++ Discord API Bot Library
|
sudo
, along with make install
. You will need sudo
installed if you are not the root user.Since the project uses CMake
, you'll need to install it! If you don't have it, you can do the following:
If you wish to use voice support, you'll need to install opus and libsodium:
First, you need to install opus.
Then, you need to install libsodium.
Replace the number after -j
with a number suitable for your setup, usually the same as the number of cores on your machine. cmake
will fetch any dependencies that are required for you and ensure they are compiled alongside the library.
If you want to install the library, its dependencies and header files to a different directory, specify this directory when running cmake
:
Then once the build is complete, run sudo make install
to install to the location you specified.
Once installed, you can make use of the library in standalone programs simply by including it and linking to it:
The important flags in this command-line are:
-std=c++17
- Required to compile the headers-L/usr/local/lib
- Required to tell the linker where libdpp is located.-I/usr/local/include
- Required to tell the linker where dpp headers are located.-ldpp
- Link to libdpp.so
.bot.cpp
- Your source code.-o dppbot
- The name of the executable to make.g++
command is not advised in any real project, and the example above should be used only as a test. From here, you should learn to create a bot in D++ by moving on to Building a Discord Bot Using CMake (UNIX) or if you have not yet created a token for your bot, Creating a Bot Token - If you are having trouble setting up CMake, you can try our template cmake bot project.Have fun!