diff --git a/src/api/gramjs/apiBuilders/appConfig.ts b/src/api/gramjs/apiBuilders/appConfig.ts index 77086bc6c..4e123c8fd 100644 --- a/src/api/gramjs/apiBuilders/appConfig.ts +++ b/src/api/gramjs/apiBuilders/appConfig.ts @@ -86,6 +86,7 @@ export interface GramJsAppConfig extends LimitsConfig { stars_gifts_enabled?: boolean; stargifts_message_length_max?: number; stargifts_convert_period_max?: number; + starref_start_param_prefixes?: string[]; } function buildEmojiSounds(appConfig: GramJsAppConfig) { @@ -171,5 +172,6 @@ export function buildAppConfig(json: GramJs.TypeJSONValue, hash: number): ApiApp isStarsGiftEnabled: appConfig.stars_gifts_enabled, starGiftMaxMessageLength: appConfig.stargifts_message_length_max, starGiftMaxConvertPeriod: appConfig.stargifts_convert_period_max, + starRefStartPrefixes: appConfig.starref_start_param_prefixes, }; } diff --git a/src/api/gramjs/apiBuilders/payments.ts b/src/api/gramjs/apiBuilders/payments.ts index f20fe1ef3..ad9770459 100644 --- a/src/api/gramjs/apiBuilders/payments.ts +++ b/src/api/gramjs/apiBuilders/payments.ts @@ -21,6 +21,7 @@ import type { ApiReceipt, ApiStarGift, ApiStarGiveawayOption, + ApiStarsAmount, ApiStarsGiveawayWinnerOption, ApiStarsSubscription, ApiStarsTransaction, @@ -461,6 +462,13 @@ export function buildApiStarsGiftOptions(option: GramJs.StarsGiftOption): ApiSta }; } +export function buildApiStarsAmount(amount: GramJs.StarsAmount): ApiStarsAmount { + return { + amount: amount.amount.toJSNumber(), + nanos: amount.nanos, + }; +} + export function buildApiStarsGiveawayWinnersOption( option: GramJs.StarsGiveawayWinnersOption, ): ApiStarsGiveawayWinnerOption { @@ -528,7 +536,7 @@ export function buildApiStarsTransactionPeer(peer: GramJs.TypeStarsTransactionPe export function buildApiStarsTransaction(transaction: GramJs.StarsTransaction): ApiStarsTransaction { const { date, id, peer, stars, description, photo, title, refund, extendedMedia, failed, msgId, pending, gift, reaction, - subscriptionPeriod, stargift, giveawayPostId, + subscriptionPeriod, stargift, giveawayPostId, starrefCommissionPermille, } = transaction; if (photo) { @@ -538,11 +546,13 @@ export function buildApiStarsTransaction(transaction: GramJs.StarsTransaction): const boughtExtendedMedia = extendedMedia?.map((m) => buildMessageMediaContent(m)) .filter(Boolean) as BoughtPaidMedia[]; + const starRefCommision = starrefCommissionPermille ? starrefCommissionPermille / 10 : undefined; + return { id, date, peer: buildApiStarsTransactionPeer(peer), - stars: stars.toJSNumber(), + stars: buildApiStarsAmount(stars), title, description, photo: photo && buildApiWebDocument(photo), @@ -556,6 +566,7 @@ export function buildApiStarsTransaction(transaction: GramJs.StarsTransaction): isReaction: reaction, starGift: stargift && buildApiStarGift(stargift), giveawayPostId, + starRefCommision, }; } diff --git a/src/api/gramjs/methods/chats.ts b/src/api/gramjs/methods/chats.ts index 84928e197..a3c1beca2 100644 --- a/src/api/gramjs/methods/chats.ts +++ b/src/api/gramjs/methods/chats.ts @@ -1131,9 +1131,10 @@ export async function getChatByPhoneNumber(phoneNumber: string) { return processResolvedPeer(result); } -export async function getChatByUsername(username: string) { +export async function getChatByUsername(username: string, referrer?: string) { const result = await invokeRequest(new GramJs.contacts.ResolveUsername({ username, + referer: referrer, })); return processResolvedPeer(result); diff --git a/src/api/gramjs/methods/payments.ts b/src/api/gramjs/methods/payments.ts index 4c200e259..d69f52c0c 100644 --- a/src/api/gramjs/methods/payments.ts +++ b/src/api/gramjs/methods/payments.ts @@ -19,6 +19,7 @@ import { buildApiPremiumPromo, buildApiReceipt, buildApiStarGift, + buildApiStarsAmount, buildApiStarsGiftOptions, buildApiStarsGiveawayOptions, buildApiStarsSubscription, @@ -534,7 +535,7 @@ export async function fetchStarsStatus() { history: result.history?.map(buildApiStarsTransaction), nextSubscriptionOffset: result.subscriptionsNextOffset, subscriptions: result.subscriptions?.map(buildApiStarsSubscription), - balance: result.balance.toJSNumber(), + balance: buildApiStarsAmount(result.balance), }; } @@ -564,7 +565,7 @@ export async function fetchStarsTransactions({ return { nextOffset: result.nextOffset, history: result.history?.map(buildApiStarsTransaction), - balance: result.balance.toJSNumber(), + balance: buildApiStarsAmount(result.balance), }; } @@ -610,7 +611,7 @@ export async function fetchStarsSubscriptions({ return { nextOffset: result.subscriptionsNextOffset, subscriptions: result.subscriptions.map(buildApiStarsSubscription), - balance: result.balance.toJSNumber(), + balance: buildApiStarsAmount(result.balance), }; } diff --git a/src/api/gramjs/updates/mtpUpdateHandler.ts b/src/api/gramjs/updates/mtpUpdateHandler.ts index 0d3a33644..ed8a6a8dc 100644 --- a/src/api/gramjs/updates/mtpUpdateHandler.ts +++ b/src/api/gramjs/updates/mtpUpdateHandler.ts @@ -51,6 +51,7 @@ import { buildLangStrings, buildPrivacyKey, } from '../apiBuilders/misc'; +import { buildApiStarsAmount } from '../apiBuilders/payments'; import { buildApiEmojiStatus, buildApiPeerId, getApiChatIdFromMtpPeer } from '../apiBuilders/peers'; import { buildApiReaction, @@ -1059,7 +1060,7 @@ export function updater(update: Update) { } else if (update instanceof GramJs.UpdateStarsBalance) { sendApiUpdate({ '@type': 'updateStarsBalance', - balance: update.balance.toJSNumber(), + balance: buildApiStarsAmount(update.balance), }); } else if (update instanceof GramJs.UpdatePaidReactionPrivacy) { sendApiUpdate({ diff --git a/src/api/types/misc.ts b/src/api/types/misc.ts index e3be96104..a8a49b5fb 100644 --- a/src/api/types/misc.ts +++ b/src/api/types/misc.ts @@ -243,6 +243,7 @@ export interface ApiAppConfig { isStarsGiftEnabled?: boolean; starGiftMaxMessageLength?: number; starGiftMaxConvertPeriod?: number; + starRefStartPrefixes?: string[]; } export interface ApiConfig { diff --git a/src/api/types/payments.ts b/src/api/types/payments.ts index 0e9643c0a..c854b6979 100644 --- a/src/api/types/payments.ts +++ b/src/api/types/payments.ts @@ -302,6 +302,11 @@ export type ApiCheckedGiftCode = { usedAt?: number; }; +export interface ApiStarsAmount { + amount: number; + nanos: number; +} + export interface ApiStarsTransactionPeerUnsupported { type: 'unsupported'; } @@ -349,7 +354,7 @@ export interface ApiStarsTransaction { id?: string; peer: ApiStarsTransactionPeer; messageId?: number; - stars: number; + stars: ApiStarsAmount; isRefund?: true; isGift?: true; starGift?: ApiStarGift; @@ -364,6 +369,7 @@ export interface ApiStarsTransaction { photo?: ApiWebDocument; extendedMedia?: BoughtPaidMedia[]; subscriptionPeriod?: number; + starRefCommision?: number; } export interface ApiStarsSubscription { diff --git a/src/api/types/updates.ts b/src/api/types/updates.ts index 6b7dc2df3..638539e64 100644 --- a/src/api/types/updates.ts +++ b/src/api/types/updates.ts @@ -34,6 +34,7 @@ import type { import type { ApiEmojiInteraction, ApiError, ApiNotifyException, ApiSessionData, } from './misc'; +import type { ApiStarsAmount } from './payments'; import type { LangPackStringValue } from './settings'; import type { ApiStealthMode, ApiStory, ApiStorySkipped } from './stories'; import type { @@ -760,7 +761,7 @@ export type ApiUpdatePremiumFloodWait = { export type ApiUpdateStarsBalance = { '@type': 'updateStarsBalance'; - balance: number; + balance: ApiStarsAmount; }; export type ApiUpdateDeleteProfilePhoto = { diff --git a/src/assets/localization/fallback.strings b/src/assets/localization/fallback.strings index de3c9a9ef..9f6180170 100644 --- a/src/assets/localization/fallback.strings +++ b/src/assets/localization/fallback.strings @@ -1377,6 +1377,7 @@ "StarsSubscribeInfoLinkText" = "Terms of Service"; "StarsSubscribeInfoLink" = "https://telegram.org/tos/stars"; "StarsPerMonth" = "⭐️{amount}/month"; +"StarsBalance" = "Balance"; "OpenApp" = "Open App"; "PopularApps" = "Popular Apps"; "SearchApps" = "Search Apps"; diff --git a/src/components/common/pickers/PickerSelectedItem.scss b/src/components/common/pickers/PickerSelectedItem.scss index 87d185654..8d4997d38 100644 --- a/src/components/common/pickers/PickerSelectedItem.scss +++ b/src/components/common/pickers/PickerSelectedItem.scss @@ -95,7 +95,7 @@ width: 1.125rem; height: 1.125rem; background-size: 1.125rem; - vertical-align: -2px; + vertical-align: -4px; } } diff --git a/src/components/left/settings/SettingsMain.tsx b/src/components/left/settings/SettingsMain.tsx index 9ab55b8ec..f6c876782 100644 --- a/src/components/left/settings/SettingsMain.tsx +++ b/src/components/left/settings/SettingsMain.tsx @@ -2,17 +2,19 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; +import type { ApiStarsAmount } from '../../../api/types'; import { SettingsScreens } from '../../../types'; import { FAQ_URL, PRIVACY_URL } from '../../../config'; +import { formatStarsAmount } from '../../../global/helpers/payments'; import { selectIsGiveawayGiftsPurchaseAvailable, selectIsPremiumPurchaseBlocked, } from '../../../global/selectors'; -import { formatInteger } from '../../../util/textFormat'; import useFlag from '../../../hooks/useFlag'; import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import useOldLang from '../../../hooks/useOldLang'; @@ -33,7 +35,7 @@ type StateProps = { currentUserId?: string; canBuyPremium?: boolean; isGiveawayAvailable?: boolean; - starsBalance?: number; + starsBalance?: ApiStarsAmount; shouldDisplayStars?: boolean; }; @@ -59,6 +61,7 @@ const SettingsMain: FC = ({ const [isSupportDialogOpen, openSupportDialog, closeSupportDialog] = useFlag(false); + const lang = useLang(); const oldLang = useOldLang(); useEffect(() => { @@ -188,7 +191,9 @@ const SettingsMain: FC = ({ > {oldLang('MenuTelegramStars')} {Boolean(starsBalance) && ( - {formatInteger(starsBalance)} + + {formatStarsAmount(lang, starsBalance)} + )} )} diff --git a/src/components/middle/message/Message.tsx b/src/components/middle/message/Message.tsx index e00555c71..a70170a1e 100644 --- a/src/components/middle/message/Message.tsx +++ b/src/components/middle/message/Message.tsx @@ -296,7 +296,6 @@ type StateProps = { canTranscribeVoice?: boolean; viaBusinessBot?: ApiUser; effect?: ApiAvailableEffect; - availableStars?: number; poll?: ApiPoll; }; @@ -418,7 +417,6 @@ const Message: FC = ({ canTranscribeVoice, viaBusinessBot, effect, - availableStars, poll, onIntersectPinnedMessage, }) => { @@ -1062,7 +1060,6 @@ const Message: FC = ({ noRecentReactors={isChannel} tags={tags} isCurrentUserPremium={isPremium} - availableStars={availableStars} /> ); } @@ -1701,7 +1698,6 @@ const Message: FC = ({ observeIntersection={observeIntersectionForPlaying} noRecentReactors={isChannel} tags={tags} - availableStars={availableStars} /> )} @@ -1852,7 +1848,6 @@ export default memo(withGlobal( const effect = effectId ? global.availableEffectById[effectId] : undefined; - const { balance: availableStars } = global.stars || {}; const poll = selectPollFromMessage(global, message); return { @@ -1941,7 +1936,6 @@ export default memo(withGlobal( canTranscribeVoice, viaBusinessBot, effect, - availableStars, poll, }; }, diff --git a/src/components/middle/message/reactions/ReactionButton.tsx b/src/components/middle/message/reactions/ReactionButton.tsx index 8f3ff385f..5493e8d6e 100644 --- a/src/components/middle/message/reactions/ReactionButton.tsx +++ b/src/components/middle/message/reactions/ReactionButton.tsx @@ -40,14 +40,13 @@ type OwnProps = { recentReactors?: ApiPeer[]; className?: string; chosenClassName?: string; - availableStars?: number; observeIntersection?: ObserveFn; onClick?: (reaction: ApiReaction) => void; onPaidClick?: (count: number) => void; }; -function selectAreStarsLoaded(global: GlobalState) { - return Boolean(global.stars); +function selectStarsState(global: GlobalState) { + return global.stars; } const ReactionButton = ({ @@ -57,7 +56,6 @@ const ReactionButton = ({ recentReactors, className, chosenClassName, - availableStars, chatId, messageId, observeIntersection, @@ -78,7 +76,8 @@ const ReactionButton = ({ const isPaid = reaction.reaction.type === 'paid'; - const areStarsLoaded = useSelector(selectAreStarsLoaded); + const starsState = useSelector(selectStarsState); + const areStarsLoaded = Boolean(starsState); const handlePaidClick = useLastCallback((count = 1) => { onPaidClick?.(count); @@ -120,7 +119,7 @@ const ReactionButton = ({ const button = ref.current; if (!amount || !button || amount === prevReaction?.localAmount) return; - if (areStarsLoaded && (!availableStars || amount > availableStars)) { + if (areStarsLoaded && amount > starsState.balance.amount) { openStarsBalanceModal({ originReaction: { chatId, @@ -153,7 +152,7 @@ const ReactionButton = ({ duration: 500 * currentScale, easing: 'ease-out', }); - }, [reaction, availableStars, areStarsLoaded, chatId, messageId]); + }, [reaction, starsState?.balance, areStarsLoaded, chatId, messageId]); const prevAmount = usePrevious(reaction.localAmount); diff --git a/src/components/middle/message/reactions/Reactions.tsx b/src/components/middle/message/reactions/Reactions.tsx index 716124042..1dc0ff2b7 100644 --- a/src/components/middle/message/reactions/Reactions.tsx +++ b/src/components/middle/message/reactions/Reactions.tsx @@ -36,7 +36,6 @@ type OwnProps = { isCurrentUserPremium?: boolean; observeIntersection?: ObserveFn; noRecentReactors?: boolean; - availableStars?: number; }; const MAX_RECENT_AVATARS = 3; @@ -52,7 +51,6 @@ const Reactions: FC = ({ noRecentReactors, isCurrentUserPremium, tags, - availableStars, }) => { const { toggleReaction, @@ -216,7 +214,6 @@ const Reactions: FC = ({ onClick={handleClick} onPaidClick={handlePaidClick} observeIntersection={observeIntersection} - availableStars={availableStars} /> ) ))} diff --git a/src/components/modals/gift/GiftModal.tsx b/src/components/modals/gift/GiftModal.tsx index f6c860d63..a218e3b36 100644 --- a/src/components/modals/gift/GiftModal.tsx +++ b/src/components/modals/gift/GiftModal.tsx @@ -7,6 +7,7 @@ import { getActions, withGlobal } from '../../../global'; import type { ApiPremiumGiftCodeOption, ApiStarGift, + ApiStarsAmount, ApiUser, } from '../../../api/types'; import type { StarGiftCategory, TabState } from '../../../global/types'; @@ -45,7 +46,7 @@ type StateProps = { boostPerSentGift?: number; starGiftsById?: Record; starGiftCategoriesByName: Record; - starBalance?: number; + starBalance?: ApiStarsAmount; user?: ApiUser; }; diff --git a/src/components/modals/paidReaction/PaidReactionModal.tsx b/src/components/modals/paidReaction/PaidReactionModal.tsx index 28c6d933f..2854a1106 100644 --- a/src/components/modals/paidReaction/PaidReactionModal.tsx +++ b/src/components/modals/paidReaction/PaidReactionModal.tsx @@ -3,7 +3,9 @@ import React, { } from '../../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../../global'; -import type { ApiChat, ApiMessage, ApiUser } from '../../../api/types'; +import type { + ApiChat, ApiMessage, ApiStarsAmount, ApiUser, +} from '../../../api/types'; import type { TabState } from '../../../global/types'; import type { CustomPeer } from '../../../types'; @@ -38,7 +40,7 @@ type StateProps = { message?: ApiMessage; chat?: ApiChat; maxAmount: number; - starBalance?: number; + starBalance?: ApiStarsAmount; defaultPrivacy?: boolean; }; diff --git a/src/components/modals/stars/BalanceBlock.tsx b/src/components/modals/stars/BalanceBlock.tsx index d7262853e..a9736dd15 100644 --- a/src/components/modals/stars/BalanceBlock.tsx +++ b/src/components/modals/stars/BalanceBlock.tsx @@ -1,28 +1,30 @@ import React, { memo } from '../../../lib/teact/teact'; -import buildClassName from '../../../util/buildClassName'; -import { formatInteger } from '../../../util/textFormat'; +import type { ApiStarsAmount } from '../../../api/types'; -import useOldLang from '../../../hooks/useOldLang'; +import { formatStarsAmount } from '../../../global/helpers/payments'; +import buildClassName from '../../../util/buildClassName'; + +import useLang from '../../../hooks/useLang'; import StarIcon from '../../common/icons/StarIcon'; import styles from './StarsBalanceModal.module.scss'; type OwnProps = { - balance?: number; + balance?: ApiStarsAmount; className?: string; }; const BalanceBlock = ({ balance, className }: OwnProps) => { - const lang = useOldLang(); + const lang = useLang(); return (
{lang('StarsBalance')}
- {balance !== undefined ? formatInteger(balance) : '…'} + {balance !== undefined ? formatStarsAmount(lang, balance) : '…'}
); diff --git a/src/components/modals/stars/StarsBalanceModal.tsx b/src/components/modals/stars/StarsBalanceModal.tsx index 2e74adc61..346583944 100644 --- a/src/components/modals/stars/StarsBalanceModal.tsx +++ b/src/components/modals/stars/StarsBalanceModal.tsx @@ -81,7 +81,7 @@ const StarsBalanceModal = ({ || originReaction?.amount || originGift?.gift.stars || topup?.balanceNeeded; - const starsNeeded = ongoingTransactionAmount ? ongoingTransactionAmount - (balance || 0) : undefined; + const starsNeeded = ongoingTransactionAmount ? ongoingTransactionAmount - (balance?.amount || 0) : undefined; const starsNeededText = useMemo(() => { const global = getGlobal(); diff --git a/src/components/modals/stars/StarsPaymentModal.tsx b/src/components/modals/stars/StarsPaymentModal.tsx index c97b2e2a2..f667db11e 100644 --- a/src/components/modals/stars/StarsPaymentModal.tsx +++ b/src/components/modals/stars/StarsPaymentModal.tsx @@ -150,7 +150,7 @@ const StarPaymentModal = ({ return; } - if (amount > balance) { + if (amount > balance.amount) { openStarsBalanceModal({ originStarsPayment: modal, }); diff --git a/src/components/modals/stars/helpers/transaction.ts b/src/components/modals/stars/helpers/transaction.ts index 0dcddbffc..c401e0456 100644 --- a/src/components/modals/stars/helpers/transaction.ts +++ b/src/components/modals/stars/helpers/transaction.ts @@ -1,9 +1,13 @@ -import type { ApiStarsTransaction } from '../../../../api/types'; +import type { ApiStarsAmount, ApiStarsTransaction } from '../../../../api/types'; import type { OldLangFn } from '../../../../hooks/useOldLang'; import { buildStarsTransactionCustomPeer } from '../../../../global/helpers/payments'; +import { formatPercent } from '../../../../util/textFormat'; export function getTransactionTitle(lang: OldLangFn, transaction: ApiStarsTransaction) { + if (transaction.starRefCommision) { + return lang('StarTransactionCommission', formatPercent(transaction.starRefCommision)); + } if (transaction.extendedMedia) return lang('StarMediaPurchase'); if (transaction.subscriptionPeriod) return transaction.title || lang('StarSubscriptionPurchase'); if (transaction.isReaction) return lang('StarsReactionsSent'); @@ -11,7 +15,7 @@ export function getTransactionTitle(lang: OldLangFn, transaction: ApiStarsTransa if (transaction.isMyGift) return lang('StarsGiftSent'); if (transaction.isGift) return lang('StarsGiftReceived'); if (transaction.starGift) { - return transaction.stars < 0 ? lang('Gift2TransactionSent') : lang('Gift2ConvertedTitle'); + return isNegativeStarsAmount(transaction.stars) ? lang('Gift2TransactionSent') : lang('Gift2ConvertedTitle'); } const customPeer = (transaction.peer && transaction.peer.type !== 'peer' @@ -21,3 +25,8 @@ export function getTransactionTitle(lang: OldLangFn, transaction: ApiStarsTransa return transaction.title; } + +export function isNegativeStarsAmount(starsAmount: ApiStarsAmount) { + if (starsAmount.amount) return starsAmount.amount < 0; + return starsAmount.nanos < 0; +} diff --git a/src/components/modals/stars/transaction/StarsTransactionItem.tsx b/src/components/modals/stars/transaction/StarsTransactionItem.tsx index 77a1c0a1e..e99a0fadc 100644 --- a/src/components/modals/stars/transaction/StarsTransactionItem.tsx +++ b/src/components/modals/stars/transaction/StarsTransactionItem.tsx @@ -14,9 +14,11 @@ import { selectPeer } from '../../../../global/selectors'; import buildClassName from '../../../../util/buildClassName'; import { formatDateTimeToString } from '../../../../util/dates/dateFormat'; import { CUSTOM_PEER_PREMIUM } from '../../../../util/objects/customPeer'; -import { getTransactionTitle } from '../helpers/transaction'; +import renderText from '../../../common/helpers/renderText'; +import { getTransactionTitle, isNegativeStarsAmount } from '../helpers/transaction'; import useSelector from '../../../../hooks/data/useSelector'; +import useLang from '../../../../hooks/useLang'; import useLastCallback from '../../../../hooks/useLastCallback'; import useOldLang from '../../../../hooks/useOldLang'; @@ -47,24 +49,25 @@ const StarsTransactionItem = ({ transaction, className }: OwnProps) => { extendedMedia, subscriptionPeriod, } = transaction; - const lang = useOldLang(); + const lang = useLang(); + const oldLang = useOldLang(); const peerId = transactionPeer.type === 'peer' ? transactionPeer.id : undefined; const peer = useSelector(selectOptionalPeer(peerId)); const data = useMemo(() => { - let title = getTransactionTitle(lang, transaction); + let title = getTransactionTitle(oldLang, transaction); let description; let status: string | undefined; let avatarPeer: ApiPeer | CustomPeer | undefined; if (transaction.peer.type === 'peer') { - description = peer && getSenderTitle(lang, peer); + description = peer && getSenderTitle(oldLang, peer); avatarPeer = peer || CUSTOM_PEER_PREMIUM; } else { const customPeer = buildStarsTransactionCustomPeer(transaction.peer); - title = customPeer.title || lang(customPeer.titleKey!); - description = lang(customPeer.subtitleKey!); + title = customPeer.title || oldLang(customPeer.titleKey!); + description = oldLang(customPeer.subtitleKey!); avatarPeer = customPeer; } @@ -73,15 +76,15 @@ const StarsTransactionItem = ({ transaction, className }: OwnProps) => { } if (transaction.isRefund) { - status = lang('StarsRefunded'); + status = oldLang('StarsRefunded'); } if (transaction.hasFailed) { - status = lang('StarsFailed'); + status = oldLang('StarsFailed'); } if (transaction.isPending) { - status = lang('StarsPending'); + status = oldLang('StarsPending'); } return { @@ -90,7 +93,7 @@ const StarsTransactionItem = ({ transaction, className }: OwnProps) => { avatarPeer, status, }; - }, [lang, peer, transaction]); + }, [oldLang, peer, transaction]); const handleClick = useLastCallback(() => { openStarsTransactionModal({ transaction }); @@ -107,15 +110,19 @@ const StarsTransactionItem = ({ transaction, className }: OwnProps) => {

{data.title}

-

{data.description}

+ {data.description && ( +

{renderText(data.description)}

+ )}

- {formatDateTimeToString(date * 1000, lang.code, true)} + {formatDateTimeToString(date * 1000, oldLang.code, true)} {data.status && ` — (${data.status})`}

- - {formatStarsTransactionAmount(stars)} + + {formatStarsTransactionAmount(lang, stars)}
diff --git a/src/components/modals/stars/transaction/StarsTransactionModal.tsx b/src/components/modals/stars/transaction/StarsTransactionModal.tsx index 4e4890eeb..f176c9676 100644 --- a/src/components/modals/stars/transaction/StarsTransactionModal.tsx +++ b/src/components/modals/stars/transaction/StarsTransactionModal.tsx @@ -19,8 +19,9 @@ import { import buildClassName from '../../../../util/buildClassName'; import { copyTextToClipboard } from '../../../../util/clipboard'; import { formatDateTimeToString } from '../../../../util/dates/dateFormat'; -import { getTransactionTitle } from '../helpers/transaction'; +import { getTransactionTitle, isNegativeStarsAmount } from '../helpers/transaction'; +import useLang from '../../../../hooks/useLang'; import useLastCallback from '../../../../hooks/useLastCallback'; import useOldLang from '../../../../hooks/useOldLang'; import usePrevious from '../../../../hooks/usePrevious'; @@ -51,6 +52,8 @@ const StarsTransactionModal: FC = ({ modal, peer, canPlayAnimatedEmojis, topSticker, }) => { const { showNotification, openMediaViewer, closeStarsTransactionModal } = getActions(); + + const lang = useLang(); const oldLang = useOldLang(); const { transaction } = modal || {}; @@ -70,7 +73,7 @@ const StarsTransactionModal: FC = ({ } const { - giveawayPostId, photo, + giveawayPostId, photo, stars, } = transaction; const customPeer = (transaction.peer && transaction.peer.type !== 'peer' @@ -130,8 +133,10 @@ const StarsTransactionModal: FC = ({ {title &&

{title}

}

{description}

- - {formatStarsTransactionAmount(transaction.stars)} + + {formatStarsTransactionAmount(lang, stars)}

@@ -140,9 +145,26 @@ const StarsTransactionModal: FC = ({ const tableData: TableData = []; + if (transaction.starRefCommision) { + tableData.push([ + oldLang('StarsTransaction.StarRefReason.Title'), + oldLang('StarsTransaction.StarRefReason.Program'), + ]); + } + + let peerLabel; + if (isNegativeStarsAmount(stars) || transaction.isMyGift) { + peerLabel = oldLang('Stars.Transaction.To'); + } else if (transaction.starRefCommision) { + peerLabel = oldLang('StarsTransaction.StarRefReason.Miniapp'); + } else if (peerId) { + peerLabel = oldLang('Star.Transaction.From'); + } else { + peerLabel = oldLang('Stars.Transaction.Via'); + } + tableData.push([ - oldLang(transaction.stars < 0 || transaction.isMyGift ? 'Stars.Transaction.To' - : peerId ? 'Star.Transaction.From' : 'Stars.Transaction.Via'), + peerLabel, peerId ? { chatId: peerId } : toName || '', ]); @@ -198,7 +220,7 @@ const StarsTransactionModal: FC = ({ tableData, footer, }; - }, [transaction, oldLang, peer, topSticker, canPlayAnimatedEmojis]); + }, [transaction, oldLang, lang, peer, topSticker, canPlayAnimatedEmojis]); const prevModalData = usePrevious(starModalData); const renderingModalData = prevModalData || starModalData; @@ -222,7 +244,7 @@ export default memo(withGlobal( const peer = peerId ? selectPeer(global, peerId) : undefined; const starCount = modal?.transaction.stars; - const starsGiftSticker = modal?.transaction.isGift && selectGiftStickerForStars(global, starCount); + const starsGiftSticker = modal?.transaction.isGift && selectGiftStickerForStars(global, starCount?.amount); const starGiftStickerId = modal?.transaction.starGift?.stickerId; const starGiftSticker = starGiftStickerId && selectStarGiftSticker(global, starGiftStickerId); diff --git a/src/config.ts b/src/config.ts index 3d193b18c..127e2812e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -51,7 +51,7 @@ export const MEDIA_PROGRESSIVE_CACHE_DISABLED = false; export const MEDIA_PROGRESSIVE_CACHE_NAME = 'tt-media-progressive'; export const MEDIA_CACHE_MAX_BYTES = 512 * 1024; // 512 KB export const CUSTOM_BG_CACHE_NAME = 'tt-custom-bg'; -export const LANG_CACHE_NAME = 'tt-lang-packs-v45'; +export const LANG_CACHE_NAME = 'tt-lang-packs-v46'; export const ASSET_CACHE_NAME = 'tt-assets'; export const AUTODOWNLOAD_FILESIZE_MB_LIMITS = [1, 5, 10, 50, 100, 500]; export const DATA_BROADCAST_CHANNEL_NAME = 'tt-global'; diff --git a/src/global/actions/api/chats.ts b/src/global/actions/api/chats.ts index 22ac3670e..3b5633961 100644 --- a/src/global/actions/api/chats.ts +++ b/src/global/actions/api/chats.ts @@ -2912,14 +2912,15 @@ export async function migrateChat( export async function fetchChatByUsername( global: T, username: string, + referrer?: string, ) { global = getGlobal(); - const localChat = selectChatByUsername(global, username); + const localChat = !referrer ? selectChatByUsername(global, username) : undefined; if (localChat && !localChat.isMin) { return localChat; } - const { chat, user } = await callApi('getChatByUsername', username) || {}; + const { chat, user } = await callApi('getChatByUsername', username, referrer) || {}; if (!chat) { return undefined; } @@ -3047,7 +3048,16 @@ async function openChatByUsername( actions.openChat({ id: TMP_CHAT_ID, tabId }); } - const chat = await fetchChatByUsername(global, username); + const starRefStartPrefixes = global.appConfig?.starRefStartPrefixes; + let referrer = ''; + if (startParam && starRefStartPrefixes?.length) { + const prefix = starRefStartPrefixes.find((p) => startParam.startsWith(p)); + if (prefix) { + referrer = startParam.slice(prefix.length); + } + } + + const chat = await fetchChatByUsername(global, username, referrer); if (!chat) { if (!isCurrentChat) { actions.openPreviousChat({ tabId }); diff --git a/src/global/actions/api/payments.ts b/src/global/actions/api/payments.ts index d3f96d8a6..455ad4acd 100644 --- a/src/global/actions/api/payments.ts +++ b/src/global/actions/api/payments.ts @@ -126,7 +126,7 @@ addActionHandler('sendStarGift', async (global, actions, payload): Promise if (balance === undefined) return; - if (balance < gift.stars) { + if (balance.amount < gift.stars) { actions.openStarsBalanceModal({ tabId }); return; } diff --git a/src/global/actions/ui/stars.ts b/src/global/actions/ui/stars.ts index 9a0f35251..d1e8fd1ca 100644 --- a/src/global/actions/ui/stars.ts +++ b/src/global/actions/ui/stars.ts @@ -119,7 +119,7 @@ addActionHandler('openStarsBalanceModal', (global, actions, payload): ActionRetu const starBalance = global.stars?.balance; - if (!shouldIgnoreBalance && starBalance && topup && topup.balanceNeeded <= starBalance) { + if (!shouldIgnoreBalance && starBalance && topup && topup.balanceNeeded <= starBalance.amount) { actions.showNotification({ message: langProvider.oldTranslate('StarsTopupLinkEnough'), actionText: langProvider.oldTranslate('StarsTopupLinkTopupAnyway'), diff --git a/src/global/helpers/payments.ts b/src/global/helpers/payments.ts index f58c9c371..bab9eaa5c 100644 --- a/src/global/helpers/payments.ts +++ b/src/global/helpers/payments.ts @@ -2,14 +2,15 @@ import type { ApiInputInvoice, ApiMessage, ApiRequestInputInvoice, + ApiStarsAmount, ApiStarsTransaction, ApiStarsTransactionPeer, ApiStarsTransactionPeerPeer, } from '../../api/types'; import type { CustomPeer } from '../../types'; +import type { LangFn } from '../../util/localization'; import type { GlobalState } from '../types'; -import { formatInteger } from '../../util/textFormat'; import { selectChat, selectUser } from '../selectors'; export function getRequestInputInvoice( @@ -247,12 +248,17 @@ export function buildStarsTransactionCustomPeer( }; } -export function formatStarsTransactionAmount(amount: number) { +export function formatStarsTransactionAmount(lang: LangFn, starsAmount: ApiStarsAmount) { + const amount = starsAmount.amount + starsAmount.nanos / 1e9; if (amount < 0) { - return `- ${formatInteger(Math.abs(amount))}`; + return `- ${lang.number(Math.abs(amount))}`; } - return `+ ${formatInteger(amount)}`; + return `+ ${lang.number(amount)}`; +} + +export function formatStarsAmount(lang: LangFn, starsAmount: ApiStarsAmount) { + return lang.number(starsAmount.amount + starsAmount.nanos / 1e9); } export function getStarsTransactionFromGift(message: ApiMessage): ApiStarsTransaction | undefined { @@ -264,7 +270,10 @@ export function getStarsTransactionFromGift(message: ApiMessage): ApiStarsTransa return { id: transactionId!, - stars: stars!, + stars: { + amount: stars!, + nanos: 0, + }, peer: { type: 'peer', id: message.isOutgoing ? message.chatId : (message.senderId || message.chatId), @@ -284,7 +293,10 @@ export function getPrizeStarsTransactionFromGiveaway(message: ApiMessage): ApiSt return { id: transactionId!, - stars: stars!, + stars: { + amount: stars!, + nanos: 0, + }, peer: { type: 'peer', id: targetChatId!, diff --git a/src/global/reducers/payments.ts b/src/global/reducers/payments.ts index 10a36bab5..26808a3b9 100644 --- a/src/global/reducers/payments.ts +++ b/src/global/reducers/payments.ts @@ -1,6 +1,7 @@ import type { ApiReceiptRegular, ApiReceiptStars, + ApiStarsAmount, ApiStarsSubscription, ApiStarsTransaction, } from '../../api/types'; @@ -131,7 +132,7 @@ export function closeInvoice( } export function updateStarsBalance( - global: T, balance: number, + global: T, balance: ApiStarsAmount, ): T { return { ...global, @@ -232,7 +233,10 @@ export function openStarsTransactionFromReceipt( type: 'peer', id: receipt.botId, }, - stars: receipt.totalAmount, + stars: { + amount: receipt.totalAmount, + nanos: 0, + }, date: receipt.date, title: receipt.title, description: receipt.description, diff --git a/src/global/types.ts b/src/global/types.ts index 1d7daa26c..464e7b62c 100644 --- a/src/global/types.ts +++ b/src/global/types.ts @@ -68,6 +68,7 @@ import type { ApiSponsoredMessage, ApiStarGift, ApiStarGiveawayOption, + ApiStarsAmount, ApiStarsSubscription, ApiStarsTransaction, ApiStarTopupOption, @@ -1290,7 +1291,7 @@ export type GlobalState = { stars?: { topupOptions: ApiStarTopupOption[]; - balance: number; + balance: ApiStarsAmount; history: StarsTransactionHistory; subscriptions?: StarsSubscriptions; }; diff --git a/src/lib/gramjs/tl/AllTLObjects.js b/src/lib/gramjs/tl/AllTLObjects.js index 1b4485105..4924f4ebe 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 = 193; +const LAYER = 195; 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 ed0bc9da2..638f9f9bb 100644 --- a/src/lib/gramjs/tl/api.d.ts +++ b/src/lib/gramjs/tl/api.d.ts @@ -86,7 +86,7 @@ namespace Api { export type TypeImportedContact = ImportedContact; export type TypeContactStatus = ContactStatus; export type TypeMessagesFilter = InputMessagesFilterEmpty | InputMessagesFilterPhotos | InputMessagesFilterVideo | InputMessagesFilterPhotoVideo | InputMessagesFilterDocument | InputMessagesFilterUrl | InputMessagesFilterGif | InputMessagesFilterVoice | InputMessagesFilterMusic | InputMessagesFilterChatPhotos | InputMessagesFilterPhoneCalls | InputMessagesFilterRoundVoice | InputMessagesFilterRoundVideo | InputMessagesFilterMyMentions | InputMessagesFilterGeo | InputMessagesFilterContacts | InputMessagesFilterPinned; - export type TypeUpdate = UpdateNewMessage | UpdateMessageID | UpdateDeleteMessages | UpdateUserTyping | UpdateChatUserTyping | UpdateChatParticipants | UpdateUserStatus | UpdateUserName | UpdateNewAuthorization | UpdateNewEncryptedMessage | UpdateEncryptedChatTyping | UpdateEncryption | UpdateEncryptedMessagesRead | UpdateChatParticipantAdd | UpdateChatParticipantDelete | UpdateDcOptions | UpdateNotifySettings | UpdateServiceNotification | UpdatePrivacy | UpdateUserPhone | UpdateReadHistoryInbox | UpdateReadHistoryOutbox | UpdateWebPage | UpdateReadMessagesContents | UpdateChannelTooLong | UpdateChannel | UpdateNewChannelMessage | UpdateReadChannelInbox | UpdateDeleteChannelMessages | UpdateChannelMessageViews | UpdateChatParticipantAdmin | UpdateNewStickerSet | UpdateStickerSetsOrder | UpdateStickerSets | UpdateSavedGifs | UpdateBotInlineQuery | UpdateBotInlineSend | UpdateEditChannelMessage | UpdateBotCallbackQuery | UpdateEditMessage | UpdateInlineBotCallbackQuery | UpdateReadChannelOutbox | UpdateDraftMessage | UpdateReadFeaturedStickers | UpdateRecentStickers | UpdateConfig | UpdatePtsChanged | UpdateChannelWebPage | UpdateDialogPinned | UpdatePinnedDialogs | UpdateBotWebhookJSON | UpdateBotWebhookJSONQuery | UpdateBotShippingQuery | UpdateBotPrecheckoutQuery | UpdatePhoneCall | UpdateLangPackTooLong | UpdateLangPack | UpdateFavedStickers | UpdateChannelReadMessagesContents | UpdateContactsReset | UpdateChannelAvailableMessages | UpdateDialogUnreadMark | UpdateMessagePoll | UpdateChatDefaultBannedRights | UpdateFolderPeers | UpdatePeerSettings | UpdatePeerLocated | UpdateNewScheduledMessage | UpdateDeleteScheduledMessages | UpdateTheme | UpdateGeoLiveViewed | UpdateLoginToken | UpdateMessagePollVote | UpdateDialogFilter | UpdateDialogFilterOrder | UpdateDialogFilters | UpdatePhoneCallSignalingData | UpdateChannelMessageForwards | UpdateReadChannelDiscussionInbox | UpdateReadChannelDiscussionOutbox | UpdatePeerBlocked | UpdateChannelUserTyping | UpdatePinnedMessages | UpdatePinnedChannelMessages | UpdateChat | UpdateGroupCallParticipants | UpdateGroupCall | UpdatePeerHistoryTTL | UpdateChatParticipant | UpdateChannelParticipant | UpdateBotStopped | UpdateGroupCallConnection | UpdateBotCommands | UpdatePendingJoinRequests | UpdateBotChatInviteRequester | UpdateMessageReactions | UpdateAttachMenuBots | UpdateWebViewResultSent | UpdateBotMenuButton | UpdateSavedRingtones | UpdateTranscribedAudio | UpdateReadFeaturedEmojiStickers | UpdateUserEmojiStatus | UpdateRecentEmojiStatuses | UpdateRecentReactions | UpdateMoveStickerSetToTop | UpdateMessageExtendedMedia | UpdateChannelPinnedTopic | UpdateChannelPinnedTopics | UpdateUser | UpdateAutoSaveSettings | UpdateStory | UpdateReadStories | UpdateStoryID | UpdateStoriesStealthMode | UpdateSentStoryReaction | UpdateBotChatBoost | UpdateChannelViewForumAsMessages | UpdatePeerWallpaper | UpdateBotMessageReaction | UpdateBotMessageReactions | UpdateSavedDialogPinned | UpdatePinnedSavedDialogs | UpdateSavedReactionTags | UpdateSmsJob | UpdateQuickReplies | UpdateNewQuickReply | UpdateDeleteQuickReply | UpdateQuickReplyMessage | UpdateDeleteQuickReplyMessages | UpdateBotBusinessConnect | UpdateBotNewBusinessMessage | UpdateBotEditBusinessMessage | UpdateBotDeleteBusinessMessage | UpdateNewStoryReaction | UpdateBroadcastRevenueTransactions | UpdateStarsBalance | UpdateBusinessBotCallbackQuery | UpdateStarsRevenueStatus | UpdateBotPurchasedPaidMedia | UpdatePaidReactionPrivacy | UpdateBotSubscriptionExpire; + export type TypeUpdate = UpdateNewMessage | UpdateMessageID | UpdateDeleteMessages | UpdateUserTyping | UpdateChatUserTyping | UpdateChatParticipants | UpdateUserStatus | UpdateUserName | UpdateNewAuthorization | UpdateNewEncryptedMessage | UpdateEncryptedChatTyping | UpdateEncryption | UpdateEncryptedMessagesRead | UpdateChatParticipantAdd | UpdateChatParticipantDelete | UpdateDcOptions | UpdateNotifySettings | UpdateServiceNotification | UpdatePrivacy | UpdateUserPhone | UpdateReadHistoryInbox | UpdateReadHistoryOutbox | UpdateWebPage | UpdateReadMessagesContents | UpdateChannelTooLong | UpdateChannel | UpdateNewChannelMessage | UpdateReadChannelInbox | UpdateDeleteChannelMessages | UpdateChannelMessageViews | UpdateChatParticipantAdmin | UpdateNewStickerSet | UpdateStickerSetsOrder | UpdateStickerSets | UpdateSavedGifs | UpdateBotInlineQuery | UpdateBotInlineSend | UpdateEditChannelMessage | UpdateBotCallbackQuery | UpdateEditMessage | UpdateInlineBotCallbackQuery | UpdateReadChannelOutbox | UpdateDraftMessage | UpdateReadFeaturedStickers | UpdateRecentStickers | UpdateConfig | UpdatePtsChanged | UpdateChannelWebPage | UpdateDialogPinned | UpdatePinnedDialogs | UpdateBotWebhookJSON | UpdateBotWebhookJSONQuery | UpdateBotShippingQuery | UpdateBotPrecheckoutQuery | UpdatePhoneCall | UpdateLangPackTooLong | UpdateLangPack | UpdateFavedStickers | UpdateChannelReadMessagesContents | UpdateContactsReset | UpdateChannelAvailableMessages | UpdateDialogUnreadMark | UpdateMessagePoll | UpdateChatDefaultBannedRights | UpdateFolderPeers | UpdatePeerSettings | UpdatePeerLocated | UpdateNewScheduledMessage | UpdateDeleteScheduledMessages | UpdateTheme | UpdateGeoLiveViewed | UpdateLoginToken | UpdateMessagePollVote | UpdateDialogFilter | UpdateDialogFilterOrder | UpdateDialogFilters | UpdatePhoneCallSignalingData | UpdateChannelMessageForwards | UpdateReadChannelDiscussionInbox | UpdateReadChannelDiscussionOutbox | UpdatePeerBlocked | UpdateChannelUserTyping | UpdatePinnedMessages | UpdatePinnedChannelMessages | UpdateChat | UpdateGroupCallParticipants | UpdateGroupCall | UpdatePeerHistoryTTL | UpdateChatParticipant | UpdateChannelParticipant | UpdateBotStopped | UpdateGroupCallConnection | UpdateBotCommands | UpdatePendingJoinRequests | UpdateBotChatInviteRequester | UpdateMessageReactions | UpdateAttachMenuBots | UpdateWebViewResultSent | UpdateBotMenuButton | UpdateSavedRingtones | UpdateTranscribedAudio | UpdateReadFeaturedEmojiStickers | UpdateUserEmojiStatus | UpdateRecentEmojiStatuses | UpdateRecentReactions | UpdateMoveStickerSetToTop | UpdateMessageExtendedMedia | UpdateChannelPinnedTopic | UpdateChannelPinnedTopics | UpdateUser | UpdateAutoSaveSettings | UpdateStory | UpdateReadStories | UpdateStoryID | UpdateStoriesStealthMode | UpdateSentStoryReaction | UpdateBotChatBoost | UpdateChannelViewForumAsMessages | UpdatePeerWallpaper | UpdateBotMessageReaction | UpdateBotMessageReactions | UpdateSavedDialogPinned | UpdatePinnedSavedDialogs | UpdateSavedReactionTags | UpdateSmsJob | UpdateQuickReplies | UpdateNewQuickReply | UpdateDeleteQuickReply | UpdateQuickReplyMessage | UpdateDeleteQuickReplyMessages | UpdateBotBusinessConnect | UpdateBotNewBusinessMessage | UpdateBotEditBusinessMessage | UpdateBotDeleteBusinessMessage | UpdateNewStoryReaction | UpdateBroadcastRevenueTransactions | UpdateStarsBalance | UpdateBusinessBotCallbackQuery | UpdateStarsRevenueStatus | UpdateBotPurchasedPaidMedia | UpdatePaidReactionPrivacy; export type TypeUpdates = UpdatesTooLong | UpdateShortMessage | UpdateShortChatMessage | UpdateShort | UpdatesCombined | Updates | UpdateShortSentMessage; export type TypeDcOption = DcOption; export type TypeConfig = Config; @@ -382,6 +382,9 @@ namespace Api { export type TypeMessageReportOption = MessageReportOption; export type TypeReportResult = ReportResultChooseOption | ReportResultAddComment | ReportResultReported; export type TypeBotAppSettings = BotAppSettings; + export type TypeStarRefProgram = StarRefProgram; + export type TypeConnectedBotStarRef = ConnectedBotStarRef; + export type TypeStarsAmount = StarsAmount; export type TypeResPQ = ResPQ; export type TypeP_Q_inner_data = PQInnerData | PQInnerDataDc | PQInnerDataTemp | PQInnerDataTempDc; export type TypeServer_DH_Params = ServerDHParamsFail | ServerDHParamsOk; @@ -494,6 +497,7 @@ namespace Api { export type TypeAvailableEffects = messages.AvailableEffectsNotModified | messages.AvailableEffects; export type TypeBotPreparedInlineMessage = messages.BotPreparedInlineMessage; export type TypePreparedInlineMessage = messages.PreparedInlineMessage; + export type TypeFoundStickers = messages.FoundStickersNotModified | messages.FoundStickers; } export namespace updates { @@ -587,6 +591,8 @@ namespace Api { export type TypeStarsRevenueAdsAccountUrl = payments.StarsRevenueAdsAccountUrl; export type TypeStarGifts = payments.StarGiftsNotModified | payments.StarGifts; export type TypeUserStarGifts = payments.UserStarGifts; + export type TypeConnectedStarRefBots = payments.ConnectedStarRefBots; + export type TypeSuggestedStarRefBots = payments.SuggestedStarRefBots; } export namespace phone { @@ -2041,6 +2047,7 @@ namespace Api { info?: Api.TypePaymentRequestedInfo; shippingOptionId?: string; charge: Api.TypePaymentCharge; + subscriptionUntilDate?: int; }> { // flags: undefined; recurringInit?: true; @@ -2051,6 +2058,7 @@ namespace Api { info?: Api.TypePaymentRequestedInfo; shippingOptionId?: string; charge: Api.TypePaymentCharge; + subscriptionUntilDate?: int; }; export class MessageActionPaymentSent extends VirtualClass<{ // flags: undefined; @@ -2059,6 +2067,7 @@ namespace Api { currency: string; totalAmount: long; invoiceSlug?: string; + subscriptionUntilDate?: int; }> { // flags: undefined; recurringInit?: true; @@ -2066,6 +2075,7 @@ namespace Api { currency: string; totalAmount: long; invoiceSlug?: string; + subscriptionUntilDate?: int; }; export class MessageActionPhoneCall extends VirtualClass<{ // flags: undefined; @@ -2693,6 +2703,7 @@ namespace Api { personalChannelId?: long; personalChannelMessage?: int; stargiftsCount?: int; + starrefProgram?: Api.TypeStarRefProgram; }> { // flags: undefined; blocked?: true; @@ -2740,6 +2751,7 @@ namespace Api { personalChannelId?: long; personalChannelMessage?: int; stargiftsCount?: int; + starrefProgram?: Api.TypeStarRefProgram; }; export class Contact extends VirtualClass<{ userId: long; @@ -3948,9 +3960,9 @@ namespace Api { balances: Api.TypeBroadcastRevenueBalances; }; export class UpdateStarsBalance extends VirtualClass<{ - balance: long; + balance: Api.TypeStarsAmount; }> { - balance: long; + balance: Api.TypeStarsAmount; }; export class UpdateBusinessBotCallbackQuery extends VirtualClass<{ // flags: undefined; @@ -3992,19 +4004,6 @@ namespace Api { }> { private: Bool; }; - export class UpdateBotSubscriptionExpire extends VirtualClass<{ - userId: long; - payload: string; - invoiceSlug: string; - untilDate: int; - qts: int; - }> { - userId: long; - payload: string; - invoiceSlug: string; - untilDate: int; - qts: int; - }; export class UpdatesTooLong extends VirtualClass {}; export class UpdateShortMessage extends VirtualClass<{ // flags: undefined; @@ -10349,7 +10348,7 @@ namespace Api { gift?: true; reaction?: true; id: string; - stars: long; + stars: Api.TypeStarsAmount; date: int; peer: Api.TypeStarsTransactionPeer; title?: string; @@ -10364,6 +10363,9 @@ namespace Api { giveawayPostId?: int; stargift?: Api.TypeStarGift; floodskipNumber?: int; + starrefCommissionPermille?: int; + starrefPeer?: Api.TypePeer; + starrefAmount?: Api.TypeStarsAmount; }> { // flags: undefined; refund?: true; @@ -10372,7 +10374,7 @@ namespace Api { gift?: true; reaction?: true; id: string; - stars: long; + stars: Api.TypeStarsAmount; date: int; peer: Api.TypeStarsTransactionPeer; title?: string; @@ -10387,6 +10389,9 @@ namespace Api { giveawayPostId?: int; stargift?: Api.TypeStarGift; floodskipNumber?: int; + starrefCommissionPermille?: int; + starrefPeer?: Api.TypePeer; + starrefAmount?: Api.TypeStarsAmount; }; export class FoundStory extends VirtualClass<{ peer: Api.TypePeer; @@ -10411,16 +10416,16 @@ namespace Api { export class StarsRevenueStatus extends VirtualClass<{ // flags: undefined; withdrawalEnabled?: true; - currentBalance: long; - availableBalance: long; - overallRevenue: long; + currentBalance: Api.TypeStarsAmount; + availableBalance: Api.TypeStarsAmount; + overallRevenue: Api.TypeStarsAmount; nextWithdrawalAt?: int; }> { // flags: undefined; withdrawalEnabled?: true; - currentBalance: long; - availableBalance: long; - overallRevenue: long; + currentBalance: Api.TypeStarsAmount; + availableBalance: Api.TypeStarsAmount; + overallRevenue: Api.TypeStarsAmount; nextWithdrawalAt?: int; }; export class InputStarsTransaction extends VirtualClass<{ @@ -10624,6 +10629,49 @@ namespace Api { headerColor?: int; headerDarkColor?: int; }; + export class StarRefProgram extends VirtualClass<{ + // flags: undefined; + botId: long; + commissionPermille: int; + durationMonths?: int; + endDate?: int; + dailyRevenuePerUser?: Api.TypeStarsAmount; + }> { + // flags: undefined; + botId: long; + commissionPermille: int; + durationMonths?: int; + endDate?: int; + dailyRevenuePerUser?: Api.TypeStarsAmount; + }; + export class ConnectedBotStarRef extends VirtualClass<{ + // flags: undefined; + revoked?: true; + url: string; + date: int; + botId: long; + commissionPermille: int; + durationMonths?: int; + participants: long; + revenue: long; + }> { + // flags: undefined; + revoked?: true; + url: string; + date: int; + botId: long; + commissionPermille: int; + durationMonths?: int; + participants: long; + revenue: long; + }; + export class StarsAmount extends VirtualClass<{ + amount: long; + nanos: int; + }> { + amount: long; + nanos: int; + }; export class ResPQ extends VirtualClass<{ nonce: int128; serverNonce: int128; @@ -11951,6 +11999,24 @@ namespace Api { cacheTime: int; users: Api.TypeUser[]; }; + export class FoundStickersNotModified extends VirtualClass<{ + // flags: undefined; + nextOffset?: int; + } | void> { + // flags: undefined; + nextOffset?: int; + }; + export class FoundStickers extends VirtualClass<{ + // flags: undefined; + nextOffset?: int; + hash: long; + stickers: Api.TypeDocument[]; + }> { + // flags: undefined; + nextOffset?: int; + hash: long; + stickers: Api.TypeDocument[]; + }; } export namespace updates { @@ -12895,7 +12961,7 @@ namespace Api { }; export class StarsStatus extends VirtualClass<{ // flags: undefined; - balance: long; + balance: Api.TypeStarsAmount; subscriptions?: Api.TypeStarsSubscription[]; subscriptionsNextOffset?: string; subscriptionsMissingBalance?: long; @@ -12905,7 +12971,7 @@ namespace Api { users: Api.TypeUser[]; }> { // flags: undefined; - balance: long; + balance: Api.TypeStarsAmount; subscriptions?: Api.TypeStarsSubscription[]; subscriptionsNextOffset?: string; subscriptionsMissingBalance?: long; @@ -12954,6 +13020,28 @@ namespace Api { nextOffset?: string; users: Api.TypeUser[]; }; + export class ConnectedStarRefBots extends VirtualClass<{ + count: int; + connectedBots: Api.TypeConnectedBotStarRef[]; + users: Api.TypeUser[]; + }> { + count: int; + connectedBots: Api.TypeConnectedBotStarRef[]; + users: Api.TypeUser[]; + }; + export class SuggestedStarRefBots extends VirtualClass<{ + // flags: undefined; + count: int; + suggestedBots: Api.TypeStarRefProgram[]; + users: Api.TypeUser[]; + nextOffset?: string; + }> { + // flags: undefined; + count: int; + suggestedBots: Api.TypeStarRefProgram[]; + users: Api.TypeUser[]; + nextOffset?: string; + }; } export namespace phone { @@ -14600,9 +14688,13 @@ namespace Api { limit: int; }; export class ResolveUsername extends Request, contacts.TypeResolvedPeer> { + // flags: undefined; username: string; + referer?: string; }; export class GetTopPeers extends Request, messages.TypeFoundStickers> { + // flags: undefined; + emojis?: true; + q: string; + emoticon: string; + langCode: string[]; + offset: int; + limit: int; + hash: long; + }; } export namespace updates { @@ -17919,6 +18030,18 @@ namespace Api { fileName: string; url: string; }; + export class GetAdminedBots extends Request {}; + export class UpdateStarRefProgram extends Request, Api.TypeStarRefProgram> { + // flags: undefined; + bot: Api.TypeInputUser; + commissionPermille: int; + durationMonths?: int; + }; } export namespace payments { @@ -18180,14 +18303,65 @@ namespace Api { // flags: undefined; restore?: true; userId: Api.TypeInputUser; - invoiceSlug?: string; - chargeId?: string; + chargeId: string; }>, Bool> { // flags: undefined; restore?: true; userId: Api.TypeInputUser; - invoiceSlug?: string; - chargeId?: string; + chargeId: string; + }; + export class GetConnectedStarRefBots extends Request, payments.TypeConnectedStarRefBots> { + // flags: undefined; + peer: Api.TypeInputPeer; + offsetDate?: int; + offsetLink?: string; + limit: int; + }; + export class GetConnectedStarRefBot extends Request, payments.TypeConnectedStarRefBots> { + peer: Api.TypeInputPeer; + bot: Api.TypeInputUser; + }; + export class GetSuggestedStarRefBots extends Request, payments.TypeSuggestedStarRefBots> { + // flags: undefined; + orderByRevenue?: true; + orderByDate?: true; + peer: Api.TypeInputPeer; + offset: string; + limit: int; + }; + export class ConnectStarRefBot extends Request, payments.TypeConnectedStarRefBots> { + peer: Api.TypeInputPeer; + bot: Api.TypeInputUser; + }; + export class EditConnectedStarRefBot extends Request, payments.TypeConnectedStarRefBots> { + // flags: undefined; + revoked?: true; + peer: Api.TypeInputPeer; + link: string; }; } @@ -19130,14 +19304,14 @@ namespace Api { | account.RegisterDevice | account.UnregisterDevice | account.UpdateNotifySettings | account.GetNotifySettings | account.ResetNotifySettings | account.UpdateProfile | account.UpdateStatus | account.GetWallPapers | account.ReportPeer | account.CheckUsername | account.UpdateUsername | account.GetPrivacy | account.SetPrivacy | account.DeleteAccount | account.GetAccountTTL | account.SetAccountTTL | account.SendChangePhoneCode | account.ChangePhone | account.UpdateDeviceLocked | account.GetAuthorizations | account.ResetAuthorization | account.GetPassword | account.GetPasswordSettings | account.UpdatePasswordSettings | account.SendConfirmPhoneCode | account.ConfirmPhone | account.GetTmpPassword | account.GetWebAuthorizations | account.ResetWebAuthorization | account.ResetWebAuthorizations | account.GetAllSecureValues | account.GetSecureValue | account.SaveSecureValue | account.DeleteSecureValue | account.GetAuthorizationForm | account.AcceptAuthorization | account.SendVerifyPhoneCode | account.VerifyPhone | account.SendVerifyEmailCode | account.VerifyEmail | account.InitTakeoutSession | account.FinishTakeoutSession | account.ConfirmPasswordEmail | account.ResendPasswordEmail | account.CancelPasswordEmail | account.GetContactSignUpNotification | account.SetContactSignUpNotification | account.GetNotifyExceptions | account.GetWallPaper | account.UploadWallPaper | account.SaveWallPaper | account.InstallWallPaper | account.ResetWallPapers | account.GetAutoDownloadSettings | account.SaveAutoDownloadSettings | account.UploadTheme | account.CreateTheme | account.UpdateTheme | account.SaveTheme | account.InstallTheme | account.GetTheme | account.GetThemes | account.SetContentSettings | account.GetContentSettings | account.GetMultiWallPapers | account.GetGlobalPrivacySettings | account.SetGlobalPrivacySettings | account.ReportProfilePhoto | account.ResetPassword | account.DeclinePasswordReset | account.GetChatThemes | account.SetAuthorizationTTL | account.ChangeAuthorizationSettings | account.GetSavedRingtones | account.SaveRingtone | account.UploadRingtone | account.UpdateEmojiStatus | account.GetDefaultEmojiStatuses | account.GetRecentEmojiStatuses | account.ClearRecentEmojiStatuses | account.ReorderUsernames | account.ToggleUsername | account.GetDefaultProfilePhotoEmojis | account.GetDefaultGroupPhotoEmojis | account.GetAutoSaveSettings | account.SaveAutoSaveSettings | account.DeleteAutoSaveExceptions | account.InvalidateSignInCodes | account.UpdateColor | account.GetDefaultBackgroundEmojis | account.GetChannelDefaultEmojiStatuses | account.GetChannelRestrictedStatusEmojis | account.UpdateBusinessWorkHours | account.UpdateBusinessLocation | account.UpdateBusinessGreetingMessage | account.UpdateBusinessAwayMessage | account.UpdateConnectedBot | account.GetConnectedBots | account.GetBotBusinessConnection | account.UpdateBusinessIntro | account.ToggleConnectedBotPaused | account.DisablePeerConnectedBot | account.UpdateBirthday | account.CreateBusinessChatLink | account.EditBusinessChatLink | account.DeleteBusinessChatLink | account.GetBusinessChatLinks | account.ResolveBusinessChatLink | account.UpdatePersonalChannel | account.ToggleSponsoredMessages | account.GetReactionsNotifySettings | account.SetReactionsNotifySettings | users.GetUsers | users.GetFullUser | users.SetSecureValueErrors | users.GetIsPremiumRequiredToContact | contacts.GetContactIDs | contacts.GetStatuses | contacts.GetContacts | contacts.ImportContacts | contacts.DeleteContacts | contacts.DeleteByPhones | contacts.Block | contacts.Unblock | contacts.GetBlocked | contacts.Search | contacts.ResolveUsername | contacts.GetTopPeers | contacts.ResetTopPeerRating | contacts.ResetSaved | contacts.GetSaved | contacts.ToggleTopPeers | contacts.AddContact | contacts.AcceptContact | contacts.GetLocated | contacts.BlockFromReplies | contacts.ResolvePhone | contacts.ExportContactToken | contacts.ImportContactToken | contacts.EditCloseFriends | contacts.SetBlocked | contacts.GetBirthdays - | messages.GetMessages | messages.GetDialogs | messages.GetHistory | messages.Search | messages.ReadHistory | messages.DeleteHistory | messages.DeleteMessages | messages.ReceivedMessages | messages.SetTyping | messages.SendMessage | messages.SendMedia | messages.ForwardMessages | messages.ReportSpam | messages.GetPeerSettings | messages.Report | messages.GetChats | messages.GetFullChat | messages.EditChatTitle | messages.EditChatPhoto | messages.AddChatUser | messages.DeleteChatUser | messages.CreateChat | messages.GetDhConfig | messages.RequestEncryption | messages.AcceptEncryption | messages.DiscardEncryption | messages.SetEncryptedTyping | messages.ReadEncryptedHistory | messages.SendEncrypted | messages.SendEncryptedFile | messages.SendEncryptedService | messages.ReceivedQueue | messages.ReportEncryptedSpam | messages.ReadMessageContents | messages.GetStickers | messages.GetAllStickers | messages.GetWebPagePreview | messages.ExportChatInvite | messages.CheckChatInvite | messages.ImportChatInvite | messages.GetStickerSet | messages.InstallStickerSet | messages.UninstallStickerSet | messages.StartBot | messages.GetMessagesViews | messages.EditChatAdmin | messages.MigrateChat | messages.SearchGlobal | messages.ReorderStickerSets | messages.GetDocumentByHash | messages.GetSavedGifs | messages.SaveGif | messages.GetInlineBotResults | messages.SetInlineBotResults | messages.SendInlineBotResult | messages.GetMessageEditData | messages.EditMessage | messages.EditInlineBotMessage | messages.GetBotCallbackAnswer | messages.SetBotCallbackAnswer | messages.GetPeerDialogs | messages.SaveDraft | messages.GetAllDrafts | messages.GetFeaturedStickers | messages.ReadFeaturedStickers | messages.GetRecentStickers | messages.SaveRecentSticker | messages.ClearRecentStickers | messages.GetArchivedStickers | messages.GetMaskStickers | messages.GetAttachedStickers | messages.SetGameScore | messages.SetInlineGameScore | messages.GetGameHighScores | messages.GetInlineGameHighScores | messages.GetCommonChats | messages.GetWebPage | messages.ToggleDialogPin | messages.ReorderPinnedDialogs | messages.GetPinnedDialogs | messages.SetBotShippingResults | messages.SetBotPrecheckoutResults | messages.UploadMedia | messages.SendScreenshotNotification | messages.GetFavedStickers | messages.FaveSticker | messages.GetUnreadMentions | messages.ReadMentions | messages.GetRecentLocations | messages.SendMultiMedia | messages.UploadEncryptedFile | messages.SearchStickerSets | messages.GetSplitRanges | messages.MarkDialogUnread | messages.GetDialogUnreadMarks | messages.ClearAllDrafts | messages.UpdatePinnedMessage | messages.SendVote | messages.GetPollResults | messages.GetOnlines | messages.EditChatAbout | messages.EditChatDefaultBannedRights | messages.GetEmojiKeywords | messages.GetEmojiKeywordsDifference | messages.GetEmojiKeywordsLanguages | messages.GetEmojiURL | messages.GetSearchCounters | messages.RequestUrlAuth | messages.AcceptUrlAuth | messages.HidePeerSettingsBar | messages.GetScheduledHistory | messages.GetScheduledMessages | messages.SendScheduledMessages | messages.DeleteScheduledMessages | messages.GetPollVotes | messages.ToggleStickerSets | messages.GetDialogFilters | messages.GetSuggestedDialogFilters | messages.UpdateDialogFilter | messages.UpdateDialogFiltersOrder | messages.GetOldFeaturedStickers | messages.GetReplies | messages.GetDiscussionMessage | messages.ReadDiscussion | messages.UnpinAllMessages | messages.DeleteChat | messages.DeletePhoneCallHistory | messages.CheckHistoryImport | messages.InitHistoryImport | messages.UploadImportedMedia | messages.StartHistoryImport | messages.GetExportedChatInvites | messages.GetExportedChatInvite | messages.EditExportedChatInvite | messages.DeleteRevokedExportedChatInvites | messages.DeleteExportedChatInvite | messages.GetAdminsWithInvites | messages.GetChatInviteImporters | messages.SetHistoryTTL | messages.CheckHistoryImportPeer | messages.SetChatTheme | messages.GetMessageReadParticipants | messages.GetSearchResultsCalendar | messages.GetSearchResultsPositions | messages.HideChatJoinRequest | messages.HideAllChatJoinRequests | messages.ToggleNoForwards | messages.SaveDefaultSendAs | messages.SendReaction | messages.GetMessagesReactions | messages.GetMessageReactionsList | messages.SetChatAvailableReactions | messages.GetAvailableReactions | messages.SetDefaultReaction | messages.TranslateText | messages.GetUnreadReactions | messages.ReadReactions | messages.SearchSentMedia | messages.GetAttachMenuBots | messages.GetAttachMenuBot | messages.ToggleBotInAttachMenu | messages.RequestWebView | messages.ProlongWebView | messages.RequestSimpleWebView | messages.SendWebViewResultMessage | messages.SendWebViewData | messages.TranscribeAudio | messages.RateTranscribedAudio | messages.GetCustomEmojiDocuments | messages.GetEmojiStickers | messages.GetFeaturedEmojiStickers | messages.ReportReaction | messages.GetTopReactions | messages.GetRecentReactions | messages.ClearRecentReactions | messages.GetExtendedMedia | messages.SetDefaultHistoryTTL | messages.GetDefaultHistoryTTL | messages.SendBotRequestedPeer | messages.GetEmojiGroups | messages.GetEmojiStatusGroups | messages.GetEmojiProfilePhotoGroups | messages.SearchCustomEmoji | messages.TogglePeerTranslations | messages.GetBotApp | messages.RequestAppWebView | messages.SetChatWallPaper | messages.SearchEmojiStickerSets | messages.GetSavedDialogs | messages.GetSavedHistory | messages.DeleteSavedHistory | messages.GetPinnedSavedDialogs | messages.ToggleSavedDialogPin | messages.ReorderPinnedSavedDialogs | messages.GetSavedReactionTags | messages.UpdateSavedReactionTag | messages.GetDefaultTagReactions | messages.GetOutboxReadDate | messages.GetQuickReplies | messages.ReorderQuickReplies | messages.CheckQuickReplyShortcut | messages.EditQuickReplyShortcut | messages.DeleteQuickReplyShortcut | messages.GetQuickReplyMessages | messages.SendQuickReplyMessages | messages.DeleteQuickReplyMessages | messages.ToggleDialogFilterTags | messages.GetMyStickers | messages.GetEmojiStickerGroups | messages.GetAvailableEffects | messages.EditFactCheck | messages.DeleteFactCheck | messages.GetFactCheck | messages.RequestMainWebView | messages.SendPaidReaction | messages.TogglePaidReactionPrivacy | messages.GetPaidReactionPrivacy | messages.ViewSponsoredMessage | messages.ClickSponsoredMessage | messages.ReportSponsoredMessage | messages.GetSponsoredMessages | messages.SavePreparedInlineMessage | messages.GetPreparedInlineMessage + | messages.GetMessages | messages.GetDialogs | messages.GetHistory | messages.Search | messages.ReadHistory | messages.DeleteHistory | messages.DeleteMessages | messages.ReceivedMessages | messages.SetTyping | messages.SendMessage | messages.SendMedia | messages.ForwardMessages | messages.ReportSpam | messages.GetPeerSettings | messages.Report | messages.GetChats | messages.GetFullChat | messages.EditChatTitle | messages.EditChatPhoto | messages.AddChatUser | messages.DeleteChatUser | messages.CreateChat | messages.GetDhConfig | messages.RequestEncryption | messages.AcceptEncryption | messages.DiscardEncryption | messages.SetEncryptedTyping | messages.ReadEncryptedHistory | messages.SendEncrypted | messages.SendEncryptedFile | messages.SendEncryptedService | messages.ReceivedQueue | messages.ReportEncryptedSpam | messages.ReadMessageContents | messages.GetStickers | messages.GetAllStickers | messages.GetWebPagePreview | messages.ExportChatInvite | messages.CheckChatInvite | messages.ImportChatInvite | messages.GetStickerSet | messages.InstallStickerSet | messages.UninstallStickerSet | messages.StartBot | messages.GetMessagesViews | messages.EditChatAdmin | messages.MigrateChat | messages.SearchGlobal | messages.ReorderStickerSets | messages.GetDocumentByHash | messages.GetSavedGifs | messages.SaveGif | messages.GetInlineBotResults | messages.SetInlineBotResults | messages.SendInlineBotResult | messages.GetMessageEditData | messages.EditMessage | messages.EditInlineBotMessage | messages.GetBotCallbackAnswer | messages.SetBotCallbackAnswer | messages.GetPeerDialogs | messages.SaveDraft | messages.GetAllDrafts | messages.GetFeaturedStickers | messages.ReadFeaturedStickers | messages.GetRecentStickers | messages.SaveRecentSticker | messages.ClearRecentStickers | messages.GetArchivedStickers | messages.GetMaskStickers | messages.GetAttachedStickers | messages.SetGameScore | messages.SetInlineGameScore | messages.GetGameHighScores | messages.GetInlineGameHighScores | messages.GetCommonChats | messages.GetWebPage | messages.ToggleDialogPin | messages.ReorderPinnedDialogs | messages.GetPinnedDialogs | messages.SetBotShippingResults | messages.SetBotPrecheckoutResults | messages.UploadMedia | messages.SendScreenshotNotification | messages.GetFavedStickers | messages.FaveSticker | messages.GetUnreadMentions | messages.ReadMentions | messages.GetRecentLocations | messages.SendMultiMedia | messages.UploadEncryptedFile | messages.SearchStickerSets | messages.GetSplitRanges | messages.MarkDialogUnread | messages.GetDialogUnreadMarks | messages.ClearAllDrafts | messages.UpdatePinnedMessage | messages.SendVote | messages.GetPollResults | messages.GetOnlines | messages.EditChatAbout | messages.EditChatDefaultBannedRights | messages.GetEmojiKeywords | messages.GetEmojiKeywordsDifference | messages.GetEmojiKeywordsLanguages | messages.GetEmojiURL | messages.GetSearchCounters | messages.RequestUrlAuth | messages.AcceptUrlAuth | messages.HidePeerSettingsBar | messages.GetScheduledHistory | messages.GetScheduledMessages | messages.SendScheduledMessages | messages.DeleteScheduledMessages | messages.GetPollVotes | messages.ToggleStickerSets | messages.GetDialogFilters | messages.GetSuggestedDialogFilters | messages.UpdateDialogFilter | messages.UpdateDialogFiltersOrder | messages.GetOldFeaturedStickers | messages.GetReplies | messages.GetDiscussionMessage | messages.ReadDiscussion | messages.UnpinAllMessages | messages.DeleteChat | messages.DeletePhoneCallHistory | messages.CheckHistoryImport | messages.InitHistoryImport | messages.UploadImportedMedia | messages.StartHistoryImport | messages.GetExportedChatInvites | messages.GetExportedChatInvite | messages.EditExportedChatInvite | messages.DeleteRevokedExportedChatInvites | messages.DeleteExportedChatInvite | messages.GetAdminsWithInvites | messages.GetChatInviteImporters | messages.SetHistoryTTL | messages.CheckHistoryImportPeer | messages.SetChatTheme | messages.GetMessageReadParticipants | messages.GetSearchResultsCalendar | messages.GetSearchResultsPositions | messages.HideChatJoinRequest | messages.HideAllChatJoinRequests | messages.ToggleNoForwards | messages.SaveDefaultSendAs | messages.SendReaction | messages.GetMessagesReactions | messages.GetMessageReactionsList | messages.SetChatAvailableReactions | messages.GetAvailableReactions | messages.SetDefaultReaction | messages.TranslateText | messages.GetUnreadReactions | messages.ReadReactions | messages.SearchSentMedia | messages.GetAttachMenuBots | messages.GetAttachMenuBot | messages.ToggleBotInAttachMenu | messages.RequestWebView | messages.ProlongWebView | messages.RequestSimpleWebView | messages.SendWebViewResultMessage | messages.SendWebViewData | messages.TranscribeAudio | messages.RateTranscribedAudio | messages.GetCustomEmojiDocuments | messages.GetEmojiStickers | messages.GetFeaturedEmojiStickers | messages.ReportReaction | messages.GetTopReactions | messages.GetRecentReactions | messages.ClearRecentReactions | messages.GetExtendedMedia | messages.SetDefaultHistoryTTL | messages.GetDefaultHistoryTTL | messages.SendBotRequestedPeer | messages.GetEmojiGroups | messages.GetEmojiStatusGroups | messages.GetEmojiProfilePhotoGroups | messages.SearchCustomEmoji | messages.TogglePeerTranslations | messages.GetBotApp | messages.RequestAppWebView | messages.SetChatWallPaper | messages.SearchEmojiStickerSets | messages.GetSavedDialogs | messages.GetSavedHistory | messages.DeleteSavedHistory | messages.GetPinnedSavedDialogs | messages.ToggleSavedDialogPin | messages.ReorderPinnedSavedDialogs | messages.GetSavedReactionTags | messages.UpdateSavedReactionTag | messages.GetDefaultTagReactions | messages.GetOutboxReadDate | messages.GetQuickReplies | messages.ReorderQuickReplies | messages.CheckQuickReplyShortcut | messages.EditQuickReplyShortcut | messages.DeleteQuickReplyShortcut | messages.GetQuickReplyMessages | messages.SendQuickReplyMessages | messages.DeleteQuickReplyMessages | messages.ToggleDialogFilterTags | messages.GetMyStickers | messages.GetEmojiStickerGroups | messages.GetAvailableEffects | messages.EditFactCheck | messages.DeleteFactCheck | messages.GetFactCheck | messages.RequestMainWebView | messages.SendPaidReaction | messages.TogglePaidReactionPrivacy | messages.GetPaidReactionPrivacy | messages.ViewSponsoredMessage | messages.ClickSponsoredMessage | messages.ReportSponsoredMessage | messages.GetSponsoredMessages | messages.SavePreparedInlineMessage | messages.GetPreparedInlineMessage | messages.SearchStickers | updates.GetState | updates.GetDifference | updates.GetChannelDifference | photos.UpdateProfilePhoto | photos.UploadProfilePhoto | photos.DeletePhotos | photos.GetUserPhotos | photos.UploadContactProfilePhoto | upload.SaveFilePart | upload.GetFile | upload.SaveBigFilePart | upload.GetWebFile | upload.GetCdnFile | upload.ReuploadCdnFile | upload.GetCdnFileHashes | upload.GetFileHashes | help.GetConfig | help.GetNearestDc | help.GetAppUpdate | help.GetInviteText | help.GetSupport | help.SetBotUpdatesStatus | help.GetCdnConfig | help.GetRecentMeUrls | help.GetTermsOfServiceUpdate | help.AcceptTermsOfService | help.GetDeepLinkInfo | help.GetAppConfig | help.SaveAppLog | help.GetPassportConfig | help.GetSupportName | help.GetUserInfo | help.EditUserInfo | help.GetPromoData | help.HidePromoData | help.DismissSuggestion | help.GetCountriesList | help.GetPremiumPromo | help.GetPeerColors | help.GetPeerProfileColors | help.GetTimezonesList | channels.ReadHistory | channels.DeleteMessages | channels.ReportSpam | channels.GetMessages | channels.GetParticipants | channels.GetParticipant | channels.GetChannels | channels.GetFullChannel | channels.CreateChannel | channels.EditAdmin | channels.EditTitle | channels.EditPhoto | channels.CheckUsername | channels.UpdateUsername | channels.JoinChannel | channels.LeaveChannel | channels.InviteToChannel | channels.DeleteChannel | channels.ExportMessageLink | channels.ToggleSignatures | channels.GetAdminedPublicChannels | channels.EditBanned | channels.GetAdminLog | channels.SetStickers | channels.ReadMessageContents | channels.DeleteHistory | channels.TogglePreHistoryHidden | channels.GetLeftChannels | channels.GetGroupsForDiscussion | channels.SetDiscussionGroup | channels.EditCreator | channels.EditLocation | channels.ToggleSlowMode | channels.GetInactiveChannels | channels.ConvertToGigagroup | channels.GetSendAs | channels.DeleteParticipantHistory | channels.ToggleJoinToSend | channels.ToggleJoinRequest | channels.ReorderUsernames | channels.ToggleUsername | channels.DeactivateAllUsernames | channels.ToggleForum | channels.CreateForumTopic | channels.GetForumTopics | channels.GetForumTopicsByID | channels.EditForumTopic | channels.UpdatePinnedForumTopic | channels.DeleteTopicHistory | channels.ReorderPinnedForumTopics | channels.ToggleAntiSpam | channels.ReportAntiSpamFalsePositive | channels.ToggleParticipantsHidden | channels.UpdateColor | channels.ToggleViewForumAsMessages | channels.GetChannelRecommendations | channels.UpdateEmojiStatus | channels.SetBoostsToUnblockRestrictions | channels.SetEmojiStickers | channels.RestrictSponsoredMessages | channels.SearchPosts - | bots.SendCustomRequest | bots.AnswerWebhookJSONQuery | bots.SetBotCommands | bots.ResetBotCommands | bots.GetBotCommands | bots.SetBotMenuButton | bots.GetBotMenuButton | bots.SetBotBroadcastDefaultAdminRights | bots.SetBotGroupDefaultAdminRights | bots.SetBotInfo | bots.GetBotInfo | bots.ReorderUsernames | bots.ToggleUsername | bots.CanSendMessage | bots.AllowSendMessage | bots.InvokeWebViewCustomMethod | bots.GetPopularAppBots | bots.AddPreviewMedia | bots.EditPreviewMedia | bots.DeletePreviewMedia | bots.ReorderPreviewMedias | bots.GetPreviewInfo | bots.GetPreviewMedias | bots.UpdateUserEmojiStatus | bots.ToggleUserEmojiStatusPermission | bots.CheckDownloadFileParams - | payments.GetPaymentForm | payments.GetPaymentReceipt | payments.ValidateRequestedInfo | payments.SendPaymentForm | payments.GetSavedInfo | payments.ClearSavedInfo | payments.GetBankCardData | payments.ExportInvoice | payments.AssignAppStoreTransaction | payments.AssignPlayMarketTransaction | payments.CanPurchasePremium | payments.GetPremiumGiftCodeOptions | payments.CheckGiftCode | payments.ApplyGiftCode | payments.GetGiveawayInfo | payments.LaunchPrepaidGiveaway | payments.GetStarsTopupOptions | payments.GetStarsStatus | payments.GetStarsTransactions | payments.SendStarsForm | payments.RefundStarsCharge | payments.GetStarsRevenueStats | payments.GetStarsRevenueWithdrawalUrl | payments.GetStarsRevenueAdsAccountUrl | payments.GetStarsTransactionsByID | payments.GetStarsGiftOptions | payments.GetStarsSubscriptions | payments.ChangeStarsSubscription | payments.FulfillStarsSubscription | payments.GetStarsGiveawayOptions | payments.GetStarGifts | payments.GetUserStarGifts | payments.SaveStarGift | payments.ConvertStarGift | payments.BotCancelStarsSubscription + | bots.SendCustomRequest | bots.AnswerWebhookJSONQuery | bots.SetBotCommands | bots.ResetBotCommands | bots.GetBotCommands | bots.SetBotMenuButton | bots.GetBotMenuButton | bots.SetBotBroadcastDefaultAdminRights | bots.SetBotGroupDefaultAdminRights | bots.SetBotInfo | bots.GetBotInfo | bots.ReorderUsernames | bots.ToggleUsername | bots.CanSendMessage | bots.AllowSendMessage | bots.InvokeWebViewCustomMethod | bots.GetPopularAppBots | bots.AddPreviewMedia | bots.EditPreviewMedia | bots.DeletePreviewMedia | bots.ReorderPreviewMedias | bots.GetPreviewInfo | bots.GetPreviewMedias | bots.UpdateUserEmojiStatus | bots.ToggleUserEmojiStatusPermission | bots.CheckDownloadFileParams | bots.GetAdminedBots | bots.UpdateStarRefProgram + | payments.GetPaymentForm | payments.GetPaymentReceipt | payments.ValidateRequestedInfo | payments.SendPaymentForm | payments.GetSavedInfo | payments.ClearSavedInfo | payments.GetBankCardData | payments.ExportInvoice | payments.AssignAppStoreTransaction | payments.AssignPlayMarketTransaction | payments.CanPurchasePremium | payments.GetPremiumGiftCodeOptions | payments.CheckGiftCode | payments.ApplyGiftCode | payments.GetGiveawayInfo | payments.LaunchPrepaidGiveaway | payments.GetStarsTopupOptions | payments.GetStarsStatus | payments.GetStarsTransactions | payments.SendStarsForm | payments.RefundStarsCharge | payments.GetStarsRevenueStats | payments.GetStarsRevenueWithdrawalUrl | payments.GetStarsRevenueAdsAccountUrl | payments.GetStarsTransactionsByID | payments.GetStarsGiftOptions | payments.GetStarsSubscriptions | payments.ChangeStarsSubscription | payments.FulfillStarsSubscription | payments.GetStarsGiveawayOptions | payments.GetStarGifts | payments.GetUserStarGifts | payments.SaveStarGift | payments.ConvertStarGift | payments.BotCancelStarsSubscription | payments.GetConnectedStarRefBots | payments.GetConnectedStarRefBot | payments.GetSuggestedStarRefBots | payments.ConnectStarRefBot | payments.EditConnectedStarRefBot | stickers.CreateStickerSet | stickers.RemoveStickerFromSet | stickers.ChangeStickerPosition | stickers.AddStickerToSet | stickers.SetStickerSetThumb | stickers.CheckShortName | stickers.SuggestShortName | stickers.ChangeSticker | stickers.RenameStickerSet | stickers.DeleteStickerSet | stickers.ReplaceSticker | phone.GetCallConfig | phone.RequestCall | phone.AcceptCall | phone.ConfirmCall | phone.ReceivedCall | phone.DiscardCall | phone.SetCallRating | phone.SaveCallDebug | phone.SendSignalingData | phone.CreateGroupCall | phone.JoinGroupCall | phone.LeaveGroupCall | phone.InviteToGroupCall | phone.DiscardGroupCall | phone.ToggleGroupCallSettings | phone.GetGroupCall | phone.GetGroupParticipants | phone.CheckGroupCall | phone.ToggleGroupCallRecord | phone.EditGroupCallParticipant | phone.EditGroupCallTitle | phone.GetGroupCallJoinAs | phone.ExportGroupCallInvite | phone.ToggleGroupCallStartSubscription | phone.StartScheduledGroupCall | phone.SaveDefaultGroupCallJoinAs | phone.JoinGroupCallPresentation | phone.LeaveGroupCallPresentation | phone.GetGroupCallStreamChannels | phone.GetGroupCallStreamRtmpUrl | phone.SaveCallLog | langpack.GetLangPack | langpack.GetStrings | langpack.GetDifference | langpack.GetLanguages | langpack.GetLanguage diff --git a/src/lib/gramjs/tl/apiTl.js b/src/lib/gramjs/tl/apiTl.js index 8e9a1f329..18bda5c9c 100644 --- a/src/lib/gramjs/tl/apiTl.js +++ b/src/lib/gramjs/tl/apiTl.js @@ -125,8 +125,8 @@ messageActionChannelMigrateFrom#ea3948e9 title:string chat_id:long = MessageActi messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; -messageActionPaymentSentMe#8f31b327 flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; -messageActionPaymentSent#96163f56 flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string = MessageAction; +messageActionPaymentSentMe#ffa00ccc flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge subscription_until_date:flags.4?int = MessageAction; +messageActionPaymentSent#c624b16e flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string subscription_until_date:flags.4?int = MessageAction; messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; @@ -195,7 +195,7 @@ inputReportReasonGeoIrrelevant#dbd4feed = ReportReason; inputReportReasonFake#f5ddd6e7 = ReportReason; inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -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 can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?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; +userFull#979d2376 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 can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?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 starref_program:flags2.11?StarRefProgram = 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; @@ -368,12 +368,11 @@ updateBotEditBusinessMessage#7df587c flags:# connection_id:string message:Messag updateBotDeleteBusinessMessage#a02a982e connection_id:string peer:Peer messages:Vector qts:int = Update; updateNewStoryReaction#1824e40b story_id:int peer:Peer reaction:Reaction = Update; updateBroadcastRevenueTransactions#dfd961f5 peer:Peer balances:BroadcastRevenueBalances = Update; -updateStarsBalance#fb85198 balance:long = Update; +updateStarsBalance#4e80a379 balance:StarsAmount = Update; updateBusinessBotCallbackQuery#1ea2fda7 flags:# query_id:long user_id:long connection_id:string message:Message reply_to_message:flags.2?Message chat_instance:long data:flags.0?bytes = Update; updateStarsRevenueStatus#a584b019 peer:Peer status:StarsRevenueStatus = Update; updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Update; updatePaidReactionPrivacy#51ca7aec private:Bool = Update; -updateBotSubscriptionExpire#2d13c6ee user_id:long payload:string invoice_slug:string until_date:int qts:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; @@ -1341,12 +1340,12 @@ starsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer; starsTransactionPeerAds#60682812 = StarsTransactionPeer; starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#35d4f276 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 floodskip_number:flags.15?int = 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; +starsTransaction#64dfc926 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:StarsAmount 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 floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount = StarsTransaction; +payments.starsStatus#6c9ce8ed flags:# balance:StarsAmount 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; geoPointAddress#de4c5d93 flags:# country_iso2:string state:flags.0?string city:flags.1?string street:flags.2?string = GeoPointAddress; -starsRevenueStatus#79342946 flags:# withdrawal_enabled:flags.0?true current_balance:long available_balance:long overall_revenue:long next_withdrawal_at:flags.1?int = StarsRevenueStatus; +starsRevenueStatus#febe5491 flags:# withdrawal_enabled:flags.0?true current_balance:StarsAmount available_balance:StarsAmount overall_revenue:StarsAmount next_withdrawal_at:flags.1?int = StarsRevenueStatus; payments.starsRevenueStats#c92bb73b revenue_graph:StatsGraph status:StarsRevenueStatus usd_rate:double = payments.StarsRevenueStats; payments.starsRevenueWithdrawalUrl#1dab80b7 url:string = payments.StarsRevenueWithdrawalUrl; payments.starsRevenueAdsAccountUrl#394e7f21 url:string = payments.StarsRevenueAdsAccountUrl; @@ -1372,6 +1371,13 @@ reportResultReported#8db33c4b = ReportResult; messages.botPreparedInlineMessage#8ecf0511 id:string expire_date:int = messages.BotPreparedInlineMessage; messages.preparedInlineMessage#ff57708d query_id:long result:BotInlineResult peer_types:Vector cache_time:int users:Vector = messages.PreparedInlineMessage; botAppSettings#c99b1950 flags:# placeholder_path:flags.0?bytes background_color:flags.1?int background_dark_color:flags.2?int header_color:flags.3?int header_dark_color:flags.4?int = BotAppSettings; +starRefProgram#dd0c66f2 flags:# bot_id:long commission_permille:int duration_months:flags.0?int end_date:flags.1?int daily_revenue_per_user:flags.2?StarsAmount = StarRefProgram; +connectedBotStarRef#19a13f71 flags:# revoked:flags.1?true url:string date:int bot_id:long commission_permille:int duration_months:flags.0?int participants:long revenue:long = ConnectedBotStarRef; +payments.connectedStarRefBots#98d5ea1d count:int connected_bots:Vector users:Vector = payments.ConnectedStarRefBots; +payments.suggestedStarRefBots#b4d5d859 flags:# count:int suggested_bots:Vector users:Vector next_offset:flags.0?string = payments.SuggestedStarRefBots; +starsAmount#bbb6b4a3 amount:long nanos:int = StarsAmount; +messages.foundStickersNotModified#6010c534 flags:# next_offset:flags.0?int = messages.FoundStickers; +messages.foundStickers#82c9e290 flags:# next_offset:flags.0?int hash:long stickers:Vector = messages.FoundStickers; ---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; @@ -1443,7 +1449,7 @@ contacts.block#2e2e8734 flags:# my_stories_from:flags.0?true id:InputPeer = Bool contacts.unblock#b550d328 flags:# my_stories_from:flags.0?true id:InputPeer = Bool; contacts.getBlocked#9a868f80 flags:# my_stories_from:flags.0?true offset:int limit:int = contacts.Blocked; contacts.search#11f812d8 q:string limit:int = contacts.Found; -contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; +contacts.resolveUsername#725afbbc flags:# username:string referer:flags.0?string = contacts.ResolvedPeer; contacts.getTopPeers#973478b6 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true bots_app:flags.16?true offset:int limit:int hash:long = contacts.TopPeers; contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates; contacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer; diff --git a/src/lib/gramjs/tl/static/api.tl b/src/lib/gramjs/tl/static/api.tl index 79bc1df9b..cbdb48e6a 100644 --- a/src/lib/gramjs/tl/static/api.tl +++ b/src/lib/gramjs/tl/static/api.tl @@ -151,8 +151,8 @@ messageActionChannelMigrateFrom#ea3948e9 title:string chat_id:long = MessageActi messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; -messageActionPaymentSentMe#8f31b327 flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; -messageActionPaymentSent#96163f56 flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string = MessageAction; +messageActionPaymentSentMe#ffa00ccc flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge subscription_until_date:flags.4?int = MessageAction; +messageActionPaymentSent#c624b16e flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string subscription_until_date:flags.4?int = MessageAction; messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; @@ -235,7 +235,7 @@ inputReportReasonFake#f5ddd6e7 = ReportReason; inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -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 can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?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; +userFull#979d2376 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 can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?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 starref_program:flags2.11?StarRefProgram = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -421,12 +421,11 @@ updateBotEditBusinessMessage#7df587c flags:# connection_id:string message:Messag updateBotDeleteBusinessMessage#a02a982e connection_id:string peer:Peer messages:Vector qts:int = Update; updateNewStoryReaction#1824e40b story_id:int peer:Peer reaction:Reaction = Update; updateBroadcastRevenueTransactions#dfd961f5 peer:Peer balances:BroadcastRevenueBalances = Update; -updateStarsBalance#fb85198 balance:long = Update; +updateStarsBalance#4e80a379 balance:StarsAmount = Update; updateBusinessBotCallbackQuery#1ea2fda7 flags:# query_id:long user_id:long connection_id:string message:Message reply_to_message:flags.2?Message chat_instance:long data:flags.0?bytes = Update; updateStarsRevenueStatus#a584b019 peer:Peer status:StarsRevenueStatus = Update; updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Update; updatePaidReactionPrivacy#51ca7aec private:Bool = Update; -updateBotSubscriptionExpire#2d13c6ee user_id:long payload:string invoice_slug:string until_date:int qts:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -1832,9 +1831,9 @@ starsTransactionPeerAPI#f9677aad = StarsTransactionPeer; starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#35d4f276 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 floodskip_number:flags.15?int = StarsTransaction; +starsTransaction#64dfc926 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:StarsAmount 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 floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount = 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; +payments.starsStatus#6c9ce8ed flags:# balance:StarsAmount 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; @@ -1842,7 +1841,7 @@ stories.foundStories#e2de7737 flags:# count:int stories:Vector next_ geoPointAddress#de4c5d93 flags:# country_iso2:string state:flags.0?string city:flags.1?string street:flags.2?string = GeoPointAddress; -starsRevenueStatus#79342946 flags:# withdrawal_enabled:flags.0?true current_balance:long available_balance:long overall_revenue:long next_withdrawal_at:flags.1?int = StarsRevenueStatus; +starsRevenueStatus#febe5491 flags:# withdrawal_enabled:flags.0?true current_balance:StarsAmount available_balance:StarsAmount overall_revenue:StarsAmount next_withdrawal_at:flags.1?int = StarsRevenueStatus; payments.starsRevenueStats#c92bb73b revenue_graph:StatsGraph status:StarsRevenueStatus usd_rate:double = payments.StarsRevenueStats; @@ -1891,6 +1890,19 @@ messages.preparedInlineMessage#ff57708d query_id:long result:BotInlineResult pee botAppSettings#c99b1950 flags:# placeholder_path:flags.0?bytes background_color:flags.1?int background_dark_color:flags.2?int header_color:flags.3?int header_dark_color:flags.4?int = BotAppSettings; +starRefProgram#dd0c66f2 flags:# bot_id:long commission_permille:int duration_months:flags.0?int end_date:flags.1?int daily_revenue_per_user:flags.2?StarsAmount = StarRefProgram; + +connectedBotStarRef#19a13f71 flags:# revoked:flags.1?true url:string date:int bot_id:long commission_permille:int duration_months:flags.0?int participants:long revenue:long = ConnectedBotStarRef; + +payments.connectedStarRefBots#98d5ea1d count:int connected_bots:Vector users:Vector = payments.ConnectedStarRefBots; + +payments.suggestedStarRefBots#b4d5d859 flags:# count:int suggested_bots:Vector users:Vector next_offset:flags.0?string = payments.SuggestedStarRefBots; + +starsAmount#bbb6b4a3 amount:long nanos:int = StarsAmount; + +messages.foundStickersNotModified#6010c534 flags:# next_offset:flags.0?int = messages.FoundStickers; +messages.foundStickers#82c9e290 flags:# next_offset:flags.0?int hash:long stickers:Vector = messages.FoundStickers; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -2056,7 +2068,7 @@ contacts.block#2e2e8734 flags:# my_stories_from:flags.0?true id:InputPeer = Bool contacts.unblock#b550d328 flags:# my_stories_from:flags.0?true id:InputPeer = Bool; contacts.getBlocked#9a868f80 flags:# my_stories_from:flags.0?true offset:int limit:int = contacts.Blocked; contacts.search#11f812d8 q:string limit:int = contacts.Found; -contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; +contacts.resolveUsername#725afbbc flags:# username:string referer:flags.0?string = contacts.ResolvedPeer; contacts.getTopPeers#973478b6 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true bots_app:flags.16?true offset:int limit:int hash:long = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; @@ -2296,6 +2308,7 @@ messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:b messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages; messages.savePreparedInlineMessage#f21f7f2f flags:# result:InputBotInlineResult user_id:InputUser peer_types:flags.0?Vector = messages.BotPreparedInlineMessage; messages.getPreparedInlineMessage#857ebdb8 bot:InputUser id:string = messages.PreparedInlineMessage; +messages.searchStickers#29b1c66a flags:# emojis:flags.0?true q:string emoticon:string lang_code:Vector offset:int limit:int hash:long = messages.FoundStickers; updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -2430,6 +2443,8 @@ bots.getPreviewMedias#a2a5594d bot:InputUser = Vector; bots.updateUserEmojiStatus#ed9f30c5 user_id:InputUser emoji_status:EmojiStatus = Bool; bots.toggleUserEmojiStatusPermission#6de6392 bot:InputUser enabled:Bool = Bool; bots.checkDownloadFileParams#50077589 bot:InputUser file_name:string url:string = Bool; +bots.getAdminedBots#b0711d83 = Vector; +bots.updateStarRefProgram#778b5ab3 flags:# bot:InputUser commission_permille:int duration_months:flags.0?int = StarRefProgram; payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm; payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt; @@ -2465,7 +2480,12 @@ 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; -payments.botCancelStarsSubscription#57f9ece6 flags:# restore:flags.0?true user_id:InputUser invoice_slug:flags.1?string charge_id:flags.2?string = Bool; +payments.botCancelStarsSubscription#6dfa0622 flags:# restore:flags.0?true user_id:InputUser charge_id:string = Bool; +payments.getConnectedStarRefBots#5869a553 flags:# peer:InputPeer offset_date:flags.2?int offset_link:flags.2?string limit:int = payments.ConnectedStarRefBots; +payments.getConnectedStarRefBot#b7d998f0 peer:InputPeer bot:InputUser = payments.ConnectedStarRefBots; +payments.getSuggestedStarRefBots#d6b48f7 flags:# order_by_revenue:flags.0?true order_by_date:flags.1?true peer:InputPeer offset:string limit:int = payments.SuggestedStarRefBots; +payments.connectStarRefBot#7ed5348a peer:InputPeer bot:InputUser = payments.ConnectedStarRefBots; +payments.editConnectedStarRefBot#e4fca4a3 flags:# revoked:flags.0?true peer:InputPeer link:string = payments.ConnectedStarRefBots; 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; diff --git a/src/types/language.d.ts b/src/types/language.d.ts index 06442914f..3294e230c 100644 --- a/src/types/language.d.ts +++ b/src/types/language.d.ts @@ -1145,6 +1145,7 @@ export interface LangPair { 'StarGiftAvailability': undefined; 'StarsSubscribeInfoLinkText': undefined; 'StarsSubscribeInfoLink': undefined; + 'StarsBalance': undefined; 'OpenApp': undefined; 'PopularApps': undefined; 'SearchApps': undefined; diff --git a/src/util/formatCurrency.tsx b/src/util/formatCurrency.tsx index 5151c35d9..dd191933c 100644 --- a/src/util/formatCurrency.tsx +++ b/src/util/formatCurrency.tsx @@ -32,7 +32,7 @@ export function formatCurrencyAsString( ) { const price = totalPrice / 10 ** getCurrencyExp(currency); - if ((options?.shouldOmitFractions || currency === STARS_CURRENCY_CODE) && price % 1 === 0) { + if ((options?.shouldOmitFractions || currency === STARS_CURRENCY_CODE) && Number.isInteger(price)) { return new Intl.NumberFormat(locale, { style: 'currency', currency, diff --git a/src/util/textFormat.ts b/src/util/textFormat.ts index abae4d727..5c21cbf8f 100644 --- a/src/util/textFormat.ts +++ b/src/util/textFormat.ts @@ -29,6 +29,10 @@ export function formatIntegerCompact(views: number) { return `${formatFixedNumber(views / 1e6)}M`; } +export function formatPercent(value: number, fractionDigits = 1) { + return `${Number.isInteger(value) ? value : value.toFixed(fractionDigits)}%`; +} + export const getFirstLetters = withCache((phrase: string, count = 2) => { return phrase .replace(/[.,!@#$%^&*()_+=\-`~[\]/\\{}:"|<>?]+/gi, '')