Skip to content

Commit

Permalink
feat: added thread_get for threads (#930)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 authored Oct 9, 2023
1 parent 57c5ed1 commit 9e8b878
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -3312,6 +3312,15 @@ class DPP_EXPORT cluster {
*/
void threads_get_joined_private_archived(snowflake channel_id, snowflake before_id, uint16_t limit, command_completion_event_t callback);

/**
* @brief Get the thread specified by thread_id. This uses the same call as dpp::cluster::channel_get but returns a thread object.
* @see https://discord.com/developers/docs/resources/channel#get-channel
* @param thread_id The id of the thread to obtain.
* @param callback Function to call when the API call completes
* On success the callback will contain a dpp::thread 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 thread_get(snowflake thread_id, command_completion_event_t callback);

/**
* @brief Create a sticker in a guild
* @note This method supports audit log reasons set by the cluster::set_audit_reason() method.
Expand Down
4 changes: 4 additions & 0 deletions src/dpp/cluster/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,8 @@ void cluster::thread_member_remove(snowflake thread_id, snowflake user_id, comma
rest_request<confirmation>(this, API_PATH "/channels", std::to_string(thread_id), "/thread-members/" + std::to_string(user_id), m_delete, "", callback);
}

void cluster::thread_get(snowflake thread_id, command_completion_event_t callback) {
rest_request<thread>(this, API_PATH "/channels", std::to_string(thread_id), "", m_get, "", callback);
}

} // namespace dpp

0 comments on commit 9e8b878

Please sign in to comment.