#pragma once #include #include #include #include #include #include #include enum class BotCommandType { SHORTEN }; struct ShortenCommand { std::string url; dpp::slashcommand_t event; }; struct BotCommand { BotCommand(ShortenCommand&&); BotCommand(BotCommand&&); ~BotCommand(); BotCommandType type; union { ShortenCommand shortenCmd; }; }; class DiscordClient { public: DiscordClient(uv_loop_t *loop, std::string token); ~DiscordClient(); bool start(); bool stop(); std::function on_shorten_command; private: static void uv_callback(uv_async_t *h); bool m_running = false; uv_loop_t *m_eventLoop; uv_async_t *m_eventHandle = nullptr; std::unique_ptr m_bot; std::queue m_commandQueue; std::mutex m_commandQueueMutex; std::string m_botToken; };