Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:brainboxdotcc/DPP
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Oct 20, 2024
2 parents fde5da0 + 8f26e78 commit d70cef2
Show file tree
Hide file tree
Showing 138 changed files with 491 additions and 410 deletions.
2 changes: 1 addition & 1 deletion include/dpp/appcommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -1591,4 +1591,4 @@ typedef std::unordered_map<snowflake, slashcommand> slashcommand_map;
*/
typedef std::unordered_map<snowflake, guild_command_permissions> guild_command_permissions_map;

} // namespace dpp
}
7 changes: 6 additions & 1 deletion include/dpp/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ class DPP_EXPORT application : public managed, public json_interface<application
*/
uint64_t approximate_guild_count;

/**
* @brief Optional: Approximate count of users that have installed the app
*/
uint64_t approximate_user_install_count;

/**
* @brief Optional: Array of redirect URIs for the app.
*/
Expand Down Expand Up @@ -467,4 +472,4 @@ class DPP_EXPORT application : public managed, public json_interface<application
*/
typedef std::unordered_map<snowflake, application> application_map;

} // namespace dpp
}
2 changes: 1 addition & 1 deletion include/dpp/auditlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,4 @@ class DPP_EXPORT auditlog : public json_interface<auditlog> {
virtual ~auditlog() = default;
};

} // namespace dpp
}
2 changes: 1 addition & 1 deletion include/dpp/automod.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,4 @@ class DPP_EXPORT automod_rule : public managed, public json_interface<automod_ru
*/
typedef std::unordered_map<snowflake, automod_rule> automod_rule_map;

} // namespace dpp
}
2 changes: 1 addition & 1 deletion include/dpp/ban.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ class DPP_EXPORT ban : public json_interface<ban> {
*/
typedef std::unordered_map<snowflake, ban> ban_map;

} // namespace dpp
}
2 changes: 1 addition & 1 deletion include/dpp/bignum.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ class DPP_EXPORT bignumber {
[[nodiscard]] std::vector<uint64_t> get_binary() const;
};

} // namespace dpp
}
2 changes: 1 addition & 1 deletion include/dpp/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,5 @@ cache_decl(role, find_role, get_role_cache, get_role_count);
cache_decl(channel, find_channel, get_channel_cache, get_channel_count);
cache_decl(emoji, find_emoji, get_emoji_cache, get_emoji_count);

} // namespace dpp
}

2 changes: 1 addition & 1 deletion include/dpp/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -878,5 +878,5 @@ void to_json(nlohmann::json& j, const permission_overwrite& po);
*/
typedef std::unordered_map<snowflake, channel> channel_map;

} // namespace dpp
}

38 changes: 24 additions & 14 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -1334,17 +1334,6 @@ class DPP_EXPORT cluster {
event_router_t<voice_buffer_send_t> on_voice_buffer_send;


/**
* @brief Called when a user is talking on a voice channel.
*
* @warning If the cache policy has disabled guild caching, the pointer to the guild in this event may be nullptr.
*
* @note Use operator() to attach a lambda to this event, and the detach method to detach the listener using the returned ID.
* The function signature for this event takes a single `const` reference of type voice_user_talking_t&, and returns void.
*/
event_router_t<voice_user_talking_t> on_voice_user_talking;


/**
* @brief Called when a voice channel is connected and ready to send audio.
* Note that this is not directly attached to the READY event of the websocket,
Expand Down Expand Up @@ -3662,7 +3651,7 @@ class DPP_EXPORT cluster {

/**
* @brief Get all guild stickers
* @see https://discord.com/developers/docs/resources/sticker#get-guild-stickers
* @see https://discord.com/developers/docs/resources/sticker#list-guild-stickers
* @param guild_id Guild ID of the guild where the sticker is
* @param callback Function to call when the API call completes.
* On success the callback will contain a dpp::sticker_map 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 All @@ -3671,7 +3660,7 @@ class DPP_EXPORT cluster {

/**
* @brief Get a list of available sticker packs
* @see https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs
* @see https://discord.com/developers/docs/resources/sticker#list-sticker-packs
* @param callback Function to call when the API call completes.
* On success the callback will contain a dpp::sticker_pack_map 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 @@ -3821,6 +3810,16 @@ class DPP_EXPORT cluster {
*/
void current_user_set_voice_state(snowflake guild_id, snowflake channel_id, bool suppress = false, time_t request_to_speak_timestamp = 0, command_completion_event_t callback = utility::log_error());

/**
* @brief Get the bot's voice state in a guild without a Gateway connection
*
* @see https://discord.com/developers/docs/resources/voice#get-current-user-voice-state
* @param guild_id Guild to get the voice state for
* @param callback Function to call when the API call completes.
* On success the callback will contain a dpp::voicestate 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().
*/
void current_user_get_voice_state(snowflake guild_id, command_completion_event_t callback);

/**
* @brief Set a user's voice state on a stage channel
*
Expand All @@ -3844,6 +3843,17 @@ class DPP_EXPORT cluster {
*/
void user_set_voice_state(snowflake user_id, snowflake guild_id, snowflake channel_id, bool suppress = false, command_completion_event_t callback = utility::log_error());

/**
* @brief Get a user's voice state in a guild without a Gateway connection
*
* @see https://discord.com/developers/docs/resources/voice#get-user-voice-state
* @param guild_id Guild to get the voice state for
* @param user_id The user to get the voice state of
* @param callback Function to call when the API call completes.
* On success the callback will contain a dpp::voicestate 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().
*/
void user_get_voice_state(snowflake guild_id, snowflake user_id, command_completion_event_t callback);

/**
* @brief Get all auto moderation rules for a guild
*
Expand Down Expand Up @@ -3972,4 +3982,4 @@ class DPP_EXPORT cluster {

};

} // namespace dpp
}
27 changes: 25 additions & 2 deletions include/dpp/cluster_coro_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@
/**
* @brief Get all guild stickers
* @see dpp::cluster::guild_stickers_get
* @see https://discord.com/developers/docs/resources/sticker#get-guild-stickers
* @see https://discord.com/developers/docs/resources/sticker#list-guild-stickers
* @param guild_id Guild ID of the guild where the sticker is
* @return sticker_map returned object on completion
* \memberof dpp::cluster
Expand All @@ -2029,7 +2029,7 @@
/**
* @brief Get a list of available sticker packs
* @see dpp::cluster::sticker_packs_get
* @see https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs
* @see https://discord.com/developers/docs/resources/sticker#list-sticker-packs
* @return sticker_pack_map returned object on completion
* \memberof dpp::cluster
*/
Expand Down Expand Up @@ -2367,6 +2367,17 @@
*/
[[nodiscard]] async<confirmation_callback_t> co_current_user_set_voice_state(snowflake guild_id, snowflake channel_id, bool suppress = false, time_t request_to_speak_timestamp = 0);

/**
* @brief Get the bot's voice state in a guild without a Gateway connection
*
* @see dpp::cluster::current_user_get_voice_state
* @see https://discord.com/developers/docs/resources/voice#get-current-user-voice-state
* @param guild_id Guild to get the voice state for
* @return voicestate returned object on completion
* \memberof dpp::cluster
*/
[[nodiscard]] async<confirmation_callback_t> co_current_user_get_voice_state(snowflake guild_id);

/**
* @brief Set a user's voice state on a stage channel
*
Expand All @@ -2391,6 +2402,18 @@
*/
[[nodiscard]] async<confirmation_callback_t> co_user_set_voice_state(snowflake user_id, snowflake guild_id, snowflake channel_id, bool suppress = false);

/**
* @brief Get a user's voice state in a guild without a Gateway connection
*
* @see dpp::cluster::user_get_voice_state
* @see https://discord.com/developers/docs/resources/voice#get-user-voice-state
* @param guild_id Guild to get the voice state for
* @param user_id The user to get the voice state of
* @return voicestate returned object on completion
* \memberof dpp::cluster
*/
[[nodiscard]] async<confirmation_callback_t> co_user_get_voice_state(snowflake guild_id, snowflake user_id);

/**
* @brief Get current user's connections (linked accounts, e.g. steam, xbox).
* This call requires the oauth2 `connections` scope and cannot be executed
Expand Down
35 changes: 33 additions & 2 deletions include/dpp/cluster_sync_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ DPP_DEPRECATED("Please use coroutines instead of sync functions: https://dpp.dev
/**
* @brief Get all guild stickers
* @see dpp::cluster::guild_stickers_get
* @see https://discord.com/developers/docs/resources/sticker#get-guild-stickers
* @see https://discord.com/developers/docs/resources/sticker#list-guild-stickers
* @param guild_id Guild ID of the guild where the sticker is
* @return sticker_map returned object on completion
* \memberof dpp::cluster
Expand Down Expand Up @@ -2649,7 +2649,7 @@ DPP_DEPRECATED("Please use coroutines instead of sync functions: https://dpp.dev
/**
* @brief Get a list of available sticker packs
* @see dpp::cluster::sticker_packs_get
* @see https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs
* @see https://discord.com/developers/docs/resources/sticker#list-sticker-packs
* @return sticker_pack_map returned object on completion
* \memberof dpp::cluster
* @throw dpp::rest_exception upon failure to execute REST function
Expand Down Expand Up @@ -3095,6 +3095,21 @@ DPP_DEPRECATED("Please use coroutines instead of sync functions: https://dpp.dev
*/
DPP_DEPRECATED("Please use coroutines instead of sync functions: https://dpp.dev/coro-introduction.html") confirmation current_user_set_voice_state_sync(snowflake guild_id, snowflake channel_id, bool suppress = false, time_t request_to_speak_timestamp = 0);

/**
* @brief Get the bot's voice state in a guild without a Gateway connection
*
* @see dpp::cluster::current_user_get_voice_state
* @see https://discord.com/developers/docs/resources/voice#get-current-user-voice-state
* @param guild_id Guild to get the voice state for
* @return voicestate returned object on completion
* \memberof dpp::cluster
* @throw dpp::rest_exception upon failure to execute REST function
* @deprecated This function is deprecated, please use coroutines instead.
* @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.
*/
DPP_DEPRECATED("Please use coroutines instead of sync functions: https://dpp.dev/coro-introduction.html") voicestate current_user_get_voice_state_sync(snowflake guild_id);

/**
* @brief Set a user's voice state on a stage channel
*
Expand Down Expand Up @@ -3123,6 +3138,22 @@ DPP_DEPRECATED("Please use coroutines instead of sync functions: https://dpp.dev
*/
DPP_DEPRECATED("Please use coroutines instead of sync functions: https://dpp.dev/coro-introduction.html") confirmation user_set_voice_state_sync(snowflake user_id, snowflake guild_id, snowflake channel_id, bool suppress = false);

/**
* @brief Get a user's voice state in a guild without a Gateway connection
*
* @see dpp::cluster::user_get_voice_state
* @see https://discord.com/developers/docs/resources/voice#get-user-voice-state
* @param guild_id Guild to get the voice state for
* @param user_id The user to get the voice state of
* @return voicestate returned object on completion
* \memberof dpp::cluster
* @throw dpp::rest_exception upon failure to execute REST function
* @deprecated This function is deprecated, please use coroutines instead.
* @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.
*/
DPP_DEPRECATED("Please use coroutines instead of sync functions: https://dpp.dev/coro-introduction.html") voicestate user_get_voice_state_sync(snowflake guild_id, snowflake user_id);

/**
* @brief Get current user's connections (linked accounts, e.g. steam, xbox).
* This call requires the oauth2 `connections` scope and cannot be executed
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,4 @@ class scheduled_event_collector : public scheduled_event_collector_t {
virtual ~scheduled_event_collector() = default;
};

} // namespace dpp
}
2 changes: 1 addition & 1 deletion include/dpp/commandhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,4 @@ class DPP_EXPORT DPP_DEPRECATED("commandhandler should not be used. Please consi

};

} // namespace dpp
}
2 changes: 1 addition & 1 deletion include/dpp/coro/async.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,6 @@ class async : public awaitable<R> {

DPP_CHECK_ABI_COMPAT(async<>, async_dummy);

} // namespace dpp
}

#endif /* DPP_CORO */
2 changes: 1 addition & 1 deletion include/dpp/coro/coroutine.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ namespace detail::coroutine {
DPP_CHECK_ABI_COMPAT(coroutine<void>, coroutine_dummy)
DPP_CHECK_ABI_COMPAT(coroutine<uint64_t>, coroutine_dummy)

} // namespace dpp
}

/**
* @brief Specialization of std::coroutine_traits, helps the standard library figure out a promise type from a coroutine function.
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/coro/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ std_coroutine::coroutine_handle<> final_awaiter<R>::await_suspend(handle_t<R> ha
DPP_CHECK_ABI_COMPAT(task<void>, task_dummy)
DPP_CHECK_ABI_COMPAT(task<uint64_t>, task_dummy)

} // namespace dpp
}

/**
* @brief Specialization of std::coroutine_traits, helps the standard library figure out a promise_t type from a coroutine function.
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/discordclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,4 +533,4 @@ class DPP_EXPORT discord_client : public websocket_client
voiceconn* get_voice(snowflake guild_id);
};

} // namespace dpp
}
2 changes: 1 addition & 1 deletion include/dpp/discordevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ std::string DPP_EXPORT base64_encode(unsigned char const* buf, unsigned int buff
*/
std::string DPP_EXPORT ts_to_string(time_t ts);

} // namespace dpp
}
Loading

0 comments on commit d70cef2

Please sign in to comment.