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

feat: added thread_get for threads #930

Merged
merged 1 commit into from
Oct 9, 2023
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
9 changes: 9 additions & 0 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -3314,6 +3314,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
Loading