/** * MTKruto - Cross-runtime JavaScript library for building Telegram clients * Copyright (C) 2023-2026 Roj * * This file is part of MTKruto. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import { Api } from "../2_tl.js"; import { type ChatPhoto } from "./0_chat_photo.js"; import { type EmojiStatus } from "./0_emoji_status.js"; import { type RestrictionReason } from "./0_restriction_reason.js"; import { type UserStatus } from "./0_user_status.js"; /** @unlisted */ export type ChatType = "private" | "group" | "supergroup" | "channel"; /** @unlisted */ export interface _ChatPBase { /** The identifier of the chat. */ id: number; /** The type of the chat. */ type: ChatType; /** Identifier of a color that can be displayed instead of the chat's photo. */ color: number; /** The chat's photo. */ photo?: ChatPhoto; } /** @unlisted */ export interface ChatPPrivate extends _ChatPBase { type: "private"; /** Whether this is a bot's chat. */ isBot: boolean; /** The first name of the user. */ firstName: string; /** The last name of the user. */ lastName?: string; /** The user's main username. */ username?: string; /** The user's phone number. */ phoneNumber?: string; /** The user's additional usernames. */ also?: string[]; /** The user's status. */ status?: UserStatus; /** The user's emoji status. */ emojiStatus?: EmojiStatus; /** Whether the user is the current user. */ isSelf: boolean; /** Whether the user has been deleted. */ isDeleted: boolean; /** Whether the user is a contact. */ isContact: boolean; /** Whether the user is a mutual contact. */ isMutualContact: boolean; /** Whether the user is a close friend. */ isCloseFriend: boolean; /** The user's [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag). */ languageCode?: string; /** Whether the user has been identified as scam. */ isScam: boolean; /** Whether the user has been identified as an impersonator. */ isFake: boolean; /** Whether the user is subscribed to Telegram Premium. */ isPremium: boolean; /** Whether the user has been verified. */ isVerified: boolean; /** Whether the user is official support. */ isSupport: boolean; /** Whether the user has been restricted. */ isRestricted: boolean; /** The reason why the user has been restricted. */ restrictionReason?: RestrictionReason[]; /** Whether the user is a bot that has been added to the attachment menu by the current user. */ isAddedToAttachmentsMenu?: boolean; /** Whether the user is a bot that has been added to the attachment menu by the current user. */ hasMainMiniApp?: boolean; /** Whether the user is a bot that supports guest queries. */ isGuestQuerySupported?: boolean; } /** @unlisted */ export interface ChatPGroup extends _ChatPBase { type: "group"; /** The title of the chat. */ title: string; /** Whether the current user is the owner of the chat. */ isCreator: boolean; } /** @unlisted */ export interface ChatPChannelBase extends _ChatPBase { /** The title of the chat or channel. */ title: string; /** The main username of the chat or channel. */ username?: string; /** The chat or channel's additional usernames. */ also?: string[]; /** Whether the chat or channel has been identified as scam. */ isScam: boolean; /** Whether the chat or channel has been identified as an impersonator. */ isFake: boolean; /** Whether the chat or channel has been verified. */ isVerified: boolean; /** Whether the chat or channel has been restricted. */ isRestricted: boolean; /** The reason why the chat or channel has been restricted. */ restrictionReason?: RestrictionReason[]; } /** @unlisted */ export interface ChatPChannel extends ChatPChannelBase { type: "channel"; /** The channel's emoji status. */ emojiStatus?: EmojiStatus; } /** @unlisted */ export interface ChatPSupergroup extends ChatPChannelBase { type: "supergroup"; /** Whether the chat is a forum. */ isForum: boolean; } /** A chat with lesser fields. */ export type ChatP = ChatPPrivate | ChatPGroup | ChatPSupergroup | ChatPChannel; export declare function constructChatP(chat: Api.user): ChatPPrivate; export declare function constructChatP(chat: Api.chat | Api.chatForbidden): ChatPGroup; export declare function constructChatP(chat: Api.channel | Api.channelForbidden): ChatPSupergroup | ChatPChannel; export declare function constructChatP(chat: Api.User | Api.Chat): ChatP; /** @unlisted */ export interface PeerGetter { (peer: Api.peerUser): [ChatPPrivate, bigint] | null; (peer: Api.peerChat): [ChatPGroup, bigint] | null; (peer: Api.peerChannel): [ChatPChannel | ChatPSupergroup, bigint] | null; (peer: Api.peerUser | Api.peerChat | Api.peerChannel): [ChatP, bigint] | null; } export declare function isChatPUser(chatP: ChatP): chatP is ChatPPrivate; //# sourceMappingURL=1_chat_p.d.ts.map