diff --git a/src/api/gramjs/apiBuilders/messages.ts b/src/api/gramjs/apiBuilders/messages.ts index 5214ee2c4..f727ec98e 100644 --- a/src/api/gramjs/apiBuilders/messages.ts +++ b/src/api/gramjs/apiBuilders/messages.ts @@ -828,6 +828,14 @@ function buildReplyButtons(message: UniversalMessage, shouldSkipBuyButton?: bool }; } + if (button instanceof GramJs.KeyboardButtonCopy) { + return { + type: 'copy', + text, + copyText: button.copyText, + }; + } + return { type: 'unsupported', text, diff --git a/src/api/gramjs/apiBuilders/payments.ts b/src/api/gramjs/apiBuilders/payments.ts index 018f21351..1333c8103 100644 --- a/src/api/gramjs/apiBuilders/payments.ts +++ b/src/api/gramjs/apiBuilders/payments.ts @@ -136,7 +136,11 @@ export function buildApiReceipt(receipt: GramJs.payments.TypePaymentReceipt): Ap }; } -export function buildApiPaymentForm(form: GramJs.payments.TypePaymentForm): ApiPaymentForm { +export function buildApiPaymentForm(form: GramJs.payments.TypePaymentForm): ApiPaymentForm | undefined { + if (form instanceof GramJs.payments.PaymentFormStarGift) { + return undefined; + } + if (form instanceof GramJs.payments.PaymentFormStars) { const { botId, formId } = form; @@ -220,7 +224,11 @@ export function buildApiPaymentForm(form: GramJs.payments.TypePaymentForm): ApiP }; } -export function buildApiInvoiceFromForm(form: GramJs.payments.TypePaymentForm): ApiInvoice { +export function buildApiInvoiceFromForm(form: GramJs.payments.TypePaymentForm): ApiInvoice | undefined { + if (form instanceof GramJs.payments.PaymentFormStarGift) { + return undefined; + } + const { invoice, description: text, title, photo, } = form; diff --git a/src/api/gramjs/methods/messages.ts b/src/api/gramjs/methods/messages.ts index d36c13590..3ee7b86e6 100644 --- a/src/api/gramjs/methods/messages.ts +++ b/src/api/gramjs/methods/messages.ts @@ -69,7 +69,6 @@ import { buildInputPollFromExisting, buildInputReaction, buildInputReplyTo, - buildInputReportReason, buildInputStory, buildInputTextWithEntities, buildMessageFromUpdate, @@ -887,14 +886,14 @@ export async function deleteSavedHistory({ } export async function reportMessages({ - peer, messageIds, reason, description, + peer, messageIds, description, }: { peer: ApiPeer; messageIds: number[]; reason: ApiReportReason; description?: string; }) { const result = await invokeRequest(new GramJs.messages.Report({ peer: buildInputPeer(peer.id, peer.accessHash), id: messageIds, - reason: buildInputReportReason(reason), + option: Buffer.alloc(0), message: description, })); diff --git a/src/api/gramjs/methods/payments.ts b/src/api/gramjs/methods/payments.ts index 7a1aed1ee..39a849cb4 100644 --- a/src/api/gramjs/methods/payments.ts +++ b/src/api/gramjs/methods/payments.ts @@ -176,7 +176,7 @@ export async function getPaymentForm(inputInvoice: ApiRequestInputInvoice, theme themeParams: theme ? buildInputThemeParams(theme) : undefined, })); - if (!result) { + if (!result || result instanceof GramJs.payments.PaymentFormStarGift) { return undefined; } @@ -185,8 +185,8 @@ export async function getPaymentForm(inputInvoice: ApiRequestInputInvoice, theme } return { - form: buildApiPaymentForm(result), - invoice: buildApiInvoiceFromForm(result), + form: buildApiPaymentForm(result)!, + invoice: buildApiInvoiceFromForm(result)!, }; } diff --git a/src/api/gramjs/methods/stories.ts b/src/api/gramjs/methods/stories.ts index ae7d4feba..0e3ce55de 100644 --- a/src/api/gramjs/methods/stories.ts +++ b/src/api/gramjs/methods/stories.ts @@ -24,7 +24,6 @@ import { buildInputPeer, buildInputPrivacyRules, buildInputReaction, - buildInputReportReason, } from '../gramjsBuilders'; import { addStoryToLocalDb } from '../helpers'; import { invokeRequest } from './client'; @@ -332,7 +331,6 @@ export async function fetchStoryLink({ peer, storyId }: { peer: ApiPeer ; storyI export function reportStory({ peer, storyId, - reason, description, }: { peer: ApiPeer; storyId: number; reason: ApiReportReason; description?: string; @@ -340,7 +338,7 @@ export function reportStory({ return invokeRequest(new GramJs.stories.Report({ peer: buildInputPeer(peer.id, peer.accessHash), id: [storyId], - reason: buildInputReportReason(reason), + option: Buffer.alloc(0), message: description, })); } diff --git a/src/api/types/messages.ts b/src/api/types/messages.ts index cf791df92..8c9f39651 100644 --- a/src/api/types/messages.ts +++ b/src/api/types/messages.ts @@ -895,11 +895,11 @@ interface ApiKeyboardButtonUrlAuth { buttonId: number; } -export type ApiTranscription = { +interface ApiKeyboardButtonCopy { + type: 'copy'; text: string; - isPending?: boolean; - transcriptionId: string; -}; + copyText: string; +} export type ApiKeyboardButton = ( ApiKeyboardButtonSimple @@ -912,6 +912,7 @@ export type ApiKeyboardButton = ( | ApiKeyboardButtonWebView | ApiKeyboardButtonSimpleWebView | ApiKeyboardButtonUrlAuth + | ApiKeyboardButtonCopy ); export type ApiKeyboardButtons = ApiKeyboardButton[][]; @@ -923,6 +924,12 @@ export type ApiReplyKeyboard = { [K in 'inlineButtons' | 'keyboardButtons']?: ApiKeyboardButtons; }; +export type ApiTranscription = { + text: string; + isPending?: boolean; + transcriptionId: string; +}; + export type ApiMessageSearchType = 'text' | 'media' | 'documents' | 'links' | 'audio' | 'voice' | 'profilePhoto'; export type ApiGlobalMessageSearchType = 'text' | 'channels' | 'media' | 'documents' | 'links' | 'audio' | 'voice'; diff --git a/src/components/common/Composer.tsx b/src/components/common/Composer.tsx index 7127370a7..7a50d7b85 100644 --- a/src/components/common/Composer.tsx +++ b/src/components/common/Composer.tsx @@ -42,7 +42,6 @@ import { HEART_REACTION, MAX_UPLOAD_FILEPART_SIZE, ONE_TIME_MEDIA_TTL_SECONDS, - REPLIES_USER_ID, SCHEDULED_WHEN_ONLINE, SEND_MESSAGE_ACTION_INTERVAL, SERVICE_NOTIFICATIONS_USER_ID, @@ -57,6 +56,7 @@ import { isChatChannel, isChatSuperGroup, isSameReaction, + isSystemBot, isUserId, } from '../../global/helpers'; import { @@ -2075,7 +2075,7 @@ export default memo(withGlobal( chatId, threadId, storyId, messageListType, isMobile, type, }): StateProps => { const chat = selectChat(global, chatId); - const chatBot = chatId !== REPLIES_USER_ID ? selectBot(global, chatId) : undefined; + const chatBot = !isSystemBot(chatId) ? selectBot(global, chatId) : undefined; const isChatWithBot = Boolean(chatBot); const isChatWithSelf = selectIsChatWithSelf(global, chatId); const isChatWithUser = isUserId(chatId); diff --git a/src/components/common/DeleteMessageModal.tsx b/src/components/common/DeleteMessageModal.tsx index 09cd2edf3..c94209751 100644 --- a/src/components/common/DeleteMessageModal.tsx +++ b/src/components/common/DeleteMessageModal.tsx @@ -12,13 +12,13 @@ import type { import type { IAlbum } from '../../types'; import type { IRadioOption } from '../ui/CheckboxGroup'; -import { REPLIES_USER_ID } from '../../config'; import { getHasAdminRight, getPrivateChatUserId, getUserFirstOrLastName, getUserFullName, isChatBasicGroup, isChatSuperGroup, isOwnMessage, + isSystemBot, isUserId, } from '../../global/helpers'; import { @@ -449,7 +449,7 @@ export default memo(withGlobal( : undefined; const isChatWithBot = Boolean(deleteMessageModal && deleteMessageModal.message && selectBot(global, deleteMessageModal.message.chatId)); - const chatBot = Boolean(chat && chat.id !== REPLIES_USER_ID && selectBot(global, chat.id)); + const chatBot = Boolean(chat && !isSystemBot(chat.id) && selectBot(global, chat.id)); const canBanUsers = chat && (chat.isCreator || getHasAdminRight(chat, 'banUsers')); const isOwn = deleteMessageModal && deleteMessageModal.message && isOwnMessage(deleteMessageModal.message); diff --git a/src/components/common/FullNameTitle.tsx b/src/components/common/FullNameTitle.tsx index c43a05abf..e63e9e158 100644 --- a/src/components/common/FullNameTitle.tsx +++ b/src/components/common/FullNameTitle.tsx @@ -10,7 +10,12 @@ import type { CustomPeer } from '../../types'; import { EMOJI_STATUS_LOOP_LIMIT } from '../../config'; import { - getChatTitle, getUserFullName, isAnonymousForwardsChat, isChatWithRepliesBot, isPeerUser, + getChatTitle, + getUserFullName, + isAnonymousForwardsChat, + isChatWithRepliesBot, + isChatWithVerificationCodesBot, + isPeerUser, } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; import { copyTextToClipboard } from '../../util/clipboard'; @@ -95,19 +100,13 @@ const FullNameTitle: FC = ({ return lang('RepliesTitle'); } + if (isChatWithVerificationCodesBot(realPeer!.id)) { + return lang('VerifyCodesNotifications'); + } + return undefined; }, [customPeer, isSavedDialog, isSavedMessages, lang, realPeer]); - if (specialTitle) { - return ( -
-

- {specialTitle} -

-
- ); - } - return (

= ({ )} onClick={handleTitleClick} > - {renderText(title || '')} + {specialTitle || renderText(title || '')}

{!iconElement && peer && ( <> diff --git a/src/components/common/PrivateChatInfo.tsx b/src/components/common/PrivateChatInfo.tsx index 336e2f33a..1e6c3a67d 100644 --- a/src/components/common/PrivateChatInfo.tsx +++ b/src/components/common/PrivateChatInfo.tsx @@ -10,7 +10,7 @@ import type { IconName } from '../../types/icons'; import { MediaViewerOrigin } from '../../types'; import { - getMainUsername, getUserStatus, isUserOnline, + getMainUsername, getUserStatus, isSystemBot, isUserOnline, } from '../../global/helpers'; import { selectChatMessages, selectUser, selectUserStatus } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; @@ -170,6 +170,10 @@ const PrivateChatInfo: FC = ({ return ; } + if (isSystemBot(user.id)) { + return undefined; + } + const translatedStatus = getUserStatus(lang, user, userStatus); const mainUserNameClassName = buildClassName('handle', translatedStatus && 'withStatus'); return ( diff --git a/src/components/common/ProfileInfo.tsx b/src/components/common/ProfileInfo.tsx index ee24b3e15..df4065e26 100644 --- a/src/components/common/ProfileInfo.tsx +++ b/src/components/common/ProfileInfo.tsx @@ -8,7 +8,7 @@ import type { import { MediaViewerOrigin } from '../../types'; import { - getUserStatus, isAnonymousForwardsChat, isChatChannel, isUserOnline, + getUserStatus, isAnonymousForwardsChat, isChatChannel, isSystemBot, isUserOnline, } from '../../global/helpers'; import { selectChat, @@ -251,7 +251,8 @@ const ProfileInfo: FC = ({ function renderStatus() { const isAnonymousForwards = isAnonymousForwardsChat(peerId); - if (isAnonymousForwards) return undefined; + const isSystemBotChat = isSystemBot(peerId); + if (isAnonymousForwards || isSystemBotChat) return undefined; if (user) { return ( diff --git a/src/components/common/helpers/renderTextWithEntities.tsx b/src/components/common/helpers/renderTextWithEntities.tsx index 710edf664..61468b5d7 100644 --- a/src/components/common/helpers/renderTextWithEntities.tsx +++ b/src/components/common/helpers/renderTextWithEntities.tsx @@ -498,8 +498,8 @@ function processEntity({ case ApiMessageEntityTypes.Code: return ( ) => { if (!containerId) return; - e.preventDefault(); - e.stopPropagation(); + if (!isRevealed) { + stopEvent(e); + } revealByContainerId.get(containerId)?.forEach((reveal) => reveal()); }); diff --git a/src/components/left/settings/SettingsExperimental.tsx b/src/components/left/settings/SettingsExperimental.tsx index 7ac49b4a1..8c1771844 100644 --- a/src/components/left/settings/SettingsExperimental.tsx +++ b/src/components/left/settings/SettingsExperimental.tsx @@ -24,7 +24,6 @@ type OwnProps = { }; type StateProps = { - shouldShowLoginCodeInChatList?: boolean; shouldForceHttpTransport?: boolean; shouldAllowHttpTransport?: boolean; shouldCollectDebugLogs?: boolean; @@ -34,7 +33,6 @@ type StateProps = { const SettingsExperimental: FC = ({ isActive, onReset, - shouldShowLoginCodeInChatList, shouldForceHttpTransport, shouldAllowHttpTransport, shouldCollectDebugLogs, @@ -84,13 +82,6 @@ const SettingsExperimental: FC = ({
Launch some confetti!
- setSettingOption({ shouldShowLoginCodeInChatList: !shouldShowLoginCodeInChatList })} - /> - = ({ export default memo(withGlobal( (global): StateProps => { return { - shouldShowLoginCodeInChatList: global.settings.byKey.shouldShowLoginCodeInChatList, shouldForceHttpTransport: global.settings.byKey.shouldForceHttpTransport, shouldAllowHttpTransport: global.settings.byKey.shouldAllowHttpTransport, shouldCollectDebugLogs: global.settings.byKey.shouldCollectDebugLogs, diff --git a/src/components/middle/HeaderMenuContainer.tsx b/src/components/middle/HeaderMenuContainer.tsx index e1a8cdbb0..406bce0b9 100644 --- a/src/components/middle/HeaderMenuContainer.tsx +++ b/src/components/middle/HeaderMenuContainer.tsx @@ -9,7 +9,6 @@ import type { IAnchorPosition, ThreadId } from '../../types'; import type { IconName } from '../../types/icons'; import { MAIN_THREAD_ID } from '../../api/types'; -import { REPLIES_USER_ID } from '../../config'; import { getCanAddContact, getCanDeleteChat, @@ -18,6 +17,7 @@ import { getIsSavedDialog, isChatChannel, isChatGroup, + isSystemBot, isUserId, isUserRightBanned, selectIsChatMuted, @@ -752,7 +752,7 @@ export default memo(withGlobal( const canReportChat = isMainThread && (isChatChannel(chat) || isChatGroup(chat) || (user && !user.isSelf)); const { chatId: currentChatId, threadId: currentThreadId } = selectCurrentMessageList(global) || {}; - const chatBot = chatId !== REPLIES_USER_ID ? selectBot(global, chatId) : undefined; + const chatBot = !isSystemBot(chatId) ? selectBot(global, chatId) : undefined; const userFullInfo = isPrivate ? selectUserFullInfo(global, chatId) : undefined; const chatFullInfo = !isPrivate ? selectChatFullInfo(global, chatId) : undefined; const fullInfo = userFullInfo || chatFullInfo; diff --git a/src/components/middle/MessageList.tsx b/src/components/middle/MessageList.tsx index f2a1da3a4..ecf8c77b2 100644 --- a/src/components/middle/MessageList.tsx +++ b/src/components/middle/MessageList.tsx @@ -26,7 +26,7 @@ import { isAnonymousForwardsChat, isChatChannel, isChatGroup, - isChatWithRepliesBot, + isSystemBot, isUserId, } from '../../global/helpers'; import { @@ -101,7 +101,7 @@ type StateProps = { isChannelChat?: boolean; isGroupChat?: boolean; isChatWithSelf?: boolean; - isRepliesChat?: boolean; + isSystemBotChat?: boolean; isAnonymousForwards?: boolean; isCreator?: boolean; isChannelWithAvatars?: boolean; @@ -156,7 +156,7 @@ const MessageList: FC = ({ isSynced, isReady, isChatWithSelf, - isRepliesChat, + isSystemBotChat, isAnonymousForwards, isCreator, isBot, @@ -629,7 +629,7 @@ const MessageList: FC = ({ const isPrivate = isUserId(chatId); const withUsers = Boolean((!isPrivate && !isChannelChat) - || isChatWithSelf || isRepliesChat || isAnonymousForwards || isChannelWithAvatars); + || isChatWithSelf || isSystemBotChat || isAnonymousForwards || isChannelWithAvatars); const noAvatars = Boolean(!withUsers || (isChannelChat && !isChannelWithAvatars)); const shouldRenderGreeting = isUserId(chatId) && !isChatWithSelf && !isBot && !isAnonymousForwards && type === 'thread' @@ -783,7 +783,7 @@ export default memo(withGlobal( isChannelWithAvatars: chat.areProfilesShown, isCreator: chat.isCreator, isChatWithSelf: selectIsChatWithSelf(global, chatId), - isRepliesChat: isChatWithRepliesBot(chatId), + isSystemBotChat: isSystemBot(chatId), isAnonymousForwards: isAnonymousForwardsChat(chatId), isBot: Boolean(chatBot), isSynced: global.isSynced, diff --git a/src/components/middle/MessageListBotInfo.module.scss b/src/components/middle/MessageListBotInfo.module.scss index 98760cf64..c2aa2dfec 100644 --- a/src/components/middle/MessageListBotInfo.module.scss +++ b/src/components/middle/MessageListBotInfo.module.scss @@ -22,6 +22,7 @@ .bot-info-description { padding: 0.5rem 1rem; + text-wrap: pretty; } .bot-info-title { diff --git a/src/components/middle/MessageListBotInfo.tsx b/src/components/middle/MessageListBotInfo.tsx index fbb6d7e7f..2fedc32c3 100644 --- a/src/components/middle/MessageListBotInfo.tsx +++ b/src/components/middle/MessageListBotInfo.tsx @@ -9,6 +9,7 @@ import { getPhotoFullDimensions, getVideoDimensions, getVideoMediaHash, + isChatWithVerificationCodesBot, } from '../../global/helpers'; import { selectBot, selectUserFullInfo } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; @@ -34,6 +35,7 @@ type StateProps = { }; const MessageListBotInfo: FC = ({ + chatId, botInfo, isLoadingBotInfo, isInMessageList, @@ -46,6 +48,8 @@ const MessageListBotInfo: FC = ({ ? getVideoDimensions(botInfo.gif) : undefined; const isBotInfoEmpty = botInfo && !botInfo.description && !botInfo.gif && !botInfo.photo; + const isVerifyCodes = isChatWithVerificationCodesBot(chatId); + const { width, height } = botInfoDimensions || {}; const isEmptyOrLoading = isBotInfoEmpty || isLoadingBotInfo; @@ -92,7 +96,12 @@ const MessageListBotInfo: FC = ({ forceAspectRatio /> )} - {botInfo.description && ( + {isVerifyCodes && ( +
+ {lang('VerifyChatInfo')} +
+ )} + {!isVerifyCodes && botInfo.description && (

{lang('BotInfoTitle')}

{renderText(botInfo.description, ['br', 'emoji', 'links'])} diff --git a/src/components/middle/message/InlineButtons.tsx b/src/components/middle/message/InlineButtons.tsx index e985a1bf4..481a144ac 100644 --- a/src/components/middle/message/InlineButtons.tsx +++ b/src/components/middle/message/InlineButtons.tsx @@ -41,6 +41,8 @@ const InlineButtons: FC = ({ message, onClick }) => { case 'webView': case 'simpleWebView': return ; + case 'copy': + return ; } return undefined; }; diff --git a/src/components/middle/message/Message.tsx b/src/components/middle/message/Message.tsx index 113c657c3..0e93d9a04 100644 --- a/src/components/middle/message/Message.tsx +++ b/src/components/middle/message/Message.tsx @@ -55,12 +55,12 @@ import { isChatChannel, isChatGroup, isChatPublic, - isChatWithRepliesBot, isGeoLiveExpired, isMessageLocal, isMessageTranslatable, isOwnMessage, isReplyToMessage, + isSystemBot, isUserId, } from '../../../global/helpers'; import { getMessageReplyInfo, getStoryReplyInfo } from '../../../global/helpers/replies'; @@ -1690,7 +1690,7 @@ export default memo(withGlobal( const chat = selectChat(global, chatId); const isChatWithSelf = selectIsChatWithSelf(global, chatId); - const isRepliesChat = isChatWithRepliesBot(chatId); + const isSystemBotChat = isSystemBot(chatId); const isAnonymousForwards = isAnonymousForwardsChat(chatId); const isChannel = chat && isChatChannel(chat); const isGroup = chat && isChatGroup(chat); @@ -1719,11 +1719,12 @@ export default memo(withGlobal( const replyMessage = replyToMsgId ? selectChatMessage(global, replyToPeerId || chatId, replyToMsgId) : undefined; const forwardHeader = forwardInfo || replyFrom; const replyMessageSender = replyMessage ? selectSender(global, replyMessage) - : forwardHeader && !isRepliesChat && !isAnonymousForwards + : forwardHeader && !isSystemBotChat && !isAnonymousForwards ? selectSenderFromHeader(global, forwardHeader) : undefined; const replyMessageForwardSender = replyMessage && selectForwardedSender(global, replyMessage); const replyMessageChat = replyToPeerId ? selectChat(global, replyToPeerId) : undefined; - const isReplyPrivate = !isRepliesChat && !isAnonymousForwards && replyMessageChat && !isChatPublic(replyMessageChat) + const isReplyPrivate = !isSystemBotChat && !isAnonymousForwards && replyMessageChat + && !isChatPublic(replyMessageChat) && (replyMessageChat.isNotJoined || replyMessageChat.isRestricted); const isReplyToTopicStart = replyMessage?.content.action?.type === 'topicCreate'; const replyStory = storyReplyId && storyReplyPeerId @@ -1827,7 +1828,7 @@ export default memo(withGlobal( isForwarding, reactionMessage, isChatWithSelf, - isRepliesChat, + isRepliesChat: isSystemBotChat, isAnonymousForwards, isChannel, isGroup, diff --git a/src/components/middle/search/MiddleSearch.tsx b/src/components/middle/search/MiddleSearch.tsx index fb6a0916c..2f5cbf90b 100644 --- a/src/components/middle/search/MiddleSearch.tsx +++ b/src/components/middle/search/MiddleSearch.tsx @@ -13,9 +13,11 @@ import type { CustomPeer, MiddleSearchParams, MiddleSearchType, ThreadId, } from '../../../types'; -import { ANONYMOUS_USER_ID, REPLIES_USER_ID } from '../../../config'; +import { ANONYMOUS_USER_ID } from '../../../config'; import { requestMeasure, requestMutation, requestNextMutation } from '../../../lib/fasterdom/fasterdom'; -import { getIsSavedDialog, getReactionKey, isSameReaction } from '../../../global/helpers'; +import { + getIsSavedDialog, getReactionKey, isSameReaction, isSystemBot, +} from '../../../global/helpers'; import { selectChat, selectChatMessage, @@ -404,7 +406,7 @@ const MiddleSearch: FC = ({ return undefined; } - const originalSender = (isSavedMessages || chatId === REPLIES_USER_ID || chatId === ANONYMOUS_USER_ID) + const originalSender = (isSavedMessages || isSystemBot(chatId) || chatId === ANONYMOUS_USER_ID) ? selectForwardedSender(global, message) : undefined; const messageSender = selectSender(global, message); const messageChat = selectChat(global, message.chatId); diff --git a/src/config.ts b/src/config.ts index 34aa76496..7033ed19a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -303,6 +303,7 @@ export const HEART_REACTION: ApiReactionEmoji = { // MTProto constants export const SERVICE_NOTIFICATIONS_USER_ID = '777000'; export const REPLIES_USER_ID = '1271266957'; // TODO For Test connection ID must be equal to 708513 +export const VERIFICATION_CODES_USER_ID = '489000'; export const ANONYMOUS_USER_ID = '2666000'; export const RESTRICTED_EMOJI_SET_ID = '7173162320003080'; export const CHANNEL_ID_LENGTH = 14; // 14 symbols, based on TDLib's `ZERO_CHANNEL_ID = -1000000000000` diff --git a/src/global/actions/api/bots.ts b/src/global/actions/api/bots.ts index eccae4e40..0b8983ed9 100644 --- a/src/global/actions/api/bots.ts +++ b/src/global/actions/api/bots.ts @@ -10,6 +10,7 @@ import { import { ManagementProgress } from '../../../types'; import { BOT_FATHER_USERNAME, GENERAL_REFETCH_INTERVAL } from '../../../config'; +import { copyTextToClipboard } from '../../../util/clipboard'; import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { oldTranslate } from '../../../util/oldLangProvider'; import PopupManager from '../../../util/PopupManager'; @@ -78,6 +79,11 @@ addActionHandler('clickBotInlineButton', (global, actions, payload): ActionRetur actions.openUrl({ url, tabId }); break; } + case 'copy': { + copyTextToClipboard(button.copyText); + actions.showNotification({ message: oldTranslate('ExactTextCopied', button.copyText), tabId }); + break; + } case 'callback': { void answerCallbackButton(global, actions, chat, messageId, button.data, undefined, tabId); break; diff --git a/src/global/actions/api/messages.ts b/src/global/actions/api/messages.ts index 1f7306fc1..1a796ddf8 100644 --- a/src/global/actions/api/messages.ts +++ b/src/global/actions/api/messages.ts @@ -831,6 +831,13 @@ addActionHandler('reportMessages', async (global, actions, payload): Promise return; } + // TODO: Remove after implementing the new report system + if (storyId) { + // eslint-disable-next-line no-console + console.warn('UNSUPPORTED'); + return; + } + const result = await callApi('reportStory', { peer, storyId, diff --git a/src/global/helpers/bots.ts b/src/global/helpers/bots.ts index 85f57721e..3cb16b7c8 100644 --- a/src/global/helpers/bots.ts +++ b/src/global/helpers/bots.ts @@ -3,6 +3,8 @@ import type { WebApp, } from '../types'; +import { REPLIES_USER_ID, VERIFICATION_CODES_USER_ID } from '../../config'; + export function getBotCoverMediaHash(photo: ApiPhoto) { return `photo${photo.id}?size=x`; } @@ -20,3 +22,7 @@ export function getWebAppKey(webApp: Partial) { if (webApp.appName) return `${webApp.botId}?appName=${webApp.appName}`; return webApp.botId; } + +export function isSystemBot(botId: string) { + return botId === REPLIES_USER_ID || botId === VERIFICATION_CODES_USER_ID; +} diff --git a/src/global/helpers/chats.ts b/src/global/helpers/chats.ts index e713b26d7..8ccf2d6af 100644 --- a/src/global/helpers/chats.ts +++ b/src/global/helpers/chats.ts @@ -18,10 +18,12 @@ import { MAIN_THREAD_ID } from '../../api/types'; import { ANONYMOUS_USER_ID, ARCHIVED_FOLDER_ID, CHANNEL_ID_LENGTH, GENERAL_TOPIC_ID, REPLIES_USER_ID, TME_LINK_PREFIX, + VERIFICATION_CODES_USER_ID, } from '../../config'; import { formatDateToString, formatTime } from '../../util/dates/dateFormat'; import { prepareSearchWordsForNeedle } from '../../util/searchWords'; import { getGlobal } from '..'; +import { isSystemBot } from './bots'; import { getMainUsername, getUserFirstOrLastName } from './users'; const FOREVER_BANNED_DATE = Date.now() / 1000 + 31622400; // 366 days @@ -70,6 +72,10 @@ export function isChatWithRepliesBot(chatId: string) { return chatId === REPLIES_USER_ID; } +export function isChatWithVerificationCodesBot(chatId: string) { + return chatId === VERIFICATION_CODES_USER_ID; +} + export function isAnonymousForwardsChat(chatId: string) { return chatId === ANONYMOUS_USER_ID; } @@ -163,7 +169,7 @@ export function getCanPostInChat( } if (chat.isRestricted || chat.isForbidden || chat.migratedTo - || (!isMessageThread && chat.isNotJoined) || isChatWithRepliesBot(chat.id) || isAnonymousForwardsChat(chat.id)) { + || (!isMessageThread && chat.isNotJoined) || isSystemBot(chat.id) || isAnonymousForwardsChat(chat.id)) { return false; } diff --git a/src/global/helpers/messages.ts b/src/global/helpers/messages.ts index c8903bf58..657995027 100644 --- a/src/global/helpers/messages.ts +++ b/src/global/helpers/messages.ts @@ -19,6 +19,7 @@ import { SUPPORTED_PHOTO_CONTENT_TYPES, SUPPORTED_VIDEO_CONTENT_TYPES, TME_LINK_PREFIX, + VERIFICATION_CODES_USER_ID, VIDEO_STICKER_MIME_TYPE, } from '../../config'; import { areSortedArraysIntersecting, unique } from '../../util/iteratees'; @@ -279,20 +280,41 @@ export function extractMessageText(message: ApiMessage | ApiStory, inChatList = const { text } = contentText; let { entities } = contentText; - if (text && inChatList && 'chatId' in message && message.chatId === SERVICE_NOTIFICATIONS_USER_ID - // eslint-disable-next-line eslint-multitab-tt/no-immediate-global - && !getGlobal().settings.byKey.shouldShowLoginCodeInChatList) { - const authCode = text.match(/^\D*([\d-]{5,7})\D/)?.[1]; - if (authCode) { - entities = [ - ...entities || [], - { - type: ApiMessageEntityTypes.Spoiler, - offset: text.indexOf(authCode), - length: authCode.length, - }, - ]; - entities.sort((a, b) => (a.offset > b.offset ? 1 : -1)); + if (text && inChatList && 'chatId' in message) { + if (message.chatId === SERVICE_NOTIFICATIONS_USER_ID) { + const authCode = text.match(/^\D*([\d-]{5,7})\D/)?.[1]; + if (authCode) { + entities = [ + ...entities || [], + { + type: ApiMessageEntityTypes.Spoiler, + offset: text.indexOf(authCode), + length: authCode.length, + }, + ]; + entities.sort((a, b) => (a.offset > b.offset ? 1 : -1)); + } + } + + if (message.chatId === VERIFICATION_CODES_USER_ID && entities) { + // Wrap code entities in spoiler + const hasCodeEntities = entities.some((entity) => entity.type === ApiMessageEntityTypes.Code); + if (hasCodeEntities) { + const oldEntities = entities; + entities = []; + + for (let i = 0; i < oldEntities.length; i++) { + const entity = oldEntities[i]; + if (entity.type === ApiMessageEntityTypes.Code) { + entities.push({ + type: ApiMessageEntityTypes.Spoiler, + offset: entity.offset, + length: entity.length, + }); + } + entities.push(entity); + } + } } } diff --git a/src/global/selectors/messages.ts b/src/global/selectors/messages.ts index 7d97d6e57..c612e56ab 100644 --- a/src/global/selectors/messages.ts +++ b/src/global/selectors/messages.ts @@ -16,7 +16,7 @@ import type { import { ApiMessageEntityTypes, MAIN_THREAD_ID } from '../../api/types'; import { - ANONYMOUS_USER_ID, GENERAL_TOPIC_ID, REPLIES_USER_ID, SERVICE_NOTIFICATIONS_USER_ID, + ANONYMOUS_USER_ID, GENERAL_TOPIC_ID, SERVICE_NOTIFICATIONS_USER_ID, } from '../../config'; import { getCurrentTabId } from '../../util/establishMultitabRole'; import { findLast } from '../../util/iteratees'; @@ -1314,7 +1314,7 @@ export function selectShouldSchedule( export function selectCanScheduleUntilOnline(global: T, id: string) { const isChatWithSelf = selectIsChatWithSelf(global, id); - const chatBot = id === REPLIES_USER_ID && selectBot(global, id); + const chatBot = selectBot(global, id); return Boolean( !isChatWithSelf && !chatBot && isUserId(id) && selectUserStatus(global, id)?.wasOnline, ); diff --git a/src/lib/gramjs/tl/AllTLObjects.js b/src/lib/gramjs/tl/AllTLObjects.js index a1c1d4228..ec926b893 100644 --- a/src/lib/gramjs/tl/AllTLObjects.js +++ b/src/lib/gramjs/tl/AllTLObjects.js @@ -1,6 +1,6 @@ const api = require('./api'); -const LAYER = 188; +const LAYER = 189; const tlobjects = {}; for (const tl of Object.values(api)) { diff --git a/src/lib/gramjs/tl/api.d.ts b/src/lib/gramjs/tl/api.d.ts index 763eed2d0..8eb00831b 100644 --- a/src/lib/gramjs/tl/api.d.ts +++ b/src/lib/gramjs/tl/api.d.ts @@ -70,7 +70,7 @@ namespace Api { export type TypeChatPhoto = ChatPhotoEmpty | ChatPhoto; export type TypeMessage = MessageEmpty | Message | MessageService; export type TypeMessageMedia = MessageMediaEmpty | MessageMediaPhoto | MessageMediaGeo | MessageMediaContact | MessageMediaUnsupported | MessageMediaDocument | MessageMediaWebPage | MessageMediaVenue | MessageMediaGame | MessageMediaInvoice | MessageMediaGeoLive | MessageMediaPoll | MessageMediaDice | MessageMediaStory | MessageMediaGiveaway | MessageMediaGiveawayResults | MessageMediaPaidMedia; - export type TypeMessageAction = MessageActionEmpty | MessageActionChatCreate | MessageActionChatEditTitle | MessageActionChatEditPhoto | MessageActionChatDeletePhoto | MessageActionChatAddUser | MessageActionChatDeleteUser | MessageActionChatJoinedByLink | MessageActionChannelCreate | MessageActionChatMigrateTo | MessageActionChannelMigrateFrom | MessageActionPinMessage | MessageActionHistoryClear | MessageActionGameScore | MessageActionPaymentSentMe | MessageActionPaymentSent | MessageActionPhoneCall | MessageActionScreenshotTaken | MessageActionCustomAction | MessageActionBotAllowed | MessageActionSecureValuesSentMe | MessageActionSecureValuesSent | MessageActionContactSignUp | MessageActionGeoProximityReached | MessageActionGroupCall | MessageActionInviteToGroupCall | MessageActionSetMessagesTTL | MessageActionGroupCallScheduled | MessageActionSetChatTheme | MessageActionChatJoinedByRequest | MessageActionWebViewDataSentMe | MessageActionWebViewDataSent | MessageActionGiftPremium | MessageActionTopicCreate | MessageActionTopicEdit | MessageActionSuggestProfilePhoto | MessageActionRequestedPeer | MessageActionSetChatWallPaper | MessageActionGiftCode | MessageActionGiveawayLaunch | MessageActionGiveawayResults | MessageActionBoostApply | MessageActionRequestedPeerSentMe | MessageActionPaymentRefunded | MessageActionGiftStars | MessageActionPrizeStars; + export type TypeMessageAction = MessageActionEmpty | MessageActionChatCreate | MessageActionChatEditTitle | MessageActionChatEditPhoto | MessageActionChatDeletePhoto | MessageActionChatAddUser | MessageActionChatDeleteUser | MessageActionChatJoinedByLink | MessageActionChannelCreate | MessageActionChatMigrateTo | MessageActionChannelMigrateFrom | MessageActionPinMessage | MessageActionHistoryClear | MessageActionGameScore | MessageActionPaymentSentMe | MessageActionPaymentSent | MessageActionPhoneCall | MessageActionScreenshotTaken | MessageActionCustomAction | MessageActionBotAllowed | MessageActionSecureValuesSentMe | MessageActionSecureValuesSent | MessageActionContactSignUp | MessageActionGeoProximityReached | MessageActionGroupCall | MessageActionInviteToGroupCall | MessageActionSetMessagesTTL | MessageActionGroupCallScheduled | MessageActionSetChatTheme | MessageActionChatJoinedByRequest | MessageActionWebViewDataSentMe | MessageActionWebViewDataSent | MessageActionGiftPremium | MessageActionTopicCreate | MessageActionTopicEdit | MessageActionSuggestProfilePhoto | MessageActionRequestedPeer | MessageActionSetChatWallPaper | MessageActionGiftCode | MessageActionGiveawayLaunch | MessageActionGiveawayResults | MessageActionBoostApply | MessageActionRequestedPeerSentMe | MessageActionPaymentRefunded | MessageActionGiftStars | MessageActionPrizeStars | MessageActionStarGift; export type TypeDialog = Dialog | DialogFolder; export type TypePhoto = PhotoEmpty | Photo; export type TypePhotoSize = PhotoSizeEmpty | PhotoSize | PhotoCachedSize | PhotoStrippedSize | PhotoSizeProgressive | PhotoPathSize; @@ -278,7 +278,7 @@ namespace Api { export type TypeBotMenuButton = BotMenuButtonDefault | BotMenuButtonCommands | BotMenuButton; export type TypeNotificationSound = NotificationSoundDefault | NotificationSoundNone | NotificationSoundLocal | NotificationSoundRingtone; export type TypeAttachMenuPeerType = AttachMenuPeerTypeSameBotPM | AttachMenuPeerTypeBotPM | AttachMenuPeerTypePM | AttachMenuPeerTypeChat | AttachMenuPeerTypeBroadcast; - export type TypeInputInvoice = InputInvoiceMessage | InputInvoiceSlug | InputInvoicePremiumGiftCode | InputInvoiceStars | InputInvoiceChatInviteSubscription; + export type TypeInputInvoice = InputInvoiceMessage | InputInvoiceSlug | InputInvoicePremiumGiftCode | InputInvoiceStars | InputInvoiceChatInviteSubscription | InputInvoiceStarGift; export type TypeInputStorePaymentPurpose = InputStorePaymentPremiumSubscription | InputStorePaymentGiftPremium | InputStorePaymentPremiumGiftCode | InputStorePaymentPremiumGiveaway | InputStorePaymentStarsTopup | InputStorePaymentStarsGift | InputStorePaymentStarsGiveaway; export type TypePremiumGiftOption = PremiumGiftOption; export type TypePaymentFormMethod = PaymentFormMethod; @@ -377,6 +377,10 @@ namespace Api { export type TypeMessageReactor = MessageReactor; export type TypeStarsGiveawayOption = StarsGiveawayOption; export type TypeStarsGiveawayWinnersOption = StarsGiveawayWinnersOption; + export type TypeStarGift = StarGift; + export type TypeUserStarGift = UserStarGift; + export type TypeMessageReportOption = MessageReportOption; + export type TypeReportResult = ReportResultChooseOption | ReportResultAddComment | ReportResultReported; export type TypeResPQ = ResPQ; export type TypeP_Q_inner_data = PQInnerData | PQInnerDataDc | PQInnerDataTemp | PQInnerDataTempDc; export type TypeServer_DH_Params = ServerDHParamsFail | ServerDHParamsOk; @@ -565,7 +569,7 @@ namespace Api { } export namespace payments { - export type TypePaymentForm = payments.PaymentForm | payments.PaymentFormStars; + export type TypePaymentForm = payments.PaymentForm | payments.PaymentFormStars | payments.PaymentFormStarGift; export type TypeValidatedRequestedInfo = payments.ValidatedRequestedInfo; export type TypePaymentResult = payments.PaymentResult | payments.PaymentVerificationNeeded; export type TypePaymentReceipt = payments.PaymentReceipt | payments.PaymentReceiptStars; @@ -578,6 +582,8 @@ namespace Api { export type TypeStarsRevenueStats = payments.StarsRevenueStats; export type TypeStarsRevenueWithdrawalUrl = payments.StarsRevenueWithdrawalUrl; export type TypeStarsRevenueAdsAccountUrl = payments.StarsRevenueAdsAccountUrl; + export type TypeStarGifts = payments.StarGiftsNotModified | payments.StarGifts; + export type TypeUserStarGifts = payments.UserStarGifts; } export namespace phone { @@ -2322,6 +2328,23 @@ namespace Api { boostPeer: Api.TypePeer; giveawayMsgId: int; }; + export class MessageActionStarGift extends VirtualClass<{ + // flags: undefined; + nameHidden?: true; + saved?: true; + converted?: true; + gift: Api.TypeStarGift; + message?: Api.TypeTextWithEntities; + convertStars: long; + }> { + // flags: undefined; + nameHidden?: true; + saved?: true; + converted?: true; + gift: Api.TypeStarGift; + message?: Api.TypeTextWithEntities; + convertStars: long; + }; export class Dialog extends VirtualClass<{ // flags: undefined; pinned?: true; @@ -2658,6 +2681,7 @@ namespace Api { birthday?: Api.TypeBirthday; personalChannelId?: long; personalChannelMessage?: int; + stargiftsCount?: int; }> { // flags: undefined; blocked?: true; @@ -2702,6 +2726,7 @@ namespace Api { birthday?: Api.TypeBirthday; personalChannelId?: long; personalChannelMessage?: int; + stargiftsCount?: int; }; export class Contact extends VirtualClass<{ userId: long; @@ -8822,6 +8847,19 @@ namespace Api { }> { hash: string; }; + export class InputInvoiceStarGift extends VirtualClass<{ + // flags: undefined; + hideName?: true; + userId: Api.TypeInputUser; + giftId: long; + message?: Api.TypeTextWithEntities; + }> { + // flags: undefined; + hideName?: true; + userId: Api.TypeInputUser; + giftId: long; + message?: Api.TypeTextWithEntities; + }; export class InputStorePaymentPremiumSubscription extends VirtualClass<{ // flags: undefined; restore?: true; @@ -10279,6 +10317,7 @@ namespace Api { extendedMedia?: Api.TypeMessageMedia[]; subscriptionPeriod?: int; giveawayPostId?: int; + stargift?: Api.TypeStarGift; }> { // flags: undefined; refund?: true; @@ -10300,6 +10339,7 @@ namespace Api { extendedMedia?: Api.TypeMessageMedia[]; subscriptionPeriod?: int; giveawayPostId?: int; + stargift?: Api.TypeStarGift; }; export class FoundStory extends VirtualClass<{ peer: Api.TypePeer; @@ -10442,6 +10482,70 @@ namespace Api { users: int; perUserStars: long; }; + export class StarGift extends VirtualClass<{ + // flags: undefined; + limited?: true; + id: long; + sticker: Api.TypeDocument; + stars: long; + availabilityRemains?: int; + availabilityTotal?: int; + convertStars: long; + }> { + // flags: undefined; + limited?: true; + id: long; + sticker: Api.TypeDocument; + stars: long; + availabilityRemains?: int; + availabilityTotal?: int; + convertStars: long; + }; + export class UserStarGift extends VirtualClass<{ + // flags: undefined; + nameHidden?: true; + unsaved?: true; + fromId?: long; + date: int; + gift: Api.TypeStarGift; + message?: Api.TypeTextWithEntities; + msgId?: int; + convertStars?: long; + }> { + // flags: undefined; + nameHidden?: true; + unsaved?: true; + fromId?: long; + date: int; + gift: Api.TypeStarGift; + message?: Api.TypeTextWithEntities; + msgId?: int; + convertStars?: long; + }; + export class MessageReportOption extends VirtualClass<{ + text: string; + option: bytes; + }> { + text: string; + option: bytes; + }; + export class ReportResultChooseOption extends VirtualClass<{ + title: string; + options: Api.TypeMessageReportOption[]; + }> { + title: string; + options: Api.TypeMessageReportOption[]; + }; + export class ReportResultAddComment extends VirtualClass<{ + // flags: undefined; + optional?: true; + option: bytes; + }> { + // flags: undefined; + optional?: true; + option: bytes; + }; + export class ReportResultReported extends VirtualClass {}; export class ResPQ extends VirtualClass<{ nonce: int128; serverNonce: int128; @@ -12525,6 +12629,13 @@ namespace Api { invoice: Api.TypeInvoice; users: Api.TypeUser[]; }; + export class PaymentFormStarGift extends VirtualClass<{ + formId: long; + invoice: Api.TypeInvoice; + }> { + formId: long; + invoice: Api.TypeInvoice; + }; export class ValidatedRequestedInfo extends VirtualClass<{ // flags: undefined; id?: string; @@ -12724,6 +12835,27 @@ namespace Api { }> { url: string; }; + export class StarGiftsNotModified extends VirtualClass {}; + export class StarGifts extends VirtualClass<{ + hash: int; + gifts: Api.TypeStarGift[]; + }> { + hash: int; + gifts: Api.TypeStarGift[]; + }; + export class UserStarGifts extends VirtualClass<{ + // flags: undefined; + count: int; + gifts: Api.TypeUserStarGift[]; + nextOffset?: string; + users: Api.TypeUser[]; + }> { + // flags: undefined; + count: int; + gifts: Api.TypeUserStarGift[]; + nextOffset?: string; + users: Api.TypeUser[]; + }; } export namespace phone { @@ -14743,12 +14875,12 @@ namespace Api { export class Report extends Request, Bool> { + }>, Api.TypeReportResult> { peer: Api.TypeInputPeer; id: int[]; - reason: Api.TypeReportReason; + option: bytes; message: string; }; export class GetChats extends Request, payments.TypePaymentResult> { - // flags: undefined; formId: long; invoice: Api.TypeInputInvoice; }; @@ -17859,6 +17989,38 @@ namespace Api { subscriptionId: string; }; export class GetStarsGiveawayOptions extends Request {}; + export class GetStarGifts extends Request, payments.TypeStarGifts> { + hash: int; + }; + export class GetUserStarGifts extends Request, payments.TypeUserStarGifts> { + userId: Api.TypeInputUser; + offset: string; + limit: int; + }; + export class SaveStarGift extends Request, Bool> { + // flags: undefined; + unsave?: true; + userId: Api.TypeInputUser; + msgId: int; + }; + export class ConvertStarGift extends Request, Bool> { + userId: Api.TypeInputUser; + msgId: int; + }; } export namespace stickers { @@ -18631,12 +18793,12 @@ namespace Api { export class Report extends Request, Bool> { + }>, Api.TypeReportResult> { peer: Api.TypeInputPeer; id: int[]; - reason: Api.TypeReportReason; + option: bytes; message: string; }; export class ActivateStealthMode extends Request wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int = UserFull; +userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; importedContact#c13e3c50 user_id:long client_id:long = ImportedContact; contactStatus#16d9703b user_id:long status:UserStatus = ContactStatus; @@ -752,6 +753,7 @@ inputWebFileAudioAlbumThumbLocation#f46fe924 flags:# small:flags.2?true document upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; payments.paymentForm#a0058751 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice provider_id:long url:string native_provider:flags.4?string native_params:flags.4?DataJSON additional_methods:flags.6?Vector saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?Vector users:Vector = payments.PaymentForm; payments.paymentFormStars#7bf6b15c flags:# form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice users:Vector = payments.PaymentForm; +payments.paymentFormStarGift#b425cfe1 form_id:long invoice:Invoice = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult; @@ -1113,6 +1115,7 @@ inputInvoiceSlug#c326caef slug:string = InputInvoice; inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:PremiumGiftCodeOption = InputInvoice; inputInvoiceStars#65f00ce3 purpose:InputStorePaymentPurpose = InputInvoice; inputInvoiceChatInviteSubscription#34e793f1 hash:string = InputInvoice; +inputInvoiceStarGift#25d8c1d8 flags:# hide_name:flags.0?true user_id:InputUser gift_id:long message:flags.1?TextWithEntities = InputInvoice; payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice; messages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio; help.premiumPromo#5334759c status_text:string status_entities:Vector video_sections:Vector videos:Vector period_options:Vector users:Vector = help.PremiumPromo; @@ -1330,7 +1333,7 @@ starsTransactionPeerFragment#e92fd902 = StarsTransactionPeer; starsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer; starsTransactionPeerAds#60682812 = StarsTransactionPeer; starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#ee7522d5 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int = StarsTransaction; +starsTransaction#a9ee4c2 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift = StarsTransaction; payments.starsStatus#bbfa316c flags:# balance:long subscriptions:flags.1?Vector subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; foundStory#e87acbc0 peer:Peer story:StoryItem = FoundStory; stories.foundStories#e2de7737 flags:# count:int stories:Vector next_offset:flags.0?string chats:Vector users:Vector = stories.FoundStories; @@ -1349,6 +1352,15 @@ starsSubscription#538ecf18 flags:# canceled:flags.0?true can_refulfill:flags.1?t messageReactor#4ba3a95a flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer count:int = MessageReactor; starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true stars:long yearly_boosts:int store_product:flags.2?string currency:string amount:long winners:Vector = StarsGiveawayOption; starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; +starGift#aea174ee flags:# limited:flags.0?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long = StarGift; +payments.starGiftsNotModified#a388a368 = payments.StarGifts; +payments.starGifts#901689ea hash:int gifts:Vector = payments.StarGifts; +userStarGift#eea49a6e flags:# name_hidden:flags.0?true unsaved:flags.5?true from_id:flags.1?long date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int convert_stars:flags.4?long = UserStarGift; +payments.userStarGifts#6b65b517 flags:# count:int gifts:Vector next_offset:flags.0?string users:Vector = payments.UserStarGifts; +messageReportOption#7903e3d9 text:string option:bytes = MessageReportOption; +reportResultChooseOption#f0e4e0b6 title:string options:Vector = ReportResult; +reportResultAddComment#6f09ac31 flags:# optional:flags.0?true option:bytes = ReportResult; +reportResultReported#8db33c4b = ReportResult; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; initConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X; @@ -1439,7 +1451,7 @@ messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings; -messages.report#8953ab4e peer:InputPeer id:Vector reason:ReportReason message:string = Bool; +messages.report#fc78af9b peer:InputPeer id:Vector option:bytes message:string = ReportResult; messages.getChats#49e9528f id:Vector = messages.Chats; messages.getFullChat#aeb00b34 chat_id:long = messages.ChatFull; messages.editChatTitle#73783ffd chat_id:long title:string = Updates; @@ -1650,7 +1662,7 @@ payments.launchPrepaidGiveaway#5ff58f20 peer:InputPeer giveaway_id:long purpose: payments.getStarsTopupOptions#c00ec7d3 = Vector; payments.getStarsStatus#104fcfa7 peer:InputPeer = payments.StarsStatus; payments.getStarsTransactions#69da4557 flags:# inbound:flags.0?true outbound:flags.1?true ascending:flags.2?true subscription_id:flags.3?string peer:InputPeer offset:string limit:int = payments.StarsStatus; -payments.sendStarsForm#2bb731d flags:# form_id:long invoice:InputInvoice = payments.PaymentResult; +payments.sendStarsForm#7998c914 form_id:long invoice:InputInvoice = payments.PaymentResult; payments.refundStarsCharge#25ae8f4a user_id:InputUser charge_id:string = Updates; payments.getStarsTransactionsByID#27842d2e peer:InputPeer id:Vector = payments.StarsStatus; payments.getStarsGiftOptions#d3c96bc8 flags:# user_id:flags.0?InputUser = Vector; @@ -1658,6 +1670,10 @@ payments.getStarsSubscriptions#32512c5 flags:# missing_balance:flags.0?true peer payments.changeStarsSubscription#c7770878 flags:# peer:InputPeer subscription_id:string canceled:flags.0?Bool = Bool; payments.fulfillStarsSubscription#cc5bebb3 peer:InputPeer subscription_id:string = Bool; payments.getStarsGiveawayOptions#bd1efd3e = Vector; +payments.getStarGifts#c4563590 hash:int = payments.StarGifts; +payments.getUserStarGifts#5e72c7e1 user_id:InputUser offset:string limit:int = payments.UserStarGifts; +payments.saveStarGift#87acf08e flags:# unsave:flags.0?true user_id:InputUser msg_id:int = Bool; +payments.convertStarGift#421e027 user_id:InputUser msg_id:int = Bool; phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; @@ -1712,7 +1728,7 @@ stories.incrementStoryViews#b2028afb peer:InputPeer id:Vector = Bool; stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true forwards_first:flags.3?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; stories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector = stories.StoryViews; stories.exportStoryLink#7b8def20 peer:InputPeer id:int = ExportedStoryLink; -stories.report#1923fa8c peer:InputPeer id:Vector reason:ReportReason message:string = Bool; +stories.report#19d8eb45 peer:InputPeer id:Vector option:bytes message:string = ReportResult; stories.activateStealthMode#57bbd166 flags:# past:flags.0?true future:flags.1?true = Updates; stories.sendReaction#7fd736b2 flags:# add_to_recent:flags.0?true peer:InputPeer story_id:int reaction:Reaction = Updates; stories.getPeerStories#2c4ada50 peer:InputPeer = stories.PeerStories; diff --git a/src/lib/gramjs/tl/static/api.json b/src/lib/gramjs/tl/static/api.json index f59ef8b62..4f0389d5b 100644 --- a/src/lib/gramjs/tl/static/api.json +++ b/src/lib/gramjs/tl/static/api.json @@ -376,5 +376,9 @@ "payments.getStarsGiveawayOptions", "payments.refundStarsCharge", "payments.getStarsGiftOptions", + "payments.getStarGifts", + "payments.getUserStarGifts", + "payments.saveStarGift", + "payments.convertStarGift", "fragment.getCollectibleInfo" ] diff --git a/src/lib/gramjs/tl/static/api.tl b/src/lib/gramjs/tl/static/api.tl index 054d1909b..e19062cd4 100644 --- a/src/lib/gramjs/tl/static/api.tl +++ b/src/lib/gramjs/tl/static/api.tl @@ -183,6 +183,7 @@ messageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int = UserFull; +userFull#1f58e369 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -915,6 +916,7 @@ upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mti payments.paymentForm#a0058751 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice provider_id:long url:string native_provider:flags.4?string native_params:flags.4?DataJSON additional_methods:flags.6?Vector saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?Vector users:Vector = payments.PaymentForm; payments.paymentFormStars#7bf6b15c flags:# form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice users:Vector = payments.PaymentForm; +payments.paymentFormStarGift#b425cfe1 form_id:long invoice:Invoice = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; @@ -1464,6 +1466,7 @@ inputInvoiceSlug#c326caef slug:string = InputInvoice; inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:PremiumGiftCodeOption = InputInvoice; inputInvoiceStars#65f00ce3 purpose:InputStorePaymentPurpose = InputInvoice; inputInvoiceChatInviteSubscription#34e793f1 hash:string = InputInvoice; +inputInvoiceStarGift#25d8c1d8 flags:# hide_name:flags.0?true user_id:InputUser gift_id:long message:flags.1?TextWithEntities = InputInvoice; payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice; @@ -1821,7 +1824,7 @@ starsTransactionPeerAds#60682812 = StarsTransactionPeer; starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#ee7522d5 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int = StarsTransaction; +starsTransaction#a9ee4c2 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift = StarsTransaction; payments.starsStatus#bbfa316c flags:# balance:long subscriptions:flags.1?Vector subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; @@ -1859,6 +1862,21 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; +starGift#aea174ee flags:# limited:flags.0?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long = StarGift; + +payments.starGiftsNotModified#a388a368 = payments.StarGifts; +payments.starGifts#901689ea hash:int gifts:Vector = payments.StarGifts; + +userStarGift#eea49a6e flags:# name_hidden:flags.0?true unsaved:flags.5?true from_id:flags.1?long date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int convert_stars:flags.4?long = UserStarGift; + +payments.userStarGifts#6b65b517 flags:# count:int gifts:Vector next_offset:flags.0?string users:Vector = payments.UserStarGifts; + +messageReportOption#7903e3d9 text:string option:bytes = MessageReportOption; + +reportResultChooseOption#f0e4e0b6 title:string options:Vector = ReportResult; +reportResultAddComment#6f09ac31 flags:# optional:flags.0?true option:bytes = ReportResult; +reportResultReported#8db33c4b = ReportResult; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -2055,7 +2073,7 @@ messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings; -messages.report#8953ab4e peer:InputPeer id:Vector reason:ReportReason message:string = Bool; +messages.report#fc78af9b peer:InputPeer id:Vector option:bytes message:string = ReportResult; messages.getChats#49e9528f id:Vector = messages.Chats; messages.getFullChat#aeb00b34 chat_id:long = messages.ChatFull; messages.editChatTitle#73783ffd chat_id:long title:string = Updates; @@ -2413,7 +2431,7 @@ payments.launchPrepaidGiveaway#5ff58f20 peer:InputPeer giveaway_id:long purpose: payments.getStarsTopupOptions#c00ec7d3 = Vector; payments.getStarsStatus#104fcfa7 peer:InputPeer = payments.StarsStatus; payments.getStarsTransactions#69da4557 flags:# inbound:flags.0?true outbound:flags.1?true ascending:flags.2?true subscription_id:flags.3?string peer:InputPeer offset:string limit:int = payments.StarsStatus; -payments.sendStarsForm#2bb731d flags:# form_id:long invoice:InputInvoice = payments.PaymentResult; +payments.sendStarsForm#7998c914 form_id:long invoice:InputInvoice = payments.PaymentResult; payments.refundStarsCharge#25ae8f4a user_id:InputUser charge_id:string = Updates; payments.getStarsRevenueStats#d91ffad6 flags:# dark:flags.0?true peer:InputPeer = payments.StarsRevenueStats; payments.getStarsRevenueWithdrawalUrl#13bbe8b3 peer:InputPeer stars:long password:InputCheckPasswordSRP = payments.StarsRevenueWithdrawalUrl; @@ -2424,6 +2442,10 @@ payments.getStarsSubscriptions#32512c5 flags:# missing_balance:flags.0?true peer payments.changeStarsSubscription#c7770878 flags:# peer:InputPeer subscription_id:string canceled:flags.0?Bool = Bool; payments.fulfillStarsSubscription#cc5bebb3 peer:InputPeer subscription_id:string = Bool; payments.getStarsGiveawayOptions#bd1efd3e = Vector; +payments.getStarGifts#c4563590 hash:int = payments.StarGifts; +payments.getUserStarGifts#5e72c7e1 user_id:InputUser offset:string limit:int = payments.UserStarGifts; +payments.saveStarGift#87acf08e flags:# unsave:flags.0?true user_id:InputUser msg_id:int = Bool; +payments.convertStarGift#421e027 user_id:InputUser msg_id:int = Bool; stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector software:flags.3?string = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; @@ -2515,7 +2537,7 @@ stories.incrementStoryViews#b2028afb peer:InputPeer id:Vector = Bool; stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true forwards_first:flags.3?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; stories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector = stories.StoryViews; stories.exportStoryLink#7b8def20 peer:InputPeer id:int = ExportedStoryLink; -stories.report#1923fa8c peer:InputPeer id:Vector reason:ReportReason message:string = Bool; +stories.report#19d8eb45 peer:InputPeer id:Vector option:bytes message:string = ReportResult; stories.activateStealthMode#57bbd166 flags:# past:flags.0?true future:flags.1?true = Updates; stories.sendReaction#7fd736b2 flags:# add_to_recent:flags.0?true peer:InputPeer story_id:int reaction:Reaction = Updates; stories.getPeerStories#2c4ada50 peer:InputPeer = stories.PeerStories; @@ -2541,4 +2563,4 @@ smsjobs.getStatus#10a698e8 = smsjobs.Status; smsjobs.getSmsJob#778d902f job_id:string = SmsJob; smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; -fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; +fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; \ No newline at end of file diff --git a/src/types/index.ts b/src/types/index.ts index eb5319e48..30d209a75 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -127,7 +127,6 @@ export interface ISettings extends NotifySettings, Record { translationLanguage?: string; doNotTranslate: string[]; canDisplayChatInTitle: boolean; - shouldShowLoginCodeInChatList?: boolean; shouldForceHttpTransport?: boolean; shouldAllowHttpTransport?: boolean; shouldCollectDebugLogs?: boolean;