-
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'brainboxdotcc:dev' into dev
- Loading branch information
Showing
107 changed files
with
2,954 additions
and
2,555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Test compile documentation examples | ||
on: | ||
push: | ||
branches: | ||
- 'dev' | ||
files: | ||
- '**Doxyfile' | ||
- '**docpages/example_code/**' | ||
pull_request: | ||
files: | ||
- '**Doxyfile' | ||
- '**docpages/example_code/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test_docs_examples: | ||
name: Test build examples | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Checkout D++ | ||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install apt packages | ||
run: sudo sed -i 's/azure\.//' /etc/apt/sources.list && sudo apt-get update && sudo apt-get install -y g++-12 libsodium-dev libopus-dev zlib1g-dev libmpg123-dev liboggz-dev cmake libfmt-dev | ||
|
||
- name: Generate CMake | ||
run: mkdir build && cd build && cmake -DDPP_NO_VCPKG=ON -DAVX_TYPE=T_fallback -DDPP_CORO=ON -DCMAKE_BUILD_TYPE=Debug .. | ||
env: | ||
CXX: g++-12 | ||
|
||
- name: Build Project | ||
run: cd build && make -j2 && sudo make install | ||
|
||
- name: Test compile examples | ||
run: cd docpages/example_code && mkdir build && cd build && cmake .. && make -j2 | ||
env: | ||
CXX: g++-12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# D++ (DPP), The Lightweight C++ Discord Library | ||
# | ||
# Copyright 2021 Craig Edwards <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# Example programs test compilation | ||
# This build script is executed by a GitHub action to ensure all example | ||
# programs compile correctly. It does not attempt to run them, as there | ||
# is no way to know if the program successfully did its thing, plus | ||
# examples do not have a valid token. This build script assumes the | ||
# following system dependencies are available: | ||
# | ||
# g++-12 or later | ||
# liboggz-dev | ||
# libmpg123-dev | ||
# dpp latest master with -DDPP_CORO=ON installed sytemwide | ||
|
||
cmake_minimum_required (VERSION 3.16) | ||
project(documentation_tests) | ||
|
||
string(ASCII 27 Esc) | ||
|
||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDPP_CORO -std=c++20 -pthread -O0 -fPIC -rdynamic -DFMT_HEADER_ONLY -Wall -Wextra -Wpedantic -Werror -Wno-unused-parameter") | ||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0") | ||
|
||
file(GLOB example_list ./*.cpp) | ||
foreach (example ${example_list}) | ||
get_filename_component(examplename ${example} NAME) | ||
message(STATUS "Found example '${Esc}[1;34m${examplename}${Esc}[m'") | ||
add_executable(${examplename}_out ${example}) | ||
target_link_libraries(${examplename}_out dl dpp mpg123 oggz) | ||
endforeach(example) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <dpp/dpp.h> | ||
|
||
int main() { | ||
dpp::cluster bot("token"); | ||
|
||
bot.on_log(dpp::utility::cout_logger()); | ||
|
||
/* The event is fired when someone issues your commands */ | ||
bot.on_slashcommand([&bot](const dpp::slashcommand_t& event) { | ||
/* Check which command they ran */ | ||
if (event.command.get_command_name() == "file") { | ||
|
||
dpp::message msg(event.command.channel_id, "Hey there, I've got a new file!"); | ||
|
||
/* attach the file to the message */ | ||
msg.add_file("foobar.txt", dpp::utility::read_file("path_to_your_file.txt")); | ||
|
||
/* Reply to the user with the message, with our file attached. */ | ||
event.reply(msg); | ||
} | ||
}); | ||
|
||
bot.on_ready([&bot](const dpp::ready_t& event) { | ||
if (dpp::run_once<struct register_bot_commands>()) { | ||
|
||
/* Create and register a command when the bot is ready */ | ||
bot.global_command_create(dpp::slashcommand("file", "Send a message with a file attached!", bot.me.id)); | ||
} | ||
}); | ||
|
||
bot.start(dpp::st_wait); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.