Skip to content

Commit

Permalink
Merge pull request #5 from brainboxdotcc/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Commandserver authored Oct 26, 2021
2 parents f64e3e8 + 88903da commit 17abef9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
20 changes: 15 additions & 5 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ typedef std::variant<
guild_member_map,
channel,
channel_map,
thread_member,
thread_member_map,
guild,
guild_map,
Expand Down Expand Up @@ -2166,21 +2167,30 @@ x */
*/
void thread_member_remove(snowflake thread_id, snowflake user_id, command_completion_event_t callback = {});

/**
* @brief Get a thread member
*
* @param thread_id Thread to get member for
* @param user_id ID of the user to get
* @param callback Function to call when the API call completes
*/
void get_thread_member(const snowflake thread_id, const snowflake user_id, command_completion_event_t callback);

/**
* @brief Get members of a thread
*
* @param thread_id Thread to get members for
* @param callback Function to call when the API call completes
*/
void get_thread_members(snowflake thread_id, command_completion_event_t callback = {});
void get_thread_members(snowflake thread_id, command_completion_event_t callback);

/**
* @brief Get active threads in a channel (Sorted by ID in descending order)
*
* @param channel_id Channel to get active threads for
* @param callback Function to call when the API call completes
*/
void get_active_threads(snowflake channel_id, command_completion_event_t callback = {});
void get_active_threads(snowflake channel_id, command_completion_event_t callback);

/**
* @brief Get public archived threads in a channel (Sorted by archive_timestamp in descending order)
Expand All @@ -2190,7 +2200,7 @@ x */
* @param limit Number of threads to get
* @param callback Function to call when the API call completes
*/
void get_public_archived_threads(snowflake channel_id, time_t before_timestamp = 0, uint16_t limit = 0, command_completion_event_t callback = {});
void get_public_archived_threads(snowflake channel_id, time_t before_timestamp, uint16_t limit, command_completion_event_t callback);

/**
* @brief Get private archived threads in a channel (Sorted by archive_timestamp in descending order)
Expand All @@ -2200,7 +2210,7 @@ x */
* @param limit Number of threads to get
* @param callback Function to call when the API call completes
*/
void get_private_archived_threads(snowflake channel_id, time_t before_timestamp = 0, uint16_t limit = 0, command_completion_event_t callback = {});
void get_private_archived_threads(snowflake channel_id, time_t before_timestamp, uint16_t limit, command_completion_event_t callback);

/**
* @brief Get private archived threads in a channel which current user has joined (Sorted by ID in descending order)
Expand All @@ -2211,7 +2221,7 @@ x */
* @param limit Number of threads to get
* @param callback Function to call when the API call completes
*/
void get_joined_private_archived_threads(snowflake channel_id, snowflake before_id = 0, uint16_t limit = 0, command_completion_event_t callback = {});
void get_joined_private_archived_threads(snowflake channel_id, snowflake before_id, uint16_t limit, command_completion_event_t callback);

/**
* @brief Create a sticker in a guild
Expand Down
7 changes: 7 additions & 0 deletions src/dpp/cluster/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ void cluster::get_public_archived_threads(snowflake channel_id, time_t before_ti
});
}

void cluster::get_thread_member(const snowflake thread_id, const snowflake user_id, command_completion_event_t callback) {
this->post_rest(API_PATH "/channels", std::to_string(thread_id), "/threads-members/" + std::to_string(user_id), m_get, "", [callback](json &j, const http_request_completion_t& http) {
if (callback) {
callback(confirmation_callback_t("thread_member", thread_member().fill_from_json(&j), http));
}
});
}

void cluster::get_thread_members(snowflake thread_id, command_completion_event_t callback) {
this->post_rest(API_PATH "/channels", std::to_string(thread_id), "/threads-members", m_get, "", [callback](json &j, const http_request_completion_t& http) {
Expand Down

0 comments on commit 17abef9

Please sign in to comment.