// // Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #pragma once #include "td/telegram/td_api.h" #include "td/telegram/telegram_api.h" #include "td/telegram/UserId.h" #include "td/utils/common.h" #include "td/utils/Promise.h" #include "td/utils/tl_helpers.h" namespace td { class Td; class BotCommand { string command_; string description_; friend bool operator==(const BotCommand &lhs, const BotCommand &rhs); public: BotCommand() = default; BotCommand(string command, string description) : command_(std::move(command)), description_(std::move(description)) { } explicit BotCommand(telegram_api::object_ptr &&bot_command); td_api::object_ptr get_bot_command_object() const; telegram_api::object_ptr get_input_bot_command() const; template void store(StorerT &storer) const { td::store(command_, storer); td::store(description_, storer); } template void parse(ParserT &parser) { td::parse(command_, parser); td::parse(description_, parser); } }; bool operator==(const BotCommand &lhs, const BotCommand &rhs); inline bool operator!=(const BotCommand &lhs, const BotCommand &rhs) { return !(lhs == rhs); } class BotCommands { UserId bot_user_id_; vector commands_; friend bool operator==(const BotCommands &lhs, const BotCommands &rhs); public: BotCommands() = default; BotCommands(UserId bot_user_id, vector> &&bot_commands); td_api::object_ptr get_bot_commands_object(Td *td) const; UserId get_bot_user_id() const { return bot_user_id_; } template void store(StorerT &storer) const { td::store(bot_user_id_, storer); td::store(commands_, storer); } template void parse(ParserT &parser) { td::parse(bot_user_id_, parser); td::parse(commands_, parser); } }; bool operator==(const BotCommands &lhs, const BotCommands &rhs); inline bool operator!=(const BotCommands &lhs, const BotCommands &rhs) { return !(lhs == rhs); } void set_commands(Td *td, td_api::object_ptr &&scope_ptr, string &&language_code, vector> &&commands, Promise &&promise); void delete_commands(Td *td, td_api::object_ptr &&scope_ptr, string &&language_code, Promise &&promise); void get_commands(Td *td, td_api::object_ptr &&scope_ptr, string &&language_code, Promise> &&promise); } // namespace td