Skip to content

Commit

Permalink
Merge branch 'dev' into commandhandler_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis authored Jul 18, 2024
2 parents 09abcab + 87100df commit 9104d26
Show file tree
Hide file tree
Showing 22 changed files with 1,304 additions and 1,209 deletions.
36 changes: 20 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@ jobs:
# GitHub hosted runners on Azure
# arm7hf is a self-hosted docker-based runner at Brainbox.cc. Raspberry Pi 4, 8gb 4-core with NEON
cfg:
- { arch: 'amd64', concurrency: 2, os: ubuntu-20.04, package: clang-10, cpp-version: clang++-10, cmake-flags: '', cpack: 'no', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-11, cpp-version: clang++-11, cmake-flags: '', cpack: 'no', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-12, cpp-version: clang++-12, cmake-flags: '', cpack: 'no', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-13, cpp-version: clang++-13, cmake-flags: '', cpack: 'no', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-14, cpp-version: clang++-14, cmake-flags: '', cpack: 'no', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-15, cpp-version: clang++-15, cmake-flags: '-DDPP_CORO=ON', cpack: 'no', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: g++-12, cpp-version: g++-12, cmake-flags: '-DDPP_CORO=ON', cpack: 'no', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: g++-11, cpp-version: g++-11, cmake-flags: '-DDPP_CORO=ON', cpack: 'no', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: g++-10, cpp-version: g++-10, cmake-flags: '', cpack: 'yes', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-20.04, package: g++-9, cpp-version: g++-9, cmake-flags: '', cpack: 'no', ctest: 'no' }
- { arch: 'amd64', concurrency: 2, os: ubuntu-20.04, package: g++-8, cpp-version: g++-8, cmake-flags: '', cpack: 'no', ctest: 'yes' }
- { arch: 'arm7hf', concurrency: 4, os: [self-hosted, linux, ARM], package: g++-12, cpp-version: g++-12, cmake-flags: '', cpack: 'yes', ctest: 'no' }
- { arch: 'arm64', concurrency: 4, os: [self-hosted, linux, ARM64], package: g++-12, cpp-version: g++-12, cmake-flags: '', cpack: 'yes', ctest: 'no' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-20.04, package: clang-10, cpp-version: clang++-10, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-11, cpp-version: clang++-11, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-12, cpp-version: clang++-12, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-13, cpp-version: clang++-13, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-14, cpp-version: clang++-14, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-15, cpp-version: clang++-15, cmake-flags: '-DDPP_CORO=ON', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: g++-13, cpp-version: g++-13, cmake-flags: '-DDPP_CORO=ON', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: g++-14, cpp-version: g++-14, cmake-flags: '-DDPP_CORO=ON', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: g++-12, cpp-version: g++-12, cmake-flags: '-DDPP_CORO=ON', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: g++-11, cpp-version: g++-11, cmake-flags: '-DDPP_CORO=ON', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: g++-10, cpp-version: g++-10, cmake-flags: '', cpack: 'yes', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-20.04, package: g++-9, cpp-version: g++-9, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
- { arch: 'amd64', concurrency: 4, os: ubuntu-20.04, package: g++-8, cpp-version: g++-8, cmake-flags: '', cpack: 'no', ctest: 'yes', mold: 'yes' }
- { arch: 'arm7hf', concurrency: 4, os: [self-hosted, linux, ARM], package: g++-12, cpp-version: g++-12, cmake-flags: '', cpack: 'yes', ctest: 'no', mold: 'no' }
- { arch: 'arm64', concurrency: 4, os: [self-hosted, linux, ARM64], package: g++-12, cpp-version: g++-12, cmake-flags: '', cpack: 'yes', ctest: 'no', mold: 'yes' }
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
Expand All @@ -66,8 +68,12 @@ jobs:
- name: Install apt packages
run: sudo sed -i 's/azure\.//' /etc/apt/sources.list && sudo apt update && sudo apt-get install -y ${{ matrix.cfg.package }} pkg-config libsodium-dev libopus-dev zlib1g-dev rpm

- name: Setup mold
if: ${{ matrix.cfg.mold == 'yes' }}
uses: rui314/setup-mold@2e332a0b602c2fc65d2d3995941b1b29a5f554a0

- name: Generate CMake
run: mkdir build && cd build && cmake -DDPP_NO_VCPKG=ON -DAVX_TYPE=AVX0 -DCMAKE_BUILD_TYPE=Release ${{matrix.cfg.cmake-flags}} ..
run: cmake -B build -DDPP_NO_VCPKG=ON -DAVX_TYPE=AVX0 -DCMAKE_BUILD_TYPE=Release ${{matrix.cfg.cmake-flags}}
env:
CXX: ${{matrix.cfg.cpp-version}}

Expand Down Expand Up @@ -111,10 +117,8 @@ jobs:
strategy:
fail-fast: false # Don't fail everything if one fails. We want to test each OS/Compiler individually
matrix:
# arm64 is a self-hosted runner on a Mac M2 Mini, ran inside a virtual machine by Archie Jaskowicz. NOTE: This runner no longer exists. It may come back in a few months.
cfg:
- { arch: 'x64', concurrency: 3, os: macos-latest, cpp-version: clang++-14, cmake-flags: ''}
# - { arch: 'arm64', concurrency: 2, os: [self-hosted, ARM64, macOS], cpp-version: clang++-15, cmake-flags: ''}
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@ jobs:
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

- name: Setup mold
uses: rui314/setup-mold@2e332a0b602c2fc65d2d3995941b1b29a5f554a0

- name: Build
run: |
mkdir build
cd build
cmake -DDPP_NO_VCPKG=ON -DCMAKE_BUILD_TYPE=Debug ..
make -j2
run: cmake -B build -DDPP_NO_VCPKG=ON -DAVX_TYPE=AVX0 -DCMAKE_BUILD_TYPE=Release && cmake --build build -j4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
Expand Down
17 changes: 11 additions & 6 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -3253,19 +3253,24 @@ class DPP_EXPORT cluster {
void current_user_get_guilds(command_completion_event_t callback);

/**
* @brief Edit current (bot) user
* @brief Edit current (bot) user.
*
* Modify the requester's user account settings. Returns a dpp::user object on success.
* Fires a User Update Gateway event.
*
* @note There appears to be no limit to the image size, however, if your image cannot be processed/uploaded in time, you will receive a malformed http request.
*
* Modifies the current member in a guild. Returns the updated guild_member object on success.
* Fires a `Guild Member Update` Gateway event.
* @see https://discord.com/developers/docs/resources/user#modify-current-user
* @param nickname Nickname to set
* @param image_blob Avatar data to upload (NOTE: Very heavily rate limited!)
* @param type Type of image for avatar. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @param avatar_blob Avatar data to upload
* @param avatar_type Type of image for avatar. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @param banner_blob Banner data to upload
* @param banner_type Type of image for Banner. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @param callback Function to call when the API call completes.
* On success the callback will contain a dpp::user object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error().
* @throw dpp::length_exception Image data is larger than the maximum size of 256 kilobytes
*/
void current_user_edit(const std::string &nickname, const std::string& image_blob = "", const image_type type = i_png, command_completion_event_t callback = utility::log_error());
void current_user_edit(const std::string &nickname, const std::string& avatar_blob = "", const image_type avatar_type = i_png, const std::string& banner_blob = "", const image_type banner_type = i_png, command_completion_event_t callback = utility::log_error());

/**
* @brief Get current user DM channels
Expand Down
17 changes: 11 additions & 6 deletions include/dpp/cluster_coro_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -2246,20 +2246,25 @@
[[nodiscard]] async<confirmation_callback_t> co_thread_get(snowflake thread_id);

/**
* @brief Edit current (bot) user
* @brief Edit current (bot) user.
*
* Modify the requester's user account settings. Returns a dpp::user object on success.
* Fires a User Update Gateway event.
*
* @note There appears to be no limit to the image size, however, if your image cannot be processed/uploaded in time, you will receive a malformed http request.
*
* Modifies the current member in a guild. Returns the updated guild_member object on success.
* Fires a `Guild Member Update` Gateway event.
* @see dpp::cluster::current_user_edit
* @see https://discord.com/developers/docs/resources/user#modify-current-user
* @param nickname Nickname to set
* @param image_blob Avatar data to upload (NOTE: Very heavily rate limited!)
* @param type Type of image for avatar. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @param avatar_blob Avatar data to upload
* @param avatar_type Type of image for avatar. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @param banner_blob Banner data to upload
* @param banner_type Type of image for Banner. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @return user returned object on completion
* @throw dpp::length_exception Image data is larger than the maximum size of 256 kilobytes
* \memberof dpp::cluster
*/
[[nodiscard]] async<confirmation_callback_t> co_current_user_edit(const std::string &nickname, const std::string& image_blob = "", const image_type type = i_png);
[[nodiscard]] async<confirmation_callback_t> co_current_user_edit(const std::string &nickname, const std::string& avatar_blob = "", const image_type avatar_type = i_png, const std::string& banner_blob = "", const image_type banner_type = i_png);

/**
* @brief Get current (bot) application
Expand Down
17 changes: 11 additions & 6 deletions include/dpp/cluster_sync_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -2765,23 +2765,28 @@ confirmation thread_member_remove_sync(snowflake thread_id, snowflake user_id);
thread thread_get_sync(snowflake thread_id);

/**
* @brief Edit current (bot) user
* @brief Edit current (bot) user.
*
* Modify the requester's user account settings. Returns a dpp::user object on success.
* Fires a User Update Gateway event.
*
* @note There appears to be no limit to the image size, however, if your image cannot be processed/uploaded in time, you will receive a malformed http request.
*
* Modifies the current member in a guild. Returns the updated guild_member object on success.
* Fires a `Guild Member Update` Gateway event.
* @see dpp::cluster::current_user_edit
* @see https://discord.com/developers/docs/resources/user#modify-current-user
* @param nickname Nickname to set
* @param image_blob Avatar data to upload (NOTE: Very heavily rate limited!)
* @param type Type of image for avatar. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @param avatar_blob Avatar data to upload
* @param avatar_type Type of image for avatar. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @param banner_blob Banner data to upload
* @param banner_type Type of image for Banner. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @return user returned object on completion
* @throw dpp::length_exception Image data is larger than the maximum size of 256 kilobytes
* \memberof dpp::cluster
* @throw dpp::rest_exception upon failure to execute REST function
* @warning This function is a blocking (synchronous) call and should only be used from within a separate thread.
* Avoid direct use of this function inside an event handler.
*/
user current_user_edit_sync(const std::string &nickname, const std::string& image_blob = "", const image_type type = i_png);
user current_user_edit_sync(const std::string &nickname, const std::string& avatar_blob = "", const image_type avatar_type = i_png, const std::string& banner_blob = "", const image_type banner_type = i_png);

/**
* @brief Get current (bot) application
Expand Down
1 change: 1 addition & 0 deletions include/dpp/coro.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#pragma once

#include "coro/awaitable.h"
#include "coro/async.h"
#include "coro/coroutine.h"
#include "coro/job.h"
Expand Down
Loading

0 comments on commit 9104d26

Please sign in to comment.