A template for a bot, written in C++ using DiscordCoreAPI.
- Make sure you've run
vcpkg integrate install
. - Set the
VCPKG_ROOT_DIR
in CMakeLists.txt to the root directory of your VCPKG installation, and make sure you've installed DiscordCoreAPI with it - then start up a project in your IDE, set the C++ standard to 20 or newer, and#include <discordcoreapi/Index.hpp>
. Add main.cpp to it. - Run in a terminal from within the same folder as the top-level CMakeLists.txt,
cmake -S . --preset Windows_OR_Linux_Debug_OR_Release
. - Then run
cmake --build --preset Windows_OR_Linux_Debug_OR_Release
. - Run within the same terminal and folder
cmake --install ./Build/Debug_OR_Release
. The default installation paths are: Windows = "ROOT_DRIVE:/Users/USERNAME/CMake/Bot-Template-For-DiscordCoreAPI", Linux = "/home/USERNAME/CMake/Bot-Template-For-DiscordCoreAPI", although you can change this by setting CMAKE_INSTALL_PREFIX in CMakeLists.txt.
- Build and install the dependencies.
- Build and install the DiscordCoreAPI library with CMAKE.
- Set, in CMakeLists.txt, the
<DEPENDENCY>_INCLUDE_DIR
,<DEPENDENCY>_DEBUG_ROOT
and<DEPENDENCY>_RELEASE_ROOT
paths to wherever each of the respective dependencies are located - setting the<DEPENDENCY>_DEBUG_ROOT
folder to wherever the debug version of the .lib file is, the<DEPENDENCY>_RELEASE_ROOT
folder to wherever the release version of the .lib file for the library is, and the<DEPENDENCY>_INCLUDE_DIR
to whichever directory contains the public headers for the library. - Set, in CMakeLists.txt, the
CMAKE_CONFIG_FILE_DIR
to whichever directory contains the DiscordCoreAPIConfig.cmake file that was created by the installation phase of building the library. - Run in a terminal from within the same folder as the top-level CMakeLists.txt,
cmake -S . --preset Windows_OR_Linux_Debug_OR_Release
. - Then run
cmake --build --preset Windows_OR_Linux_Debug_OR_Release
. - Run within the same terminal and folder
cmake --install ./Build/Debug_OR_Release
. The default installation paths are: Windows = "ROOT_DRIVE:/Users/USERNAME/CMake/Bot-Template-For-DiscordCoreAPI", Linux = "/home/USERNAME/CMake/Bot-Template-For-DiscordCoreAPI", although you can change this by setting CMAKE_INSTALL_PREFIX in CMakeLists.txt.