Skip to content

Commit

Permalink
breaking: removed reason parameter from cluster::guild_ban_add method
Browse files Browse the repository at this point in the history
  • Loading branch information
Commandserver committed Jun 9, 2022
1 parent 005b42e commit c7bec36
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 35 deletions.
17 changes: 0 additions & 17 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -2483,23 +2483,6 @@ class DPP_EXPORT cluster {
*/
void guild_member_timeout(snowflake guild_id, snowflake user_id, time_t communication_disabled_until, command_completion_event_t callback = utility::log_error());

/**
* @brief Add guild ban
*
* Create a guild ban, and optionally delete previous messages sent by the banned user.
* Requires the `BAN_MEMBERS` permission. Fires a `Guild Ban Add` Gateway event.
* @see https://discord.com/developers/docs/resources/guild#create-guild-ban
* @note This method supports audit log reasons set by the cluster::set_audit_reason() method.
* @param guild_id Guild ID to add ban to
* @param user_id User ID to ban
* @param delete_message_days How many days of their user's messages to also delete
* @param reason Reason for ban
* @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().
* @deprecated Discord deprecated the reason parameter in the json body. Use the similar method to this without the reason param and use cluster::set_audit_log_reason() to set the reason.
*/
void guild_ban_add(snowflake guild_id, snowflake user_id, uint32_t delete_message_days, const std::string &reason, command_completion_event_t callback = utility::log_error());

/**
* @brief Add guild ban
*
Expand Down
7 changes: 3 additions & 4 deletions include/dpp/cluster_sync_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,23 +717,22 @@ auditlog guild_auditlog_get_sync(snowflake guild_id);

/**
* @brief Add guild ban
*
*
* Create a guild ban, and optionally delete previous messages sent by the banned user.
* Requires the `BAN_MEMBERS` permission. Fires a `Guild Ban Add` Gateway event.
* @see dpp::cluster::guild_ban_add
* @see https://discord.com/developers/docs/resources/guild#create-guild-ban
* @note This method supports audit log reasons set by the cluster::set_audit_reason() method.
* @param guild_id Guild ID to add ban to
* @param user_id User ID to ban
* @param delete_message_days How many days of their user's messages to also delete
* @param reason Reason for ban
* @param delete_message_days How many days of their user's messages to also delete (0-7). Defaults to 0
* @return confirmation returned object on completion
* \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.
*/
confirmation guild_ban_add_sync(snowflake guild_id, snowflake user_id, uint32_t delete_message_days, const std::string &reason);
confirmation guild_ban_add_sync(snowflake guild_id, snowflake user_id, uint32_t delete_message_days = 0);

/**
* @brief Delete guild ban
Expand Down
12 changes: 0 additions & 12 deletions src/dpp/cluster/guild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,6 @@ void cluster::guild_auditlog_get(snowflake guild_id, command_completion_event_t
}


void cluster::guild_ban_add(snowflake guild_id, snowflake user_id, uint32_t delete_message_days, const std::string &reason, command_completion_event_t callback) {
json j;
if (delete_message_days > 7)
delete_message_days = 7;
if (!reason.empty())
j["reason"] = reason;
if (delete_message_days)
j["delete_message_days"] = delete_message_days;
rest_request<confirmation>(this, API_PATH "/guilds", std::to_string(guild_id), "bans/" + std::to_string(user_id), m_put, j.dump(), callback);
}


void cluster::guild_ban_add(snowflake guild_id, snowflake user_id, uint32_t delete_message_days, command_completion_event_t callback) {
json j;
if (delete_message_days > 7)
Expand Down
4 changes: 2 additions & 2 deletions src/dpp/cluster_sync_calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ auditlog cluster::guild_auditlog_get_sync(snowflake guild_id) {
return dpp::sync<auditlog>(this, &cluster::guild_auditlog_get, guild_id);
}

confirmation cluster::guild_ban_add_sync(snowflake guild_id, snowflake user_id, uint32_t delete_message_days, const std::string &reason) {
return dpp::sync<confirmation>(this, &cluster::guild_ban_add, guild_id, user_id, delete_message_days, reason);
confirmation cluster::guild_ban_add_sync(snowflake guild_id, snowflake user_id, uint32_t delete_message_days) {
return dpp::sync<confirmation>(this, &cluster::guild_ban_add, guild_id, user_id, delete_message_days);
}

confirmation cluster::guild_ban_delete_sync(snowflake guild_id, snowflake user_id) {
Expand Down

0 comments on commit c7bec36

Please sign in to comment.