1 // 2 // Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021 3 // 4 // Distributed under the Boost Software License, Version 1.0. (See accompanying 5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 // 7 #pragma once 8 9 #include "td/telegram/FullMessageId.h" 10 #include "td/telegram/td_api.h" 11 #include "td/telegram/telegram_api.h" 12 #include "td/telegram/UserId.h" 13 14 #include "td/actor/actor.h" 15 #include "td/actor/PromiseFuture.h" 16 17 #include "td/utils/common.h" 18 19 namespace td { 20 21 class Td; 22 23 class GameManager final : public Actor { 24 public: 25 GameManager(Td *td, ActorShared<> parent); 26 GameManager(const GameManager &) = delete; 27 GameManager &operator=(const GameManager &) = delete; 28 GameManager(GameManager &&) = delete; 29 GameManager &operator=(GameManager &&) = delete; 30 ~GameManager() final; 31 32 void set_game_score(FullMessageId full_message_id, bool edit_message, UserId user_id, int32 score, bool force, 33 Promise<td_api::object_ptr<td_api::message>> &&promise); 34 35 void set_inline_game_score(const string &inline_message_id, bool edit_message, UserId user_id, int32 score, 36 bool force, Promise<Unit> &&promise); 37 38 void get_game_high_scores(FullMessageId full_message_id, UserId user_id, 39 Promise<td_api::object_ptr<td_api::gameHighScores>> &&promise); 40 41 void get_inline_game_high_scores(const string &inline_message_id, UserId user_id, 42 Promise<td_api::object_ptr<td_api::gameHighScores>> &&promise); 43 44 td_api::object_ptr<td_api::gameHighScores> get_game_high_scores_object( 45 telegram_api::object_ptr<telegram_api::messages_highScores> &&high_scores); 46 47 private: 48 void tear_down() final; 49 50 void on_set_game_score(FullMessageId full_message_id, Promise<td_api::object_ptr<td_api::message>> &&promise); 51 52 Td *td_; 53 ActorShared<> parent_; 54 }; 55 56 } // namespace td 57