Compare commits
18
Commits
2acba97173
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26c5d83507 | ||
|
|
686fe4247c | ||
|
|
82005881c7 | ||
|
|
5e91d8977d | ||
|
|
e28f17e513 | ||
|
|
b80dd23611 | ||
|
|
c1644f1787 | ||
|
|
cff523c45b | ||
|
|
f46d7065f1 | ||
|
|
b1dd8e8396 | ||
|
|
b3fa8a6df7 | ||
|
|
5da6d610b1 | ||
|
|
4451bc3ff6 | ||
|
|
e750ead7b2 | ||
|
|
97df4330f3 | ||
|
|
ab41d81b2d | ||
|
|
01ee26b0f7 | ||
|
|
b2bab16422 |
+1
-2
@@ -143,7 +143,7 @@ BreakFunctionDefinitionParameters: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakStringLiterals: true
|
||||
BreakTemplateDeclarations: Yes
|
||||
ColumnLimit: 80
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: "^ IWYU pragma:"
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
@@ -355,4 +355,3 @@ WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
WrapNamespaceBodyWithEmptyLines: Leave
|
||||
...
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*.zim filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -24,7 +24,8 @@ jobs:
|
||||
run: sudo apt update
|
||||
|
||||
- name: Installing build chain
|
||||
run: sudo apt-get install pigz cmake ninja-build g++ clang pkg-config libssl-dev zlib1g-dev libopus-dev -y;
|
||||
run: sudo apt-get install pigz cmake ninja-build g++ clang pkg-config libssl-dev
|
||||
zlib1g-dev libopus-dev -y;
|
||||
|
||||
- name: Cache CPM
|
||||
uses: actions/cache@v5
|
||||
@@ -33,22 +34,24 @@ jobs:
|
||||
key: ${{ runner.os }}-CPM
|
||||
|
||||
- name: Configure debug
|
||||
run: cd scripts; CPM_SOURCE_CACHE="~/.cache/CPM/" ./configure-debug.sh
|
||||
run: CPM_SOURCE_CACHE="~/.cache/CPM/" ./scripts/build_script configure -b debug
|
||||
|
||||
- name: Configure release
|
||||
run: cd scripts; CPM_SOURCE_CACHE="~/.cache/CPM/" ./configure-release.sh
|
||||
run: CPM_SOURCE_CACHE="~/.cache/CPM/" ./scripts/build_script configure -b
|
||||
release
|
||||
|
||||
- name: Configure RelWithDeb
|
||||
run: cd scripts; CPM_SOURCE_CACHE="~/.cache/CPM/" ./configure-relwithdeb.sh
|
||||
run: CPM_SOURCE_CACHE="~/.cache/CPM/" ./scripts/build_script configure -b
|
||||
relwithdeb
|
||||
|
||||
- name: Build debug
|
||||
run: cd scripts; ./build-debug.sh
|
||||
run: ./scripts/build_script build -b debug
|
||||
|
||||
- name: Build release
|
||||
run: cd scripts; ./build-release.sh
|
||||
run: ./scripts/build_script build -b release
|
||||
|
||||
- name: Build Release with debug info
|
||||
run: cd scripts; ./build-relwithdeb.sh
|
||||
run: ./scripts/build_script build -b relwithdeb
|
||||
|
||||
- name: Packaging
|
||||
run: |-
|
||||
|
||||
@@ -2,3 +2,4 @@ build/
|
||||
.cache
|
||||
bin
|
||||
.env
|
||||
.idea
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": []
|
||||
}
|
||||
Vendored
+136
-16
@@ -1,20 +1,21 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Configure: Debug",
|
||||
"type": "shell",
|
||||
"command": "cd scripts; ./configure-debug.sh",
|
||||
"group": {
|
||||
"isDefault": false
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"detail": "Configure Debug"
|
||||
},
|
||||
{
|
||||
"label": "Build: Debug",
|
||||
"type": "shell",
|
||||
"command": "cd scripts; ./build-debug.sh",
|
||||
"command": "./scripts/build_script build -b debug",
|
||||
"windows": {
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' build -b debug"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -22,10 +23,42 @@
|
||||
"problemMatcher": [],
|
||||
"detail": "Build Debug"
|
||||
},
|
||||
{
|
||||
"label": "Configure: Debug",
|
||||
"type": "shell",
|
||||
"command": "./scripts/build_script configure -b debug",
|
||||
"windows": {
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' configure -b debug"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"isDefault": false
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"detail": "Configure Debug"
|
||||
},
|
||||
{
|
||||
"label": "Configure: Relwithdeb",
|
||||
"type": "shell",
|
||||
"command": "cd scripts; ./configure-relwithdeb.sh",
|
||||
"command": "./scripts/build_script configure -b relwithdeb",
|
||||
"windows": {
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' configure -b relwithdeb"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"isDefault": false
|
||||
},
|
||||
@@ -35,7 +68,18 @@
|
||||
{
|
||||
"label": "Build: Relwithdeb",
|
||||
"type": "shell",
|
||||
"command": "cd scripts; ./build-relwithdeb.sh",
|
||||
"command": "./scripts/build_script build -b relwithdeb",
|
||||
"windows": {
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' build -b relwithdeb"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -43,10 +87,64 @@
|
||||
"problemMatcher": [],
|
||||
"detail": "Build Release with debug info"
|
||||
},
|
||||
{
|
||||
"label": "Configure: Release",
|
||||
"type": "shell",
|
||||
"command": "./scripts/build_script configure -b release",
|
||||
"windows": {
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' configure -b release"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"isDefault": false
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"detail": "Configure Release"
|
||||
},
|
||||
{
|
||||
"label": "Build: Release",
|
||||
"type": "shell",
|
||||
"command": "./scripts/build_script build -b release",
|
||||
"windows": {
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' build -b release"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"detail": "Build Release"
|
||||
},
|
||||
{
|
||||
"label": "Clean: Debug",
|
||||
"type": "shell",
|
||||
"command": "cd build/debug; ninja clean",
|
||||
"command": "./scripts/build_script clean -b debug",
|
||||
"windows": {
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' clean -b debug"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"isDefault": false
|
||||
},
|
||||
@@ -55,7 +153,18 @@
|
||||
{
|
||||
"label": "Build: All",
|
||||
"type": "shell",
|
||||
"command": "cd scripts; ./build.sh",
|
||||
"command": "./scripts/build_script build",
|
||||
"windows": {
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' build"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -66,7 +175,18 @@
|
||||
{
|
||||
"label": "Clean: All",
|
||||
"type": "shell",
|
||||
"command": "cd scripts; ./clean.sh",
|
||||
"command": "./scripts/build_script clean",
|
||||
"windows": {
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-NoProfile",
|
||||
"-Command",
|
||||
"& './scripts/build_script.exe' clean"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"isDefault": false
|
||||
},
|
||||
|
||||
@@ -4,6 +4,8 @@ set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
file(GLOB REQUIRED_CMAKE_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.cmake.required"
|
||||
)
|
||||
@@ -11,10 +13,45 @@ foreach(cmake_file ${REQUIRED_CMAKE_FILES})
|
||||
include(${cmake_file})
|
||||
endforeach()
|
||||
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/opus.cmake")
|
||||
file(GLOB CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.cmake")
|
||||
foreach(cmake_file ${CMAKE_FILES})
|
||||
include(${cmake_file})
|
||||
endforeach()
|
||||
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_compile_options(dpp PRIVATE -fpermissive)
|
||||
endif ()
|
||||
|
||||
set(CMAKE_FOLDER "00-project")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/00_project")
|
||||
|
||||
set(CMAKE_FOLDER "01-basics")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/01_basics/01_first_bot")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/01_basics/02_embeds")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/01_basics/03_private_messages")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/01_basics/04_adding_files")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/01_basics/05_webhooks")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/01_basics/06_callbacks")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/01_basics/07_cache")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/01_basics/08_listening_to_messages")
|
||||
|
||||
set(CMAKE_FOLDER "02-interactions")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/01_slash_cmds/01_using_slash_cmds")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/01_slash_cmds/02_clearing_registered_cmds")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/01_slash_cmds/03_subcommands")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/01_slash_cmds/04_autocompletion")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/01_slash_cmds/05_file_parameters")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/01_slash_cmds/06_cmd_handler")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/02_ephemeral_replies")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/03_user_apps")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/04_resolved_objects")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/05_msg_components/01_btn")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/05_msg_components/02_advanced_btn")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/05_msg_components/03_select_menu")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/05_msg_components/04_select_menu_advanced")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/05_msg_components/05_editing_msg_from_btn")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/05_msg_components/06_components_v2")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/06_modals")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/07_context_menus")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/02_interactions_and_components/08_thinking")
|
||||
|
||||
@@ -6,7 +6,7 @@ This repo is a collection of examples for dpp, a cpp discord library.
|
||||
|
||||
The majority of the examples have come from [these docs](https://dpp.dev/example-programs.html).
|
||||
This repo more or less exists for me to learn how the library works through following the docs as well as to keep all the examples in one place for others to find and learn from.
|
||||
With that all in mind, I've gone through and add comments *after* going through the doc page into the example itself.
|
||||
With that all in mind, I've gone through and added comments *after* going through the doc page into the example itself.
|
||||
This is mostly for me to reiterate over the code to better understand it and put it into my own words, but should also serve as a fairly quick reference to how and what is going on for those wanting to learn without a bunch of reading.
|
||||
|
||||
The docs themselves contain a lot lot more information then what I have put into comments, so if you're stuck or want to know more, make sure you check them out.
|
||||
@@ -97,9 +97,7 @@ A "build" and a "bin" folder.
|
||||
*Note: the bin folder will only exist on unix based systems (Linux, MacOS, etc)*
|
||||
The "build" folder will contain all of your build intermediaries.
|
||||
"Bin" will contain your actual executables.
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
```
|
||||
root
|
||||
├── build
|
||||
@@ -108,9 +106,6 @@ root
|
||||
│ ├── Release
|
||||
│ └── Relwithdeb
|
||||
```
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
CPMAddPackage(
|
||||
URI "gh:brainboxdotcc/DPP@10.1.5"
|
||||
URI "gh:brainboxdotcc/DPP@10.1.6"
|
||||
OPTIONS "BUILD_VOICE_SUPPORT ON"
|
||||
OPTIONS "RUN_LDCONFIG OFF"
|
||||
OPTIONS "DPP_INSTALL OFF"
|
||||
@@ -7,5 +7,4 @@ CPMAddPackage(
|
||||
OPTIONS "DPP_NO_VCPKG ON"
|
||||
OPTIONS "DPP_NO_CONAN ON"
|
||||
OPTIONS "DPP_FORMATTERS ON"
|
||||
OPTIONS "DPP_USE_PCH ON"
|
||||
)
|
||||
OPTIONS "DPP_USE_PCH ON")
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
CPMAddPackage(
|
||||
URI "gh:xiph/opus@1.5.2"
|
||||
)
|
||||
|
||||
if(opus_ADDED)
|
||||
get_target_property(OPUS_INCLUDE_DIRS opus INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(OPUS_LIBRARIES opus)
|
||||
set(HAVE_OPUS_OPUS_H TRUE)
|
||||
set(Opus_FOUND TRUE)
|
||||
set(OPUS_FOUND TRUE)
|
||||
endif()
|
||||
@@ -1,8 +0,0 @@
|
||||
#/bin/bash
|
||||
|
||||
cd ..
|
||||
mkdir -p build
|
||||
cd build
|
||||
mkdir -p debug
|
||||
cd debug
|
||||
ninja
|
||||
@@ -1,8 +0,0 @@
|
||||
#/bin/bash
|
||||
|
||||
cd ..
|
||||
mkdir -p build
|
||||
cd build
|
||||
mkdir -p release
|
||||
cd release
|
||||
ninja
|
||||
@@ -1,8 +0,0 @@
|
||||
#/bin/bash
|
||||
|
||||
cd ..
|
||||
mkdir -p build
|
||||
cd build
|
||||
mkdir -p relwithdeb
|
||||
cd relwithdeb
|
||||
ninja
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ../
|
||||
mkdir -p build
|
||||
cd build || exit
|
||||
mkdir -p debug
|
||||
mkdir -p release
|
||||
mkdir -p relwithdeb
|
||||
|
||||
cd debug || exit
|
||||
cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=Debug &
|
||||
cd ../
|
||||
cd release || exit
|
||||
cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=Release &
|
||||
cd ../
|
||||
cd relwithdeb || exit
|
||||
cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo &
|
||||
cd ../
|
||||
|
||||
wait
|
||||
|
||||
cd debug || exit
|
||||
ninja &
|
||||
cd ../
|
||||
cd release || exit
|
||||
ninja &
|
||||
cd ../
|
||||
cd relwithdeb || exit
|
||||
ninja &
|
||||
cd ../..
|
||||
|
||||
wait
|
||||
Executable
BIN
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ..
|
||||
cd build/debug || exit
|
||||
ninja clean
|
||||
|
||||
cd ..
|
||||
cd release || exit
|
||||
ninja clean
|
||||
|
||||
cd ..
|
||||
cd relwithdeb || exit
|
||||
ninja clean
|
||||
@@ -1,8 +0,0 @@
|
||||
#/bin/bash
|
||||
|
||||
cd ..
|
||||
mkdir -p build
|
||||
cd build
|
||||
mkdir -p debug
|
||||
cd debug
|
||||
cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
||||
@@ -1,8 +0,0 @@
|
||||
#/bin/bash
|
||||
|
||||
cd ..
|
||||
mkdir -p build
|
||||
cd build
|
||||
mkdir -p release
|
||||
cd release
|
||||
cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||
@@ -1,8 +0,0 @@
|
||||
#/bin/bash
|
||||
|
||||
cd ..
|
||||
mkdir -p build
|
||||
cd build
|
||||
mkdir -p relwithdeb
|
||||
cd relwithdeb
|
||||
cmake ../../ -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
@@ -6,9 +6,19 @@
|
||||
|
||||
int main() {
|
||||
dotenv::init();
|
||||
if (!std::getenv("DISCORD_TOKEN")) {
|
||||
std::cout << "Failed to find DISCORD_TOKEN in .env or environment" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (!std::getenv("DISCORD_WEBHOOK")) {
|
||||
std::cout << "Failed to find DISCORD_WEBHOOK in .env or environment" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
const std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
const std::string whURL = std::getenv("DISCORD_WEBHOOK");
|
||||
|
||||
std::cout << "Using dpp version: " << dpp::utility::version() << std::endl;
|
||||
std::cout << "Loaded DISCORD_TOKEN: " << std::getenv("DISCORD_TOKEN")
|
||||
<< std::endl;
|
||||
std::cout << "Loaded DISCORD_TOKEN: " << botToken << std::endl;
|
||||
std::cout << "Loaded DISCORD_WEBHOOK: " << whURL << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,14 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
// Load in the .env file into the environment
|
||||
// Load the .env file into the environment
|
||||
dotenv::init();
|
||||
// Make sure the DISCORD_TOKEN was loaded
|
||||
if (!std::getenv("DISCORD_TOKEN")) {
|
||||
std::cout << "Failed to load the discord token from .env or the environment" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Get the bot token
|
||||
std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
std::cout << "Using discord bot token: " << botToken << std::endl;
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "01_02_embeds")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,83 @@
|
||||
#include <cluster.h>
|
||||
#include <colors.h>
|
||||
#include <dispatcher.h>
|
||||
#include <dotenv/dotenv.h>
|
||||
#include <dpp/dpp.h>
|
||||
#include <message.h>
|
||||
#include <once.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
int main() {
|
||||
// Load the .env file into the environment
|
||||
dotenv::init();
|
||||
// Check to make sure the token was loaded
|
||||
if (!std::getenv("DISCORD_TOKEN")) {
|
||||
std::cout << "Failed to load the discord token from .env or the environment" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Load in the token
|
||||
std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
|
||||
// Create a bot cluster
|
||||
dpp::cluster bot(botToken);
|
||||
|
||||
// Set the bot logging callback to a default cout logger
|
||||
bot.on_log(dpp::utility::cout_logger());
|
||||
|
||||
// Set the slashcommand callback
|
||||
bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
|
||||
// Filter the slashcommand by name
|
||||
if (event.command.get_command_name() == "embed") {
|
||||
// Create the embed object
|
||||
dpp::embed embed =
|
||||
dpp::embed()
|
||||
// Set the color of the embed
|
||||
// This sets the color of the line
|
||||
// on the left side
|
||||
.set_color(dpp::colors::sti_blue)
|
||||
// Set the title
|
||||
.set_title("Title")
|
||||
// Set the title url
|
||||
.set_url("https://dpp.dev")
|
||||
// Set the author info
|
||||
.set_author("Firewire", "https://dpp.dev", "https://dpp.dev/DPP-Logo.png")
|
||||
.set_description("Description")
|
||||
// Set the thumbnail, this is a small image off the right
|
||||
.set_thumbnail("https://dpp.dev/DPP-Logo.png")
|
||||
// Add some regular and inline fields
|
||||
.add_field("Regular field title", "Value")
|
||||
.add_field("Inline field title", "Value", true)
|
||||
.add_field("Inline field title", "Value", true)
|
||||
// Set the main image, this will be the center large image
|
||||
.set_image("https://dpp.dev/DPP-Logo.png")
|
||||
// Set the footer
|
||||
.set_footer(dpp::embed_footer().set_text("Footer text").set_icon("https://dpp.dev/DPP-Logo.png"))
|
||||
// Add a timestamp,
|
||||
// time(<arg>) returns a timer of <arg> seconds
|
||||
// using a 0 for the arg just returns the current time
|
||||
.set_timestamp(time(0));
|
||||
|
||||
// Create a message using the embed
|
||||
dpp::message msg(event.command.channel_id, embed);
|
||||
// Send the message as a reply
|
||||
event.reply(msg);
|
||||
}
|
||||
});
|
||||
|
||||
// Set the bot on_ready to create a the global commands
|
||||
bot.on_ready([&bot](const dpp::ready_t& event) {
|
||||
// Only run the register_bot_commands once
|
||||
// (If the bot is disconnected from the discord gateway,
|
||||
// on_ready() is called once reconnected.
|
||||
// We dont want to re-register when this happens)
|
||||
if (dpp::run_once<struct register_bot_commands>()) {
|
||||
bot.global_command_create(dpp::slashcommand("embed", "Send an embed", bot.me.id));
|
||||
}
|
||||
});
|
||||
|
||||
// Start the bot
|
||||
bot.start(dpp::st_wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "01_03_private_messages")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,99 @@
|
||||
#include <appcommand.h>
|
||||
#include <cluster.h>
|
||||
#include <dispatcher.h>
|
||||
#include <dotenv/dotenv.h>
|
||||
#include <dpp/dpp.h>
|
||||
#include <message.h>
|
||||
#include <once.h>
|
||||
#include <restresults.h>
|
||||
#include <snowflake.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
int main() {
|
||||
// Load in the .env file
|
||||
dotenv::init();
|
||||
// Check to make sure the token was loaded
|
||||
if (!std::getenv("DISCORD_TOKEN")) {
|
||||
std::cout << "Failed to load the discord token from .env or the environment" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Load in the token into a string
|
||||
std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
|
||||
// Create the bot
|
||||
dpp::cluster bot(botToken);
|
||||
|
||||
// Setup a default cout_logger
|
||||
bot.on_log(dpp::utility::cout_logger());
|
||||
|
||||
// Setup a lamda for the on_slashcommand
|
||||
bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
|
||||
// Filter for the /pm slashcommand
|
||||
if (event.command.get_command_name() == "pm") {
|
||||
// Discord stores all objects through a reference called a
|
||||
// "snowflake"
|
||||
dpp::snowflake user;
|
||||
|
||||
if (event.get_parameter("user").index() == 0) {
|
||||
// If the user parameter wasn't passed, just get the user that
|
||||
// issued the command
|
||||
user = event.command.get_issuing_user().id;
|
||||
} else {
|
||||
// Get the value of the user parameter
|
||||
user = std::get<dpp::snowflake>(event.get_parameter("user"));
|
||||
}
|
||||
|
||||
// Create a direct message
|
||||
bot.direct_message_create(
|
||||
// Define the user you're sending the message to, aswell as the
|
||||
// message
|
||||
user, dpp::message("Here's a private message!"),
|
||||
// Once the request has been sent to discord, a callback can be
|
||||
// specified to handle any errors or anything related to the
|
||||
// message
|
||||
[event, user](const dpp::confirmation_callback_t& callback) {
|
||||
// Check to make sure there wasnt an error sending the
|
||||
// message
|
||||
if (callback.is_error()) {
|
||||
// Reply back with a message saying the direct message
|
||||
// failed to send
|
||||
if (user == event.command.get_issuing_user().id) {
|
||||
event.reply(dpp::message("I couldnt send you a message.").set_flags(dpp::m_ephemeral));
|
||||
} else {
|
||||
event.reply(dpp::message("I couldnt send a message to that user. "
|
||||
"Please check that is a valid user.")
|
||||
.set_flags(dpp::m_ephemeral));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// In the case the direct message was able to be sent, send
|
||||
// a confirmation message
|
||||
if (user == event.command.get_issuing_user().id) {
|
||||
event.reply(dpp::message("I've sent you a private message").set_flags(dpp::m_ephemeral));
|
||||
} else {
|
||||
event.reply(
|
||||
dpp::message("I've sent a private message to that user.").set_flags(dpp::m_ephemeral));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Define a callback for the on_ready
|
||||
bot.on_ready([&bot](const dpp::ready_t& event) {
|
||||
if (dpp::run_once<struct register_bot_commands>()) {
|
||||
// Create the /pm slashcommand
|
||||
dpp::slashcommand command("pm", "Send a private message.", bot.me.id);
|
||||
// Add the "user" option to the command
|
||||
command.add_option(dpp::command_option(dpp::co_mentionable, "user", "The user to message", false));
|
||||
// Register the command with discord
|
||||
bot.global_command_create(command);
|
||||
}
|
||||
});
|
||||
|
||||
// Start the bot
|
||||
bot.start(dpp::st_wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "01_04_adding_files")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,102 @@
|
||||
#include <appcommand.h>
|
||||
#include <cluster.h>
|
||||
#include <dispatcher.h>
|
||||
#include <dotenv/dotenv.h>
|
||||
#include <dpp.h>
|
||||
#include <once.h>
|
||||
#include <queues.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
// Load the .env file into the environment
|
||||
dotenv::init();
|
||||
// Make sure the DISCORD_TOKEN was loaded in
|
||||
if (!std::getenv("DISCORD_TOKEN")) {
|
||||
std::cout << "Failed to load the discord token from .env or the environment" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Load in the token
|
||||
std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
|
||||
// Create the bot
|
||||
dpp::cluster bot(botToken);
|
||||
|
||||
// Setup on_log to use a default cout_logger
|
||||
bot.on_log(dpp::utility::cout_logger());
|
||||
|
||||
bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
|
||||
if (event.command.get_command_name() == "file") {
|
||||
// Create the message
|
||||
dpp::message msg(event.command.channel_id, "Hey there, I've got a file for you!");
|
||||
// Add the "README.md" file to the message
|
||||
msg.add_file("README.md", dpp::utility::read_file("README.md"));
|
||||
// Send the message
|
||||
event.reply(msg);
|
||||
}
|
||||
|
||||
// Handle the external command
|
||||
if (event.command.get_command_name() == "external") {
|
||||
bot.request("https://dpp.dev/DPP-Logo.png", dpp::m_get,
|
||||
[event](const dpp::http_request_completion_t& httpRequestCompletion) {
|
||||
// Create the message
|
||||
dpp::message msg(event.command.channel_id, "Heres an external image!");
|
||||
// Make sure the http request was completed
|
||||
if (httpRequestCompletion.status == 200) {
|
||||
// Add the body of the request to the msg
|
||||
msg.add_file("logo.png", httpRequestCompletion.body);
|
||||
}
|
||||
// Send the message
|
||||
event.reply(msg);
|
||||
});
|
||||
}
|
||||
|
||||
// Handle the embed command
|
||||
if (event.command.get_command_name() == "embed") {
|
||||
bot.request("https://dpp.dev/DPP-Logo.png", dpp::m_get,
|
||||
[event](const dpp::http_request_completion_t& httpRequestCompletion) {
|
||||
// Create the message
|
||||
dpp::message msg(event.command.channel_id, "");
|
||||
// Make sure the http request completed
|
||||
if (httpRequestCompletion.status == 200) {
|
||||
// Add the file to the message
|
||||
msg.add_file("logo.png", httpRequestCompletion.body);
|
||||
// Create the embed
|
||||
dpp::embed embed;
|
||||
// Set the image for the embed as the image
|
||||
// added above
|
||||
embed.set_image("attachment://logo.png");
|
||||
// Add the embed to the message
|
||||
msg.add_embed(embed);
|
||||
}
|
||||
// Send the message
|
||||
event.reply(msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
bot.on_ready([&bot](const dpp::ready_t& event) {
|
||||
if (dpp::run_once<struct register_bot_commands>()) {
|
||||
// Create and register the file command
|
||||
// This command will send a copy of the README.md file in the root
|
||||
// of the project
|
||||
dpp::slashcommand fileCommand("file", "Send a message with a file attached!", bot.me.id);
|
||||
bot.global_command_create(fileCommand);
|
||||
|
||||
// Create and register the external command
|
||||
dpp::slashcommand externalCommand("external", "Send an image from an external source", bot.me.id);
|
||||
bot.global_command_create(externalCommand);
|
||||
|
||||
// Create and register the embed command
|
||||
dpp::slashcommand embedCommand("embed", "Send a message with an image embed", bot.me.id);
|
||||
bot.global_command_create(embedCommand);
|
||||
}
|
||||
});
|
||||
|
||||
// Start the bot
|
||||
bot.start(dpp::st_wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "01_05_webhooks")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <cluster.h>
|
||||
#include <message.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include "dotenv.h"
|
||||
|
||||
int main() {
|
||||
// Load in the .env file into the environment
|
||||
dotenv::init();
|
||||
if (!std::getenv("DISCORD_WEBHOOK")) {
|
||||
std::cout << "Failed to get webhook from .env or environment" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Get the webhook url from the environment
|
||||
std::string webhookUrl = std::getenv("DISCORD_WEBHOOK");
|
||||
|
||||
// When using webhooks, a bot token is not needed,
|
||||
// we can just create the cluster without it
|
||||
dpp::cluster bot;
|
||||
// Start the bot, returning once its initializaed
|
||||
bot.start(dpp::st_return);
|
||||
// Create a webhook object with our webhook url
|
||||
dpp::webhook wh(webhookUrl);
|
||||
|
||||
// Send a simple message over the webhook
|
||||
bot.execute_webhook(wh, dpp::message("This is a webhook message!"));
|
||||
|
||||
// Wait for all active requests to be completed
|
||||
while (bot.active_requests() > 0) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
// Exit, the bot will automatically be cleaned up
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "01_06_callbacks")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,103 @@
|
||||
#include <appcommand.h>
|
||||
#include <channel.h>
|
||||
#include <cluster.h>
|
||||
#include <dispatcher.h>
|
||||
#include <intents.h>
|
||||
#include <message.h>
|
||||
#include <misc-enum.h>
|
||||
#include <once.h>
|
||||
#include <restresults.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "dotenv.h"
|
||||
|
||||
int main() {
|
||||
// Load the .env into the environment
|
||||
dotenv::init();
|
||||
if (!std::getenv("DISCORD_TOKEN")) {
|
||||
std::cout << "Failed to get the discord token from the .env or enviroment" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Get the bot token
|
||||
std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
|
||||
// Create a cluster with default intents as well as the message content
|
||||
// dpp::i_message_content is needed in order to get messages
|
||||
dpp::cluster bot(botToken, dpp::i_default_intents | dpp::i_message_content);
|
||||
|
||||
bot.on_log(dpp::utility::cout_logger());
|
||||
|
||||
bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) {
|
||||
if (event.command.get_command_name() == "msgs-get") {
|
||||
int64_t limit = std::get<int64_t>(event.get_parameter("quantity"));
|
||||
|
||||
bot.messages_get(event.command.channel_id, 0, 0, 0, limit,
|
||||
[event](const dpp::confirmation_callback_t& callback) {
|
||||
if (callback.is_error()) {
|
||||
std::cout << callback.get_error().message << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
auto messages = callback.get<dpp::message_map>();
|
||||
|
||||
std::string contents;
|
||||
for (const auto& x : messages) {
|
||||
contents += x.second.content + "\n";
|
||||
}
|
||||
|
||||
event.reply(contents);
|
||||
});
|
||||
} else if (event.command.get_command_name() == "channel-create") {
|
||||
dpp::channel channel = dpp::channel().set_name("test").set_guild_id(event.command.guild_id);
|
||||
|
||||
bot.channel_create(channel, [&bot, event](const dpp::confirmation_callback_t& callback) -> void {
|
||||
if (callback.is_error()) {
|
||||
bot.log(dpp::loglevel::ll_error, callback.get_error().message);
|
||||
return;
|
||||
}
|
||||
|
||||
auto channel = callback.get<dpp::channel>();
|
||||
dpp::message message =
|
||||
dpp::message("The channel's name is '" + channel.name + "', ID is '" + std::to_string(channel.id) +
|
||||
"', and the type is '" + std::to_string(channel.get_type()) + "'.");
|
||||
event.reply(message);
|
||||
});
|
||||
} else if (event.command.get_command_name() == "msg-error") {
|
||||
bot.message_get(0, 0, [event](const dpp::confirmation_callback_t& callback) -> void {
|
||||
if (callback.is_error()) {
|
||||
event.reply(callback.get_error().message);
|
||||
return;
|
||||
}
|
||||
|
||||
auto message = callback.get<dpp::message>();
|
||||
event.reply(message);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
bot.on_ready([&bot](const dpp::ready_t& event) {
|
||||
if (dpp::run_once<struct register_global_commands>()) {
|
||||
dpp::slashcommand msgs_get("msgs-get", "Get messages", bot.me.id);
|
||||
constexpr int64_t min_val{1};
|
||||
constexpr int64_t max_val{100};
|
||||
|
||||
msgs_get.add_option(
|
||||
dpp::command_option(dpp::co_integer, "quantity", "Quantity of messages to get. - Max 100")
|
||||
.set_min_value(min_val)
|
||||
.set_max_value(max_val));
|
||||
|
||||
dpp::slashcommand channel_create("channel-create", "Create a channel", bot.me.id);
|
||||
dpp::slashcommand msg_error("msg-error", "Get an error instead of a message", bot.me.id);
|
||||
|
||||
bot.global_bulk_command_create({msgs_get, channel_create, msg_error});
|
||||
}
|
||||
});
|
||||
|
||||
bot.start(dpp::st_wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "01_07_cache")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,52 @@
|
||||
#include <cache.h>
|
||||
#include <cluster.h>
|
||||
#include <intents.h>
|
||||
#include <misc-enum.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "dotenv.h"
|
||||
|
||||
int main() {
|
||||
// Load the .env into the environment
|
||||
dotenv::init();
|
||||
// Make sure the DISCORD_TOKEN environment var exists
|
||||
if (!std::getenv("DISCORD_TOKEN")) {
|
||||
std::cout << "Failed to get DISCORD_TOKEN from .env or the environment." << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Get the bot token from DISCORD_TOKEN
|
||||
std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
|
||||
// Create the bot, passing in our token as well as the intents
|
||||
dpp::cluster bot(botToken, dpp::i_default_intents | dpp::i_guild_members);
|
||||
|
||||
// Create a lamba as a callback for when a reaction is removed
|
||||
bot.on_message_reaction_remove([&bot](const dpp::message_reaction_remove_t& event) {
|
||||
// Get the user from the cache.
|
||||
// More then just users are cached, you can use the following
|
||||
// functions to interact with it
|
||||
// dpp::find_role()
|
||||
// dpp::find_channel()
|
||||
// dpp::find_guild()
|
||||
// dpp::find_guild_member()
|
||||
// dpp::find_user()
|
||||
dpp::user* reacting_user = dpp::find_user(event.reacting_user_id);
|
||||
|
||||
// Make sure the user was actually found in the cache
|
||||
if (!reacting_user) {
|
||||
bot.log(dpp::ll_info, "User with id " + std::to_string(event.reacting_user_id) + " was not found.");
|
||||
return;
|
||||
}
|
||||
// Log the action, using their username that we grabbed from the
|
||||
// cache
|
||||
bot.log(dpp::ll_info, reacting_user->format_username() + " removed their reaction.");
|
||||
});
|
||||
|
||||
// Start the bot
|
||||
bot.start(dpp::st_wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "01_08_listening_to_messages")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,42 @@
|
||||
#include <cluster.h>
|
||||
#include <dispatcher.h>
|
||||
#include <intents.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include "dotenv.h"
|
||||
|
||||
// Please note:
|
||||
// Discord made message content a privileged intent in August 2022.
|
||||
// Directly pulling the message content and using prefixes for commands is
|
||||
// generally an older technique for running bot commands. Nowadays it is
|
||||
// recommanded to use slash commands, which is covered in 02_01.
|
||||
|
||||
int main() {
|
||||
// Load the .env into the environment
|
||||
dotenv::init();
|
||||
// Make sure the DISCORD_TOKEN env var exists
|
||||
if (!std::getenv("DISCORD_TOKEN")) {
|
||||
std::cout << "Failed to get DISCORD_TOKEN from .env or environment" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Load in the bot token from the env
|
||||
std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
|
||||
// Create the bot
|
||||
dpp::cluster bot(botToken, dpp::i_default_intents | dpp::i_message_content);
|
||||
|
||||
// Create a lambda for the on_message_create event.
|
||||
bot.on_message_create([](const dpp::message_create_t& event) {
|
||||
// Filter through the message content
|
||||
if (event.msg.content.find("bad word") != std::string::npos) {
|
||||
event.reply("That is not allowed here. Please, mind you language.", true);
|
||||
}
|
||||
});
|
||||
|
||||
// Start the bot
|
||||
bot.start(dpp::st_wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_01_01_using_slash_cmds")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,91 @@
|
||||
#include <appcommand.h>
|
||||
#include <cluster.h>
|
||||
#include <dispatcher.h>
|
||||
#include <once.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include "dotenv.h"
|
||||
|
||||
int main() {
|
||||
// Load the .env file into the environment
|
||||
dotenv::init();
|
||||
// Make sure the DISCORD_TOKEN env var exists
|
||||
if (!std::getenv("DISCORD_TOKEN") || !std::getenv("DISCORD_GUILD")) {
|
||||
std::cout << "Failed to get DISCORD_TOKEN or DISCORD_GUILD from .env or environment" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
// Load in the bot token
|
||||
std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
// Load in the guild id
|
||||
std::string guildId = std::getenv("DISCORD_GUILD");
|
||||
|
||||
// Create the bot
|
||||
dpp::cluster bot(botToken);
|
||||
// Register a cout logger
|
||||
bot.on_log(dpp::utility::cout_logger());
|
||||
|
||||
// Create a lambda callback for when a slashcommand is run
|
||||
bot.on_slashcommand([](const dpp::slashcommand_t& event) {
|
||||
// Filter through the command name and run its matching code
|
||||
if (event.command.get_command_name() == "blep") {
|
||||
// Get the "animal" option
|
||||
std::string animal = std::get<std::string>(event.get_parameter("animal"));
|
||||
// Reply back
|
||||
event.reply(std::string("Blep! You chose") + animal);
|
||||
} else if (event.command.get_command_name() == "blep-guild") {
|
||||
std::string animal = std::get<std::string>(event.get_parameter("animal"));
|
||||
event.reply(std::string("Blep! You chose") + animal);
|
||||
} else if (event.command.get_command_name() == "ping") {
|
||||
event.reply("Pong!");
|
||||
} else if (event.command.get_command_name() == "pong") {
|
||||
event.reply("Ping!");
|
||||
} else if (event.command.get_command_name() == "ding") {
|
||||
event.reply("Dong!");
|
||||
} else if (event.command.get_command_name() == "dong") {
|
||||
event.reply("Ding!");
|
||||
}
|
||||
});
|
||||
|
||||
// Create a lambda for when the bot is ready
|
||||
bot.on_ready([&bot, &guildId](const dpp::ready_t& event) {
|
||||
// Only run once
|
||||
if (dpp::run_once<struct register_bot_commands>()) {
|
||||
// Create the "blep" global command
|
||||
dpp::slashcommand globalCommand("blep", "Send a random adorable animal photo", bot.me.id);
|
||||
// Add some options to the global command
|
||||
globalCommand.add_option(
|
||||
dpp::command_option(dpp::co_string, "animal", "The type of animal", true)
|
||||
.add_choice(dpp::command_option_choice("Dog", std::string("animal_dog")))
|
||||
.add_choice(dpp::command_option_choice("Cat", std::string("animal_cat")))
|
||||
.add_choice(dpp::command_option_choice("Penguin", std::string("animal_penguin"))));
|
||||
|
||||
// Register the global command
|
||||
bot.global_command_create(globalCommand);
|
||||
|
||||
// Create the guild only command
|
||||
dpp::slashcommand guildCommand("blep-guild", "Send a random adorable animal photo", bot.me.id);
|
||||
guildCommand.add_option(
|
||||
dpp::command_option(dpp::co_string, "animal", "The type of animal", true)
|
||||
.add_choice(dpp::command_option_choice("Dog", std::string("animal_dog")))
|
||||
.add_choice(dpp::command_option_choice("Cat", std::string("animal_cat")))
|
||||
.add_choice(dpp::command_option_choice("Penguin", std::string("animal_penguin"))));
|
||||
// Register the guild command
|
||||
bot.guild_command_create(guildCommand, guildId);
|
||||
|
||||
// Create some commands
|
||||
dpp::slashcommand pingCommand("ping", "Pong", bot.me.id);
|
||||
dpp::slashcommand pongCommand("pong", "ping", bot.me.id);
|
||||
dpp::slashcommand dingCommand("ding", "dong", bot.me.id);
|
||||
dpp::slashcommand dongCommand("dong", "ding", bot.me.id);
|
||||
// Bulk register the commands using a list
|
||||
bot.global_bulk_command_create({pingCommand, pongCommand, dingCommand, dongCommand});
|
||||
}
|
||||
});
|
||||
|
||||
// Start the bot
|
||||
bot.start(dpp::st_wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_01_02_clearing_registered_cmds")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#include <cluster.h>
|
||||
#include <dispatcher.h>
|
||||
#include <dotenv.h>
|
||||
#include <exception.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
// Load the .env file into the environment
|
||||
dotenv::init();
|
||||
// Make sure the DISCORD_TOKEN env var exists
|
||||
if (!std::getenv("DISCORD_TOKEN") || !std::getenv("DISCORD_GUILD")) {
|
||||
std::cout << "Failed to get DISCORD_TOKEN or DISCORD_GUILD from .env or environment" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
// Load in the bot token
|
||||
std::string botToken = std::getenv("DISCORD_TOKEN");
|
||||
// Load in the guild id
|
||||
std::string guildId = std::getenv("DISCORD_GUILD");
|
||||
|
||||
// Create the bot
|
||||
dpp::cluster bot(botToken);
|
||||
// Register a cout_logger
|
||||
bot.on_log(dpp::utility::cout_logger());
|
||||
|
||||
// Create a lambda to be called when the bot is ready
|
||||
bot.on_ready([&bot, &guildId](const dpp::ready_t& event) {
|
||||
// Bulk delete any globally registered commands
|
||||
bot.global_bulk_command_delete();
|
||||
// Bulk delete any guild commands registered to the passed in guild id
|
||||
bot.guild_bulk_command_delete(guildId);
|
||||
});
|
||||
|
||||
// Start the bot
|
||||
bot.start(dpp::st_wait);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_01_03_subcommands")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_01_04_autocompletion")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_01_05_file_parameters")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_01_06_cmd_handler")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_02_emphemeral_replies")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_01_user_apps")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_04_resolved_objects")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_05_01_btn")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_05_02_advanced_btn")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_05_03_select_menu")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_05_04_select_menu_advanced")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_05_05_editing_msg_from_btn")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_05_06_components_v2")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_06_modals")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_07_context_menus")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(dppbots)
|
||||
set(example_name "02_08_thinking")
|
||||
message("Setting up ${example_name}")
|
||||
add_executable(${example_name} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
||||
target_include_directories(${example_name} PUBLIC
|
||||
"${dpp_SOURCE_DIR}/include"
|
||||
"${dotenv-cpp_SOURCE_DIR}/include/laserpants"
|
||||
)
|
||||
target_link_libraries(${example_name}
|
||||
dpp
|
||||
dotenv
|
||||
)
|
||||
SET_OUTPUT_NAMES(${example_name})
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "WIP" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
├── 01_basics
|
||||
│ ├── 02_embeds
|
||||
│ ├── 03_private_messages
|
||||
│ ├── 04_adding_files
|
||||
│ ├── 05_webhooks
|
||||
│ ├── 06_callback_functions
|
||||
│ ├── 07_cache
|
||||
│ └── 08_listening_to_messages
|
||||
├── 02_interactions_and_components
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user