Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev -> master #86

Merged
merged 6 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ class CoreExport cluster {
* which is specified in dpp::discord_voice_client::insert_marker and returned to this
* event.
*
* @param _voice_receive User function to attach to event
* @param _voice_track_marker User function to attach to event
*/
void on_voice_track_marker (std::function<void(const voice_track_marker_t& _event)> _voice_track_marker);

Expand Down Expand Up @@ -898,7 +898,7 @@ class CoreExport cluster {
/**
* @brief Respond to a slash command
*
* @param m Message to send
* @param r Message to send
* @param callback Function to call when the API call completes.
* On success the callback will contain a dpp::confirmation 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().
*/
Expand Down Expand Up @@ -936,7 +936,7 @@ class CoreExport cluster {
/**
* @brief Create/overwrite guild slash commands
*
* @param s Vector of slash commands to create/update.
* @param commands Vector of slash commands to create/update.
* New guild commands will be available in the guild immediately. If the command did not already exist, it will count toward daily application command create limits.
* @param guild_id Guild ID to create/update the slash commands in
* @param callback Function to call when the API call completes.
Expand All @@ -947,7 +947,7 @@ class CoreExport cluster {
/**
* @brief Create/overwrite global slash commands
*
* @param s Vector of slash commands to create/update.
* @param commands Vector of slash commands to create/update.
* overwriting existing commands that are registered globally for this application. Updates will be available in all guilds after 1 hour.
* Commands that do not already exist will count toward daily application command create limits.
* @param callback Function to call when the API call completes.
Expand Down Expand Up @@ -1840,7 +1840,7 @@ class CoreExport cluster {
/**
* @brief Get webhook message
*
* @param Webhook to get the original message for
* @param wh Webhook to get the original message for
* @param callback Function to call when the API call completes.
*/
void get_webhook_message(const class webhook &wh, command_completion_event_t callback = {});
Expand Down
14 changes: 12 additions & 2 deletions include/dpp/discordvoiceclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,15 @@ class CoreExport discord_voice_client : public websocket_client
* pushing them onto the output queue, if you have a complete stream
* ready to send and know its length it is advisable to call this
* method multiple times to enqueue the entire stream audio so that
* it is all encoded at once. Constantly calling this from the
* dpp::on_voice_buffer_send callback can and will eat a TON of cpu!
* it is all encoded at once (unless you have set use_opus to false).
* Constantly calling this from the dpp::on_voice_buffer_send callback
* can and will eat a TON of cpu!
*
* @param audio_data Raw PCM audio data. Channels are interleaved,
* with each channel's amplitude being a 16 bit value.
*
* The audio data should be 48000Khz signed 16 bit audio.
*
* @param length The length of the audio data. The length should
* be a multiple of 4 (2x 16 bit stero channels) with a maximum
* length of 11520, which is a complete opus frame at highest
Expand All @@ -404,6 +408,12 @@ class CoreExport discord_voice_client : public websocket_client
* encoded data already. In this case, we don't need to encode the
* frames using opus here. We can set use_opus to false and bypass the
* codec, only applying libsodium to the stream.
*
* @note If you set use_opus to false, it is your responsibility to ensure
* that packets of data sent to send_audio are correctly repacketized
* for streaming, e.g. that audio frames are not too large or contain
* an incorrect format. Discord will still expect the same frequency
* and bit width of audio and the same signedness.
*/
void send_audio(uint16_t* audio_data, const size_t length, bool use_opus = true);

Expand Down
3 changes: 3 additions & 0 deletions include/dpp/dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,8 @@ struct CoreExport voice_receive_t : public event_dispatch_t {
*/
class CoreExport dispatcher {
public:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdocumentation"
/** @brief Event handler function pointer for log event
* @param event Event parameters
*/
Expand Down Expand Up @@ -1119,6 +1121,7 @@ class CoreExport dispatcher {
* @param event Event parameters
*/
std::function<void(const guild_stickers_update_t& event)> stickers_update;
#pragma GCC diagnostic pop
};

/**
Expand Down
8 changes: 4 additions & 4 deletions include/dpp/emoji.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ class CoreExport emoji : public managed {
/**
* @brief Construct a new emoji object with name, ID and flags
*
* @param name The emoji's name
* @param id ID, if it has one (unicode does not)
* @param flags Emoji flags (emoji_flags)
* @param n The emoji's name
* @param i ID, if it has one (unicode does not)
* @param f Emoji flags (emoji_flags)
*/
emoji(const std::string, const snowflake = 0, const uint8_t = 0);
emoji(const std::string n, const snowflake i = 0, const uint8_t f = 0);

/**
* @brief Destroy the emoji object
Expand Down
16 changes: 8 additions & 8 deletions include/dpp/presence.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ class CoreExport activity {
/**
* @brief Construct a new activity
*
* @param typ
* @param nam
* @param stat
* @param url_
* @param typ activity type
* @param nam Name of the activity
* @param stat State of the activity
* @param url_ url of the activity, only works for certain sites, such as YouTube
*/
activity(const activity_type typ, const std::string& nam, const std::string& stat, const std::string& url_);
};
Expand Down Expand Up @@ -197,16 +197,16 @@ class CoreExport presence {
/**
* @brief Construct a new presence object with some parameters for sending to a websocket
*
* @param status
* @param type
* @param activity_description
* @param status Status of the activity
* @param type Type of activity
* @param activity_description Description of the activity
*/
presence(presence_status status, activity_type type, const std::string& activity_description);

/**
* @brief Construct a new presence object with some parameters for sending to a websocket
*
* @param status
* @param status Status of the activity
* @param a Activity itself
*/
presence(presence_status status, activity a);
Expand Down
6 changes: 3 additions & 3 deletions include/dpp/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#pragma once

#if !defined(DPP_VERSION_LONG)
#define DPP_VERSION_LONG 0x00090005
#define DPP_VERSION_SHORT 090005
#define DPP_VERSION_TEXT "D++ 9.0.5 (14-Sep-2021)"
#define DPP_VERSION_LONG 0x00090006
#define DPP_VERSION_SHORT 090006
#define DPP_VERSION_TEXT "D++ 9.0.6 (20-Sep-2021)"

#define DPP_VERSION_MAJOR ((DPP_VERSION_LONG & 0x00ff0000) >> 16)
#define DPP_VERSION_MINOR ((DPP_VERSION_LONG & 0x0000ff00) >> 8)
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/wsclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class CoreExport websocket_client : public ssl_client
/** Fill a header for outbound messages
* @param outbuf The raw frame to fill
* @param sendlength The size of the data to encapsulate
* @param ws_opcode the opcode to send in the header
* @param opcode the ws_opcode to send in the header
*/
size_t FillHeader(unsigned char* outbuf, size_t sendlength, ws_opcode opcode);

Expand Down
3 changes: 3 additions & 0 deletions src/dpp/discordvoiceclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ void discord_voice_client::send_audio(uint16_t* audio_data, const size_t length,
if (use_opus) {
encodedAudioLength = this->encode((uint8_t*)audio_data, length, encodedAudioData.data(), encodedAudioLength);
} else {
encodedAudioLength = length;
encodedAudioData.reserve(length);
memcpy(encodedAudioData.data(), audio_data, length);
}

++sequence;
Expand Down