Skip to main content

telegram_webapp_sdk/mock/
data.rs

1// SPDX-FileCopyrightText: 2025 RAprogramm <andrey.rozanov.vl@gmail.com>
2// SPDX-License-Identifier: MIT
3
4use serde::{Deserialize, Serialize};
5
6/// Mocked Telegram user, mirroring the Telegram WebApp `WebAppUser` object.
7#[derive(Serialize, Deserialize, Default)]
8pub struct MockTelegramUser {
9    /// Unique identifier of the user.
10    pub id:                 u64,
11    /// First name of the user.
12    pub first_name:         String,
13    /// Last name of the user, if set.
14    pub last_name:          Option<String>,
15    /// Telegram username, without the leading `@`, if set.
16    pub username:           Option<String>,
17    /// IETF language tag of the user's language (e.g. `en`), if known.
18    pub language_code:      Option<String>,
19    /// Whether the user has a Telegram Premium subscription.
20    pub is_premium:         Option<bool>,
21    /// Whether the user allowed the bot to message them in private chat.
22    pub allows_write_to_pm: Option<bool>
23}