From e4dc9f359236928ce249d7dc8cc504bd0d962fa5 Mon Sep 17 00:00:00 2001 From: Amber Ehrlich Date: Sat, 6 Jul 2024 02:38:01 -0400 Subject: [PATCH] misc(coro): remove long-deprecated dpp::job event handlers --- include/dpp/event_router.h | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/include/dpp/event_router.h b/include/dpp/event_router.h index 1657fbd592..2babc42e29 100644 --- a/include/dpp/event_router.h +++ b/include/dpp/event_router.h @@ -478,7 +478,7 @@ template class event_router_t { * saving it in a variable is recommended to avoid variable lifetime issues. * * @details Example: @code{cpp} - * dpp::job my_handler(dpp::slashcommand_t event) { + * dpp::task<> my_handler(const dpp::slashcommand_t& event) { * co_await event.co_reply(dpp::message().add_component(dpp::component().add_component().set_label("click me!").set_id("test"))); * * dpp::button_click_t b = co_await c->on_button_click.with([](const dpp::button_click_t &event){ return event.custom_id == "test"; }); @@ -514,7 +514,7 @@ template class event_router_t { * * Example: * @details Example: @code{cpp} - * dpp::job my_handler(dpp::slashcommand_t event) { + * dpp::task<> my_handler(const dpp::slashcommand_t& event) { * co_await event.co_reply(dpp::message().add_component(dpp::component().add_component().set_label("click me!").set_id("test"))); * * dpp::button_click_t b = co_await c->on_message_create; @@ -607,7 +607,7 @@ template class event_router_t { * detach the listener from the event later if necessary. */ template - requires (utility::callable_returns || utility::callable_returns, const T&> || utility::callable_returns) + requires (utility::callable_returns, const T&> || utility::callable_returns) [[maybe_unused]] event_handle operator()(F&& fun) { return this->attach(std::forward(fun)); } @@ -649,28 +649,6 @@ template class event_router_t { dispatch_container.emplace(std::piecewise_construct, std::forward_as_tuple(h), std::forward_as_tuple(std::in_place_type_t{}, std::forward(fun))); return h; } - - /** - * @brief Attach a callable to the event, adding a listener. - * The callable should either be of the form `void(const T&)` or - * `dpp::task(const T&)`, where T is the event type for this event router. - * - * @deprecated dpp::job event handlers are deprecated and will be removed in a future version, use dpp::task instead. - * @param fun Callable to attach to event - * @return event_handle An event handle unique to this event, used to - * detach the listener from the event later if necessary. - */ - template - requires (utility::callable_returns) - DPP_DEPRECATED("dpp::job event handlers are deprecated and will be removed in a future version, use dpp::task instead") - [[maybe_unused]] event_handle attach(F&& fun) { - assert(dpp::utility::is_coro_enabled()); - - std::unique_lock l(mutex); - event_handle h = next_handle++; - dispatch_container.emplace(std::piecewise_construct, std::forward_as_tuple(h), std::forward_as_tuple(std::in_place_type_t{}, std::forward(fun))); - return h; - } # else /** * @brief Attach a callable to the event, adding a listener.