2021-09-07 09:02:44 +02:00
|
|
|
//
|
2022-12-31 22:28:08 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
2021-09-07 09:02:44 +02:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
#include "td/telegram/MessageFullId.h"
|
2021-09-07 09:45:01 +02:00
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
|
|
|
#include "td/telegram/UserId.h"
|
|
|
|
|
2021-09-07 09:02:44 +02:00
|
|
|
#include "td/actor/actor.h"
|
2021-09-07 09:45:01 +02:00
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
2022-06-27 12:30:18 +02:00
|
|
|
#include "td/utils/Promise.h"
|
2021-09-07 09:02:44 +02:00
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Td;
|
|
|
|
|
|
|
|
class GameManager final : public Actor {
|
|
|
|
public:
|
|
|
|
GameManager(Td *td, ActorShared<> parent);
|
|
|
|
GameManager(const GameManager &) = delete;
|
|
|
|
GameManager &operator=(const GameManager &) = delete;
|
|
|
|
GameManager(GameManager &&) = delete;
|
|
|
|
GameManager &operator=(GameManager &&) = delete;
|
|
|
|
~GameManager() final;
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void set_game_score(MessageFullId message_full_id, bool edit_message, UserId user_id, int32 score, bool force,
|
2021-09-07 11:05:44 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::message>> &&promise);
|
2021-09-07 09:45:01 +02:00
|
|
|
|
|
|
|
void set_inline_game_score(const string &inline_message_id, bool edit_message, UserId user_id, int32 score,
|
|
|
|
bool force, Promise<Unit> &&promise);
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void get_game_high_scores(MessageFullId message_full_id, UserId user_id,
|
2021-09-07 09:45:01 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::gameHighScores>> &&promise);
|
|
|
|
|
|
|
|
void get_inline_game_high_scores(const string &inline_message_id, UserId user_id,
|
|
|
|
Promise<td_api::object_ptr<td_api::gameHighScores>> &&promise);
|
|
|
|
|
|
|
|
td_api::object_ptr<td_api::gameHighScores> get_game_high_scores_object(
|
|
|
|
telegram_api::object_ptr<telegram_api::messages_highScores> &&high_scores);
|
|
|
|
|
2021-09-07 09:02:44 +02:00
|
|
|
private:
|
|
|
|
void tear_down() final;
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void on_set_game_score(MessageFullId message_full_id, Promise<td_api::object_ptr<td_api::message>> &&promise);
|
2021-09-07 11:05:44 +02:00
|
|
|
|
2021-09-07 09:02:44 +02:00
|
|
|
Td *td_;
|
|
|
|
ActorShared<> parent_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|