Skip to content

Commit

Permalink
fix: run coro and sync generator to make coro and sync thread_get
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Oct 9, 2023
1 parent 9e8b878 commit d0f4e3b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/dpp/cluster_coro_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,16 @@
*/
[[nodiscard]] async<confirmation_callback_t> co_thread_member_remove(snowflake thread_id, snowflake user_id);

/**
* @brief Get the thread specified by thread_id. This uses the same call as dpp::cluster::channel_get but returns a thread object.
* @see dpp::cluster::thread_get
* @see https://discord.com/developers/docs/resources/channel#get-channel
* @param thread_id The id of the thread to obtain.
* @return thread returned object on completion
* \memberof dpp::cluster
*/
[[nodiscard]] async<confirmation_callback_t> co_thread_get(snowflake thread_id);

/**
* @brief Edit current (bot) user
*
Expand Down
13 changes: 13 additions & 0 deletions include/dpp/cluster_sync_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -2535,6 +2535,19 @@ confirmation thread_member_add_sync(snowflake thread_id, snowflake user_id);
*/
confirmation thread_member_remove_sync(snowflake thread_id, snowflake user_id);

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

/**
* @brief Edit current (bot) user
*
Expand Down
4 changes: 4 additions & 0 deletions src/dpp/cluster_coro_calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,10 @@ async<confirmation_callback_t> cluster::co_thread_member_remove(snowflake thread
return async{ this, static_cast<void (cluster::*)(snowflake, snowflake, command_completion_event_t)>(&cluster::thread_member_remove), thread_id, user_id };
}

async<confirmation_callback_t> cluster::co_thread_get(snowflake thread_id) {
return async{ this, static_cast<void (cluster::*)(snowflake, command_completion_event_t)>(&cluster::thread_get), thread_id };
}

async<confirmation_callback_t> cluster::co_current_user_edit(const std::string &nickname, const std::string& image_blob, const image_type type) {
return async{ this, static_cast<void (cluster::*)(const std::string &, const std::string&, const image_type, command_completion_event_t)>(&cluster::current_user_edit), nickname, image_blob, type };
}
Expand Down
4 changes: 4 additions & 0 deletions src/dpp/cluster_sync_calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,10 @@ confirmation cluster::thread_member_remove_sync(snowflake thread_id, snowflake u
return dpp::sync<confirmation>(this, static_cast<void (cluster::*)(snowflake, snowflake, command_completion_event_t)>(&cluster::thread_member_remove), thread_id, user_id);
}

thread cluster::thread_get_sync(snowflake thread_id) {
return dpp::sync<thread>(this, static_cast<void (cluster::*)(snowflake, command_completion_event_t)>(&cluster::thread_get), thread_id);
}

user cluster::current_user_edit_sync(const std::string &nickname, const std::string& image_blob, const image_type type) {
return dpp::sync<user>(this, static_cast<void (cluster::*)(const std::string &, const std::string&, const image_type, command_completion_event_t)>(&cluster::current_user_edit), nickname, image_blob, type);
}
Expand Down

0 comments on commit d0f4e3b

Please sign in to comment.