diff --git a/include/dpp/dispatcher.h b/include/dpp/dispatcher.h index a77d2cf0fe..364205e303 100644 --- a/include/dpp/dispatcher.h +++ b/include/dpp/dispatcher.h @@ -62,7 +62,7 @@ class discord_voice_client; /** * @brief A function used as a callback for any REST based command */ -using command_completion_event_t = std::function ; +using command_completion_event_t = std::function; /** @brief Base event parameter struct. * Each event you receive from the library will have its parameter derived from this class. @@ -72,11 +72,6 @@ using command_completion_event_t = std::functionfrom->creator->message_create(std::move(msg), std::move(callback)); } -void interaction_create_t::reply(interaction_response_type t, const message & m, command_completion_event_t callback) const { +void interaction_create_t::reply(interaction_response_type t, const message& m, command_completion_event_t callback) const { from->creator->interaction_response_create(this->command.id, this->command.token, dpp::interaction_response(t, m), std::move(callback)); } -void interaction_create_t::reply(const message & m, command_completion_event_t callback) const { +void interaction_create_t::reply(const message& m, command_completion_event_t callback) const { from->creator->interaction_response_create( this->command.id, this->command.token, @@ -137,32 +137,32 @@ void interaction_create_t::dialog(const interaction_modal_response& mr, command_ from->creator->interaction_response_create(this->command.id, this->command.token, mr, std::move(callback)); } -void interaction_create_t::reply(interaction_response_type t, const std::string & mt, command_completion_event_t callback) const { +void interaction_create_t::reply(interaction_response_type t, const std::string& mt, command_completion_event_t callback) const { this->reply(t, dpp::message(this->command.channel_id, mt, mt_application_command), std::move(callback)); } -void interaction_create_t::reply(const std::string & mt, command_completion_event_t callback) const { +void interaction_create_t::reply(const std::string& mt, command_completion_event_t callback) const { this->reply(ir_channel_message_with_source, dpp::message(this->command.channel_id, mt, mt_application_command), callback); } -void interaction_create_t::edit_response(const message & m, command_completion_event_t callback) const { +void interaction_create_t::edit_response(const message& m, command_completion_event_t callback) const { from->creator->interaction_response_edit(this->command.token, m, std::move(callback)); } -void interaction_create_t::edit_response(const std::string & mt, command_completion_event_t callback) const { +void interaction_create_t::edit_response(const std::string& mt, command_completion_event_t callback) const { this->edit_response(dpp::message(this->command.channel_id, mt, mt_application_command), std::move(callback)); } void interaction_create_t::get_original_response(command_completion_event_t callback) const { - from->creator->post_rest(API_PATH "/webhooks", std::to_string(command.application_id), command.token + "/messages/@original", m_get, "", [creator = this->from->creator, cb = std::move(callback)](json &j, const http_request_completion_t& http) { + from->creator->post_rest(API_PATH "/webhooks", std::to_string(command.application_id), command.token + "/messages/@original", m_get, "", [creator = this->from->creator, cb = std::move(callback)](json& j, const http_request_completion_t& http) { if (cb) { cb(confirmation_callback_t(creator, message().fill_from_json(&j), http)); } }); } -void interaction_create_t::edit_original_response(const message & m, command_completion_event_t callback) const { - from->creator->post_rest_multipart(API_PATH "/webhooks", std::to_string(command.application_id), command.token + "/messages/@original", m_patch, m.build_json(), [creator = this->from->creator, cb = std::move(callback)](json &j, const http_request_completion_t& http) { +void interaction_create_t::edit_original_response(const message& m, command_completion_event_t callback) const { + from->creator->post_rest_multipart(API_PATH "/webhooks", std::to_string(command.application_id), command.token + "/messages/@original", m_patch, m.build_json(), [creator = this->from->creator, cb = std::move(callback)](json& j, const http_request_completion_t& http) { if (cb) { cb(confirmation_callback_t(creator, message().fill_from_json(&j), http)); } @@ -183,19 +183,19 @@ async interaction_create_t::co_reply() const { return dpp::async{[this] (T&& cb) { this->reply(std::forward(cb)); }}; } -async interaction_create_t::co_reply(interaction_response_type t, const message & m) const { +async interaction_create_t::co_reply(interaction_response_type t, const message& m) const { return dpp::async{[&, this] (T&& cb) { this->reply(t, m, std::forward(cb)); }}; } -async interaction_create_t::co_reply(interaction_response_type t, const std::string & mt) const { +async interaction_create_t::co_reply(interaction_response_type t, const std::string& mt) const { return dpp::async{[&, this] (T&& cb) { this->reply(t, mt, std::forward(cb)); }}; } -async interaction_create_t::co_reply(const message & m) const { +async interaction_create_t::co_reply(const message& m) const { return dpp::async{[&, this] (T&& cb) { this->reply(m, std::forward(cb)); }}; } -async interaction_create_t::co_reply(const std::string & mt) const { +async interaction_create_t::co_reply(const std::string& mt) const { return dpp::async{[&, this] (T&& cb) { this->reply(mt, std::forward(cb)); }}; } @@ -203,11 +203,11 @@ async interaction_create_t::co_dialog(const interaction return dpp::async{[&, this] (T&& cb) { this->dialog(mr, std::forward(cb)); }}; } -async interaction_create_t::co_edit_response(const message & m) const { +async interaction_create_t::co_edit_response(const message& m) const { return dpp::async{[&, this] (T&& cb) { this->edit_response(m, std::forward(cb)); }}; } -async interaction_create_t::co_edit_response(const std::string & mt) const { +async interaction_create_t::co_edit_response(const std::string& mt) const { return dpp::async{[&, this] (T&& cb) { this->edit_response(mt, std::forward(cb)); }}; } @@ -219,7 +219,7 @@ async interaction_create_t::co_get_original_response() return dpp::async{[&, this] (T&& cb) { this->get_original_response(std::forward(cb)); }}; } -async interaction_create_t::co_edit_original_response(const message & m) const { +async interaction_create_t::co_edit_original_response(const message& m) const { return dpp::async{[&, this] (T&& cb) { this->edit_original_response(m, std::forward(cb)); }}; } diff --git a/src/unittest/test.cpp b/src/unittest/test.cpp index df4549dfbb..8173c6842c 100644 --- a/src/unittest/test.cpp +++ b/src/unittest/test.cpp @@ -332,83 +332,85 @@ Markdown lol \\|\\|spoiler\\|\\| \\~\\~strikethrough\\~\\~ \\`small \\*code\\* b { // dpp event classes start_test(EVENT_CLASS); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::log_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_user_add_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_user_remove_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::automod_rule_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::automod_rule_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::automod_rule_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::automod_rule_execute_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::stage_instance_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::stage_instance_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::stage_instance_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_state_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::interaction_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::slashcommand_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::button_click_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::form_submit_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::autocomplete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::context_menu_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_context_menu_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::user_context_menu_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::select_click_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_stickers_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_join_request_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::channel_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::channel_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::ready_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_member_remove_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::resumed_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_role_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::typing_start_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_track_marker_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_reaction_add_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_members_chunk_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_reaction_remove_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::channel_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_reaction_remove_emoji_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_delete_bulk_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_role_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_role_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::channel_pins_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_reaction_remove_all_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_server_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_emojis_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::presence_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::webhooks_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_member_add_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::invite_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_integrations_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_member_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::invite_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::user_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_audit_log_entry_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_ban_add_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_ban_remove_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::integration_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::integration_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::integration_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_create_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_delete_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_list_sync_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_member_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_members_update_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_buffer_send_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_user_talking_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_ready_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_receive_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_client_speaking_t); - DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_client_disconnect_t); + bool success = true; + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::log_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_user_add_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_user_remove_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_scheduled_event_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::automod_rule_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::automod_rule_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::automod_rule_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::automod_rule_execute_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::stage_instance_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::stage_instance_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::stage_instance_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_state_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::interaction_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::slashcommand_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::button_click_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::form_submit_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::autocomplete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::context_menu_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_context_menu_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::user_context_menu_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::select_click_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_stickers_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_join_request_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::channel_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::channel_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::ready_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_member_remove_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::resumed_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_role_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::typing_start_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_track_marker_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_reaction_add_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_members_chunk_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_reaction_remove_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::channel_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_reaction_remove_emoji_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_delete_bulk_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_role_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_role_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::channel_pins_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_reaction_remove_all_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_server_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_emojis_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::presence_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::webhooks_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_member_add_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::invite_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_integrations_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_member_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::invite_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::user_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::message_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_audit_log_entry_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_ban_add_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::guild_ban_remove_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::integration_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::integration_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::integration_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_create_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_delete_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_list_sync_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_member_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::thread_members_update_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_buffer_send_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_user_talking_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_ready_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_receive_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_client_speaking_t, success); + DPP_CHECK_CONSTRUCT_ASSIGN(EVENT_CLASS, dpp::voice_client_disconnect_t, success); + set_test(EVENT_CLASS, success); } diff --git a/src/unittest/test.h b/src/unittest/test.h index bbd77e0aac..1b8de4c64a 100644 --- a/src/unittest/test.h +++ b/src/unittest/test.h @@ -549,19 +549,19 @@ inline constexpr auto is_owner = [](auto &&user) noexcept { return get_user_snowflake(user) == TEST_USER_ID; }; -#define DPP_RUNTIME_CHECK(test, check) if (!check) set_status(test, ts_failed, "check failed: " #check) -#define DPP_COMPILETIME_CHECK(test, check) static_assert(check, #test ": " #check) +#define DPP_RUNTIME_CHECK(test, check, var) if (!check) { var = false; set_status(test, ts_failed, "check failed: " #check); } +#define DPP_COMPILETIME_CHECK(test, check, var) static_assert(check, #test ": " #check) #ifndef DPP_STATIC_TEST -#define DPP_CHECK(test, check) DPP_RUNTIME_CHECK(test, check) +#define DPP_CHECK(test, check, var) DPP_RUNTIME_CHECK(test, check, var) #else -#define DPP_CHECK(test, check) DPP_COMPILETIME_CHECK(test, check) +#define DPP_CHECK(test, check, var) DPP_COMPILETIME_CHECK(test, check, var) #endif -#define DPP_CHECK_CONSTRUCT_ASSIGN(test, type) do { \ - DPP_CHECK(test, std::is_default_constructible_v); \ - DPP_CHECK(test, std::is_copy_constructible_v); \ - DPP_CHECK(test, std::is_move_constructible_v); \ - DPP_CHECK(test, std::is_copy_assignable_v); \ - DPP_CHECK(test, std::is_move_assignable_v); \ +#define DPP_CHECK_CONSTRUCT_ASSIGN(test, type, var) do { \ + DPP_CHECK(test, std::is_default_constructible_v, var); \ + DPP_CHECK(test, std::is_copy_constructible_v, var); \ + DPP_CHECK(test, std::is_move_constructible_v, var); \ + DPP_CHECK(test, std::is_copy_assignable_v, var); \ + DPP_CHECK(test, std::is_move_assignable_v, var); \ } while(0)