diff --git a/src/api/gramjs/apiBuilders/appConfig.ts b/src/api/gramjs/apiBuilders/appConfig.ts index 8ad2a3c0a..c181bfd75 100644 --- a/src/api/gramjs/apiBuilders/appConfig.ts +++ b/src/api/gramjs/apiBuilders/appConfig.ts @@ -82,6 +82,7 @@ export interface GramJsAppConfig extends LimitsConfig { upload_premium_speedup_notify_period?: number; upload_premium_speedup_download?: number; upload_premium_speedup_upload?: number; + stars_gifts_enabled?: boolean; } function buildEmojiSounds(appConfig: GramJsAppConfig) { @@ -163,5 +164,6 @@ export function buildAppConfig(json: GramJs.TypeJSONValue, hash: number): ApiApp bandwidthPremiumDownloadSpeedup: appConfig.upload_premium_speedup_download, channelRestrictAdsLevelMin: appConfig.channel_restrict_sponsored_level_min, isChannelRevenueWithdrawalEnabled: appConfig.channel_revenue_withdrawal_enabled, + isStarsGiftsEnabled: appConfig.stars_gifts_enabled, }; } diff --git a/src/api/gramjs/apiBuilders/messageContent.ts b/src/api/gramjs/apiBuilders/messageContent.ts index f9a9a6910..ef67d09d8 100644 --- a/src/api/gramjs/apiBuilders/messageContent.ts +++ b/src/api/gramjs/apiBuilders/messageContent.ts @@ -576,7 +576,7 @@ function buildGiweawayFromMedia(media: GramJs.TypeMessageMedia): ApiGiveaway | u function buildGiveaway(media: GramJs.MessageMediaGiveaway): ApiGiveaway | undefined { const { - channels, months, quantity, untilDate, countriesIso2, onlyNewSubscribers, prizeDescription, + channels, months, stars, quantity, untilDate, countriesIso2, onlyNewSubscribers, prizeDescription, } = media; const channelIds = channels.map((channel) => buildApiPeerId(channel, 'channel')); @@ -585,6 +585,7 @@ function buildGiveaway(media: GramJs.MessageMediaGiveaway): ApiGiveaway | undefi mediaType: 'giveaway', channelIds, months, + stars: stars?.toJSNumber(), quantity, untilDate, countries: countriesIso2, diff --git a/src/api/gramjs/apiBuilders/messages.ts b/src/api/gramjs/apiBuilders/messages.ts index 3ccf3dd68..5214ee2c4 100644 --- a/src/api/gramjs/apiBuilders/messages.ts +++ b/src/api/gramjs/apiBuilders/messages.ts @@ -608,6 +608,15 @@ function buildAction( amount = action.winnersCount; pluralValue = action.winnersCount; } + } else if (action instanceof GramJs.MessageActionPrizeStars) { + type = 'prizeStars'; + isUnclaimed = Boolean(action.unclaimed); + if (action.boostPeer) { + targetChatId = getApiChatIdFromMtpPeer(action.boostPeer); + } + text = 'Notification.StarsPrize'; + stars = action.stars.toJSNumber(); + transactionId = action.transactionId; } else if (action instanceof GramJs.MessageActionBoostApply) { type = 'chatBoost'; if (action.boosts === 1) { diff --git a/src/api/gramjs/apiBuilders/payments.ts b/src/api/gramjs/apiBuilders/payments.ts index 2ba4608ee..5460c74c1 100644 --- a/src/api/gramjs/apiBuilders/payments.ts +++ b/src/api/gramjs/apiBuilders/payments.ts @@ -6,9 +6,20 @@ import type { ApiBoostsStatus, ApiCheckedGiftCode, ApiGiveawayInfo, - ApiInvoice, ApiLabeledPrice, ApiMyBoost, ApiPaymentCredentials, - ApiPaymentForm, ApiPaymentSavedInfo, ApiPremiumGiftCodeOption, ApiPremiumPromo, ApiPremiumSubscriptionOption, + ApiInvoice, + ApiLabeledPrice, + ApiMyBoost, + ApiPaymentCredentials, + ApiPaymentForm, + ApiPaymentSavedInfo, + ApiPremiumGiftCodeOption, + ApiPremiumPromo, + ApiPremiumSubscriptionOption, + ApiPrepaidGiveaway, + ApiPrepaidStarsGiveaway, ApiReceipt, + ApiStarGiveawayOption, + ApiStarsGiveawayWinnerOption, ApiStarsTransaction, ApiStarsTransactionPeer, ApiStarTopupOption, @@ -20,7 +31,7 @@ import { buildApiMessageEntity } from './common'; import { omitVirtualClassFields } from './helpers'; import { buildApiDocument, buildApiWebDocument, buildMessageMediaContent } from './messageContent'; import { buildApiPeerId, getApiChatIdFromMtpPeer } from './peers'; -import { buildPrepaidGiveaway, buildStatisticsPercentage } from './statistics'; +import { buildStatisticsPercentage } from './statistics'; export function buildShippingOptions(shippingOptions: GramJs.ShippingOption[] | undefined) { if (!shippingOptions) { @@ -265,19 +276,46 @@ export function buildApiPaymentCredentials(credentials: GramJs.PaymentSavedCrede return credentials.map(({ id, title }) => ({ id, title })); } +export function buildPrepaidGiveaway( + interaction: GramJs.TypePrepaidGiveaway, +): ApiPrepaidGiveaway | ApiPrepaidStarsGiveaway { + if (interaction instanceof GramJs.PrepaidGiveaway) { + return { + type: 'giveaway', + id: interaction.id.toString(), + date: interaction.date, + months: interaction.months, + quantity: interaction.quantity, + }; + } + + return { + type: 'starsGiveaway', + id: interaction.id.toString(), + stars: interaction.stars.toJSNumber(), + quantity: interaction.quantity, + boosts: interaction.boosts, + date: interaction.date, + }; +} + export function buildApiBoostsStatus(boostStatus: GramJs.premium.BoostsStatus): ApiBoostsStatus { const { - level, boostUrl, boosts, myBoost, currentLevelBoosts, nextLevelBoosts, premiumAudience, prepaidGiveaways, + level, boostUrl, boosts, + giftBoosts, myBoost, currentLevelBoosts, nextLevelBoosts, + premiumAudience, prepaidGiveaways, } = boostStatus; + return { level, currentLevelBoosts, boosts, hasMyBoost: Boolean(myBoost), boostUrl, + giftBoosts, nextLevelBoosts, ...(premiumAudience && { premiumSubscribers: buildStatisticsPercentage(premiumAudience) }), - ...(prepaidGiveaways && { prepaidGiveaways: prepaidGiveaways.map(buildPrepaidGiveaway) }), + ...(prepaidGiveaways && { prepaidGiveaways: prepaidGiveaways.map((m) => buildPrepaidGiveaway(m)) }), }; } @@ -288,6 +326,7 @@ export function buildApiBoost(boost: GramJs.Boost): ApiBoost { expires, giveaway, gift, + stars, } = boost; return { @@ -296,6 +335,7 @@ export function buildApiBoost(boost: GramJs.Boost): ApiBoost { expires, isFromGiveaway: giveaway, isGift: gift, + stars: stars?.toJSNumber(), }; } @@ -342,6 +382,7 @@ export function buildApiGiveawayInfo(info: GramJs.payments.TypeGiveawayInfo): Ap refunded, startDate, winnersCount, + starsPrize, } = info; return { @@ -353,6 +394,7 @@ export function buildApiGiveawayInfo(info: GramJs.payments.TypeGiveawayInfo): Ap giftCodeSlug, isRefunded: refunded, isWinner: winner, + starsPrize: starsPrize?.toJSNumber(), }; } } @@ -399,6 +441,38 @@ export function buildApiStarsGiftOptions(option: GramJs.StarsGiftOption): ApiSta }; } +export function buildApiStarsGiveawayWinnersOption( + option: GramJs.StarsGiveawayWinnersOption, +): ApiStarsGiveawayWinnerOption { + const { + default: isDefault, users, perUserStars, + } = option; + + return { + isDefault, + users, + perUserStars: perUserStars.toJSNumber(), + }; +} + +export function buildApiStarsGiveawayOptions(option: GramJs.StarsGiveawayOption): ApiStarGiveawayOption { + const { + extended, default: isDefault, stars, yearlyBoosts, amount, winners, currency, + } = option; + + const winnerList = winners?.map((m) => buildApiStarsGiveawayWinnersOption(m)).filter(Boolean); + + return { + isExtended: extended, + isDefault, + yearlyBoosts, + stars: stars.toJSNumber(), + amount: amount.toJSNumber(), + currency, + winners: winnerList, + }; +} + export function buildApiStarsTransactionPeer(peer: GramJs.TypeStarsTransactionPeer): ApiStarsTransactionPeer { if (peer instanceof GramJs.StarsTransactionPeerAppStore) { return { type: 'appStore' }; diff --git a/src/api/gramjs/apiBuilders/statistics.ts b/src/api/gramjs/apiBuilders/statistics.ts index 2419cc4e3..016ea55f1 100644 --- a/src/api/gramjs/apiBuilders/statistics.ts +++ b/src/api/gramjs/apiBuilders/statistics.ts @@ -8,7 +8,7 @@ import type { ApiPostStatistics, ApiStoryPublicForward, ChannelMonetizationBalances, - PrepaidGiveaway, StatisticsGraph, + StatisticsGraph, StatisticsMessageInteractionCounter, StatisticsOverviewItem, StatisticsOverviewPercentage, @@ -233,15 +233,6 @@ export function buildStatisticsPercentage(data: GramJs.StatsPercentValue): Stati }; } -export function buildPrepaidGiveaway(prepaidGiveaway: GramJs.PrepaidGiveaway): PrepaidGiveaway { - return { - id: prepaidGiveaway.id.toString(), - date: prepaidGiveaway.date, - months: prepaidGiveaway.months, - quantity: prepaidGiveaway.quantity, - }; -} - function getOverviewPeriod(data: GramJs.StatsDateRangeDays): StatisticsOverviewPeriod { return { maxDate: data.maxDate, diff --git a/src/api/gramjs/gramjsBuilders/index.ts b/src/api/gramjs/gramjsBuilders/index.ts index 70c298cd4..df1801467 100644 --- a/src/api/gramjs/gramjsBuilders/index.ts +++ b/src/api/gramjs/gramjsBuilders/index.ts @@ -568,6 +568,23 @@ GramJs.TypeInputStorePaymentPurpose { const randomId = generateRandomBigInt(); + if (purpose.type === 'starsgiveaway') { + return new GramJs.InputStorePaymentStarsGiveaway({ + boostPeer: buildInputPeer(purpose.chat.id, purpose.chat.accessHash), + additionalPeers: purpose.additionalChannels?.map((chat) => buildInputPeer(chat.id, chat.accessHash)), + stars: BigInt(purpose.stars!), + countriesIso2: purpose.countries, + prizeDescription: purpose.prizeDescription, + onlyNewSubscribers: purpose.isOnlyForNewSubscribers || undefined, + winnersAreVisible: purpose.areWinnersVisible || undefined, + untilDate: purpose.untilDate, + currency: purpose.currency, + amount: BigInt(purpose.amount), + users: purpose.users, + randomId, + }); + } + return new GramJs.InputStorePaymentPremiumGiveaway({ boostPeer: buildInputPeer(purpose.chat.id, purpose.chat.accessHash), additionalPeers: purpose.additionalChannels?.map((chat) => buildInputPeer(chat.id, chat.accessHash)), @@ -613,6 +630,13 @@ export function buildInputInvoice(invoice: ApiRequestInputInvoice) { }); } + case 'starsgiveaway': { + const purpose = buildInputStorePaymentPurpose(invoice.purpose); + return new GramJs.InputInvoiceStars({ + purpose, + }); + } + case 'giveaway': default: { const purpose = buildInputStorePaymentPurpose(invoice.purpose); diff --git a/src/api/gramjs/methods/payments.ts b/src/api/gramjs/methods/payments.ts index 438365c09..906175fed 100644 --- a/src/api/gramjs/methods/payments.ts +++ b/src/api/gramjs/methods/payments.ts @@ -17,7 +17,9 @@ import { buildApiPaymentForm, buildApiPremiumGiftCodeOption, buildApiPremiumPromo, - buildApiReceipt, buildApiStarsGiftOptions, + buildApiReceipt, + buildApiStarsGiftOptions, + buildApiStarsGiveawayOptions, buildApiStarsTransaction, buildApiStarTopupOption, buildShippingOptions, @@ -376,6 +378,16 @@ export async function getStarsGiftOptions({ return result.map(buildApiStarsGiftOptions); } +export async function fetchStarsGiveawayOptions() { + const result = await invokeRequest(new GramJs.payments.GetStarsGiveawayOptions()); + + if (!result) { + return undefined; + } + + return result.map(buildApiStarsGiveawayOptions); +} + export function launchPrepaidGiveaway({ chat, giveawayId, diff --git a/src/api/types/messages.ts b/src/api/types/messages.ts index 9874b939f..16753799d 100644 --- a/src/api/types/messages.ts +++ b/src/api/types/messages.ts @@ -248,8 +248,23 @@ export type ApiInputInvoiceStarsGift = { amount: number; }; +export type ApiInputInvoiceStarsGiveaway = { + type: 'starsgiveaway'; + chatId: string; + additionalChannelIds?: string[]; + isOnlyForNewSubscribers?: boolean; + areWinnersVisible?: boolean; + prizeDescription?: string; + countries?: string[]; + untilDate: number; + currency: string; + amount: number; + stars: number; + users: number; +}; + export type ApiInputInvoice = ApiInputInvoiceMessage | ApiInputInvoiceSlug | ApiInputInvoiceGiveaway -| ApiInputInvoiceGiftCode | ApiInputInvoiceStarsGift | ApiInputInvoiceStars; +| ApiInputInvoiceGiftCode | ApiInputInvoiceStarsGift | ApiInputInvoiceStars | ApiInputInvoiceStarsGiveaway; /* Used for Invoice request */ export type ApiRequestInputInvoiceMessage = { @@ -274,8 +289,13 @@ export type ApiRequestInputInvoiceStars = { purpose: ApiInputStorePaymentPurpose; }; +export type ApiRequestInputInvoiceStarsGiveaway = { + type: 'starsgiveaway'; + purpose: ApiInputStorePaymentPurpose; +}; + export type ApiRequestInputInvoice = ApiRequestInputInvoiceMessage | ApiRequestInputInvoiceSlug -| ApiRequestInputInvoiceGiveaway | ApiRequestInputInvoiceStars; +| ApiRequestInputInvoiceGiveaway | ApiRequestInputInvoiceStars | ApiRequestInputInvoiceStarsGiveaway; export interface ApiInvoice { mediaType: 'invoice'; @@ -351,7 +371,8 @@ export type ApiGame = { export type ApiGiveaway = { mediaType: 'giveaway'; quantity: number; - months: number; + months?: number; + stars?: number; untilDate: number; isOnlyForNewSubscribers?: true; countries?: string[]; @@ -361,7 +382,8 @@ export type ApiGiveaway = { export type ApiGiveawayResults = { mediaType: 'giveawayResults'; - months: number; + months?: number; + stars?: number; untilDate: number; isRefunded?: true; isOnlyForNewSubscribers?: true; @@ -400,6 +422,7 @@ export interface ApiAction { | 'giftStars' | 'giftPremium' | 'giftCode' + | 'prizeStars' | 'other'; photo?: ApiPhoto; amount?: number; diff --git a/src/api/types/misc.ts b/src/api/types/misc.ts index 507aa6a15..2909cbdd8 100644 --- a/src/api/types/misc.ts +++ b/src/api/types/misc.ts @@ -211,6 +211,7 @@ export interface ApiAppConfig { bandwidthPremiumDownloadSpeedup?: number; channelRestrictAdsLevelMin?: number; isChannelRevenueWithdrawalEnabled?: boolean; + isStarsGiftsEnabled?: boolean; } export interface ApiConfig { diff --git a/src/api/types/payments.ts b/src/api/types/payments.ts index d13e82c71..2a949a5f8 100644 --- a/src/api/types/payments.ts +++ b/src/api/types/payments.ts @@ -5,7 +5,7 @@ import type { ApiChat } from './chats'; import type { ApiDocument, ApiMessageEntity, ApiPaymentCredentials, BoughtPaidMedia, } from './messages'; -import type { PrepaidGiveaway, StatisticsOverviewPercentage } from './statistics'; +import type { StatisticsOverviewPercentage } from './statistics'; import type { ApiUser } from './users'; export interface ApiShippingAddress { @@ -149,8 +149,23 @@ export type ApiInputStorePaymentStarsGift = { amount: number; }; +export type ApiInputStorePaymentStarsGiveaway = { + type: 'starsgiveaway'; + isOnlyForNewSubscribers?: boolean; + areWinnersVisible?: boolean; + chat: ApiChat; + additionalChannels?: ApiChat[]; + stars?: number; + countries?: string[]; + prizeDescription?: string; + untilDate: number; + currency: string; + amount: number; + users: number; +}; + export type ApiInputStorePaymentPurpose = ApiInputStorePaymentGiveaway | ApiInputStorePaymentGiftcode | -ApiInputStorePaymentStarsTopup | ApiInputStorePaymentStarsGift; +ApiInputStorePaymentStarsTopup | ApiInputStorePaymentStarsGift | ApiInputStorePaymentStarsGiveaway; export interface ApiPremiumGiftCodeOption { users: number; @@ -159,6 +174,25 @@ export interface ApiPremiumGiftCodeOption { amount: number; } +export interface ApiPrepaidGiveaway { + type: 'giveaway'; + id: string; + months: number; + quantity: number; + date: number; +} + +export type ApiPrepaidStarsGiveaway = { + type: 'starsGiveaway'; + id: string; + stars: number; + quantity: number; + boosts: number; + date: number; +}; + +export type ApiTypePrepaidGiveaway = ApiPrepaidGiveaway | ApiPrepaidStarsGiveaway; + export type ApiBoostsStatus = { level: number; currentLevelBoosts: number; @@ -166,8 +200,9 @@ export type ApiBoostsStatus = { nextLevelBoosts?: number; hasMyBoost?: boolean; boostUrl: string; + giftBoosts?: number; premiumSubscribers?: StatisticsOverviewPercentage; - prepaidGiveaways?: PrepaidGiveaway[]; + prepaidGiveaways?: ApiTypePrepaidGiveaway[]; }; export type ApiMyBoost = { @@ -184,6 +219,7 @@ export type ApiBoost = { expires: number; isFromGiveaway?: boolean; isGift?: boolean; + stars?: number; }; export type ApiGiveawayInfoActive = { @@ -201,10 +237,11 @@ export type ApiGiveawayInfoResults = { isWinner?: true; isRefunded?: true; startDate: number; + starsPrize?: number; finishDate: number; giftCodeSlug?: string; winnersCount: number; - activatedCount: number; + activatedCount?: number; }; export type ApiGiveawayInfo = ApiGiveawayInfoActive | ApiGiveawayInfoResults; @@ -219,13 +256,6 @@ export type ApiCheckedGiftCode = { usedAt?: number; }; -export interface ApiPrepaidGiveaway { - id: string; - months: number; - quantity: number; - date: number; -} - export interface ApiStarsTransactionPeerUnsupported { type: 'unsupported'; } @@ -271,6 +301,7 @@ export interface ApiStarsTransaction { stars: number; isRefund?: true; isGift?: true; + isPrizeStars?: true; isMyGift?: true; // Used only for outgoing star gift messages hasFailed?: true; isPending?: true; @@ -287,3 +318,19 @@ export interface ApiStarTopupOption { currency: string; amount: number; } + +export interface ApiStarsGiveawayWinnerOption { + isDefault?: true; + users: number; + perUserStars: number; +} + +export interface ApiStarGiveawayOption { + isExtended?: true; + isDefault?: true; + stars: number; + yearlyBoosts: number; + currency: string; + amount: number; + winners: ApiStarsGiveawayWinnerOption[]; +} diff --git a/src/api/types/statistics.ts b/src/api/types/statistics.ts index 4d1a7f19d..9fbbc8dd9 100644 --- a/src/api/types/statistics.ts +++ b/src/api/types/statistics.ts @@ -1,4 +1,5 @@ import type { ApiChat } from './chats'; +import type { ApiTypePrepaidGiveaway } from './payments'; export interface ApiChannelStatistics { growthGraph?: StatisticsGraph | string; @@ -61,7 +62,7 @@ export interface ApiBoostStatistics { boosts: number; premiumSubscribers: StatisticsOverviewPercentage; remainingBoosts: number; - prepaidGiveaways: PrepaidGiveaway[]; + prepaidGiveaways: ApiTypePrepaidGiveaway[]; } export interface ApiMessagePublicForward { @@ -115,13 +116,6 @@ export interface StatisticsOverviewPercentage { percentage: string; } -export interface PrepaidGiveaway { - id: string; - months: number; - quantity: number; - date: number; -} - export interface StatisticsOverviewPeriod { maxDate: number; minDate: number; diff --git a/src/assets/localization/fallback.strings b/src/assets/localization/fallback.strings index 3a1a049b3..50f666614 100644 --- a/src/assets/localization/fallback.strings +++ b/src/assets/localization/fallback.strings @@ -1283,3 +1283,4 @@ "CreditsBoxHistoryEntryGiftOutAbout" = "With Stars, {user} will be able to unlock content and services on Telegram. {link}" "CreditsBoxOutAbout" = "Review the {link} for Stars." "GiftStarsOutgoing" = "With Stars, {user} will be able to unlock content and services on Telegram." +"PrizeCredits" = "Your prize is {count} Stars." diff --git a/src/assets/premium/GiftStar.svg b/src/assets/premium/GiftStar.svg new file mode 100644 index 000000000..f8935291a --- /dev/null +++ b/src/assets/premium/GiftStar.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/common/FullNameTitle.tsx b/src/components/common/FullNameTitle.tsx index 38a72a8ba..878b1584c 100644 --- a/src/components/common/FullNameTitle.tsx +++ b/src/components/common/FullNameTitle.tsx @@ -80,7 +80,7 @@ const FullNameTitle: FC = ({ const specialTitle = useMemo(() => { if (customPeer) { - return lang(customPeer.titleKey); + return lang(customPeer.titleKey, customPeer.titleValue, 'i'); } if (isSavedMessages) { diff --git a/src/components/common/helpers/renderActionMessageText.tsx b/src/components/common/helpers/renderActionMessageText.tsx index 43fe201e2..eccfaed08 100644 --- a/src/components/common/helpers/renderActionMessageText.tsx +++ b/src/components/common/helpers/renderActionMessageText.tsx @@ -91,6 +91,11 @@ export function renderActionMessageText( .replace('un2', '%action_origin%') .replace(/\*\*/g, ''); } + if (translationKey === 'BoostingReceivedPrizeFrom') { + unprocessed = unprocessed + .replace('**%s**', '%target_chat%') + .replace(/\*\*/g, ''); + } let processed: TextPart[]; if (unprocessed.includes('%star_target_user%')) { diff --git a/src/components/main/Main.tsx b/src/components/main/Main.tsx index 373c0b59d..72888095f 100644 --- a/src/components/main/Main.tsx +++ b/src/components/main/Main.tsx @@ -569,10 +569,10 @@ const Main = ({ /> - {isPremiumModalOpen && } - {isGiveawayModalOpen && } - {isPremiumGiftingPickerModal && } - {isStarsGiftingPickerModal && } + + + + diff --git a/src/components/main/premium/GiveawayModal.module.scss b/src/components/main/premium/GiveawayModal.module.scss index 9291c2786..6d8926c46 100644 --- a/src/components/main/premium/GiveawayModal.module.scss +++ b/src/components/main/premium/GiveawayModal.module.scss @@ -114,6 +114,7 @@ .options { width: 100%; + padding: 0 0.25rem; } .giveawayTitle { @@ -133,6 +134,10 @@ @include mixins.adapt-margin-to-scrollbar(1rem); } +.starSubscription { + margin-top: 0; +} + .subscriptionOption { margin-bottom: 0; padding-inline: 3.5rem 1rem; @@ -142,10 +147,10 @@ .status { display: flex; align-items: center; - gap: 1rem; + gap: 0.8125rem; justify-content: space-between; width: 100%; - padding: 0 0.375rem 0 1.125rem; + padding: 0 0.375rem 0 1rem; margin-bottom: 1.3125rem; } @@ -263,7 +268,8 @@ } .addChannel { - margin-inline-start: initial !important; + margin-inline-end: 1.375rem !important; + margin-inline-start: 0.3125rem !important; } .removeChannel { @@ -272,6 +278,10 @@ padding: 0.5rem; } +.starOptions { + padding: 0.8125rem; +} + @media (max-width: 600px) { .root :global(.modal-dialog) { width: 100%; diff --git a/src/components/main/premium/GiveawayModal.tsx b/src/components/main/premium/GiveawayModal.tsx index b44ae5a79..f3ecbefcc 100644 --- a/src/components/main/premium/GiveawayModal.tsx +++ b/src/components/main/premium/GiveawayModal.tsx @@ -6,7 +6,13 @@ import React, { import { getActions, getGlobal, withGlobal } from '../../../global'; import type { - ApiCountry, ApiPremiumGiftCodeOption, ApiPrepaidGiveaway, ApiUser, + ApiCountry, + ApiPremiumGiftCodeOption, + ApiPrepaidGiveaway, + ApiPrepaidStarsGiveaway, + ApiStarGiveawayOption, + ApiTypePrepaidGiveaway, + ApiUser, } from '../../../api/types'; import { @@ -22,6 +28,7 @@ import { } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; import { formatDateTimeToString } from '../../../util/dates/dateFormat'; +import { unique } from '../../../util/iteratees'; import renderText from '../../common/helpers/renderText'; import useFlag from '../../../hooks/useFlag'; @@ -32,6 +39,7 @@ import CalendarModal from '../../common/CalendarModal'; import CountryPickerModal from '../../common/CountryPickerModal'; import GroupChatInfo from '../../common/GroupChatInfo'; import Icon from '../../common/icons/Icon'; +import StarTopupOptionList from '../../modals/stars/StarTopupOptionList'; import Button from '../../ui/Button'; import ConfirmDialog from '../../ui/ConfirmDialog'; import InputText from '../../ui/InputText'; @@ -51,7 +59,7 @@ import styles from './GiveawayModal.module.scss'; import GiftBlueRound from '../../../assets/premium/GiftBlueRound.svg'; import GiftGreenRound from '../../../assets/premium/GiftGreenRound.svg'; import GiftRedRound from '../../../assets/premium/GiftRedRound.svg'; -import GiveawayUsersRound from '../../../assets/premium/GiveawayUsersRound.svg'; +import GiftStar from '../../../assets/premium/GiftStar.svg'; import PremiumLogo from '../../../assets/premium/PremiumLogo.svg'; export type OwnProps = { @@ -69,13 +77,15 @@ type StateProps = { giveawayBoostPerPremiumLimit?: number; userSelectionLimit?: number; countryList: ApiCountry[]; - prepaidGiveaway?: ApiPrepaidGiveaway; + prepaidGiveaway?: ApiTypePrepaidGiveaway; countrySelectionLimit: number | undefined; isChannel?: boolean; + isStarsGiftsEnabled?: boolean; + starsGiftOptions?: ApiStarGiveawayOption[] | undefined; }; -type GiveawayAction = 'createRandomlyUsers' | 'createSpecificUsers'; -type ApiGiveawayType = 'random_users' | 'specific_users'; +type GiveawayAction = 'createPremiumGiveaway' | 'createStarsGiveaway'; +type ApiGiveawayType = 'premium_giveaway' | 'stars_giveaway'; type SubscribersType = 'all' | 'new'; interface TypeOption { @@ -110,12 +120,14 @@ const GiveawayModal: FC = ({ prepaidGiveaway, countrySelectionLimit = GIVEAWAY_MAX_ADDITIONAL_COUNTRIES, userSelectionLimit = GIVEAWAY_MAX_ADDITIONAL_USERS, + isStarsGiftsEnabled, + starsGiftOptions, }) => { // eslint-disable-next-line no-null/no-null const dialogRef = useRef(null); const { closeGiveawayModal, openInvoice, openPremiumModal, - launchPrepaidGiveaway, + launchPrepaidGiveaway, launchPrepaidStarsGiveaway, } = getActions(); const lang = useOldLang(); @@ -126,28 +138,33 @@ const GiveawayModal: FC = ({ const [isChannelPickerModalOpen, openChannelPickerModal, closeChannelPickerModal] = useFlag(); const TYPE_OPTIONS: TypeOption[] = [{ - name: 'BoostingCreateGiveaway', + name: 'Premium.Title', text: 'BoostingWinnersRandomly', - value: 'random_users', + value: 'premium_giveaway', img: GiftBlueRound, - actions: 'createRandomlyUsers', - isLink: false, - }, { - name: 'BoostingAwardSpecificUsers', - text: 'BoostingSelectRecipients', - value: 'specific_users', - img: GiveawayUsersRound, - actions: 'createSpecificUsers', + actions: 'createPremiumGiveaway', isLink: true, onClickAction: () => { openUserPickerModal(); }, }]; + if (isStarsGiftsEnabled) { + TYPE_OPTIONS.push({ + name: 'TelegramStars', + text: 'BoostingWinnersRandomly', + value: 'stars_giveaway', + img: GiftStar, + actions: 'createStarsGiveaway', + isLink: false, + }); + } + const [customExpireDate, setCustomExpireDate] = useState(Date.now() + DEFAULT_CUSTOM_EXPIRE_DATE); const [isHeaderHidden, setHeaderHidden] = useState(true); const [selectedRandomUserCount, setSelectedRandomUserCount] = useState(DEFAULT_BOOST_COUNT); const [selectedGiveawayOption, setGiveawayOption] = useState(TYPE_OPTIONS[0].value); + const [selectedStarOption, setSelectedStarOption] = useState(); const [selectedSubscriberOption, setSelectedSubscriberOption] = useState('all'); const [selectedMonthOption, setSelectedMonthOption] = useState(); const [selectedUserIds, setSelectedUserIds] = useState([]); @@ -157,10 +174,16 @@ const GiveawayModal: FC = ({ const [shouldShowPrizes, setShouldShowPrizes] = useState(false); const [prizeDescription, setPrizeDescription] = useState(undefined); const [dataPrepaidGiveaway, setDataPrepaidGiveaway] = useState(undefined); + const [ + dataStarsPrepaidGiveaway, setDataStarsPrepaidGiveaway, + ] = useState(undefined); - const isRandomUsers = selectedGiveawayOption === 'random_users'; - const selectedUserCount = isRandomUsers ? selectedRandomUserCount : selectedUserIds.length; + const isPremiumGiveaway = selectedGiveawayOption === 'premium_giveaway'; + const isStarsGiveaway = selectedGiveawayOption === 'stars_giveaway'; + const selectedUserCount = isPremiumGiveaway + && !selectedUserIds.length ? selectedRandomUserCount : selectedUserIds.length; const boostQuantity = selectedUserCount * giveawayBoostPerPremiumLimit; + const boostStarsQuantity = selectedStarOption?.yearlyBoosts; const SUBSCRIBER_OPTIONS = useMemo(() => [ { @@ -180,44 +203,65 @@ const GiveawayModal: FC = ({ ], [isChannel, lang, selectedCountryIds]); const monthQuantity = lang('Months', selectedMonthOption); + const isStarsPrepaidGiveaway = prepaidGiveaway?.type === 'starsGiveaway'; + const isPremiumPrepaidGiveaway = prepaidGiveaway?.type === 'giveaway'; const selectedGift = useMemo(() => { - return gifts!.find((gift) => gift.months === selectedMonthOption && gift.users === selectedUserCount); + return gifts?.find((gift) => gift.months === selectedMonthOption && gift.users === selectedUserCount); }, [gifts, selectedMonthOption, selectedUserCount]); + const selectedStarsGift = useMemo(() => { + return starsGiftOptions?.find((gift) => { + return isStarsPrepaidGiveaway && gift.stars === (dataStarsPrepaidGiveaway?.stars); + }); + }, [dataStarsPrepaidGiveaway, starsGiftOptions, isStarsPrepaidGiveaway]); + const filteredGifts = useMemo(() => { return gifts?.filter((gift) => gift.users === selectedUserCount); }, [gifts, selectedUserCount]); const fullMonthlyAmount = useMemo(() => { - if (!filteredGifts?.length) { - return undefined; - } - - const basicGift = filteredGifts.reduce((acc, gift) => { + const basicGift = filteredGifts?.reduce((acc, gift) => { return gift.amount < acc.amount ? gift : acc; - }); + }, filteredGifts[0]); - return Math.floor(basicGift.amount / basicGift.months); + return basicGift && Math.floor(basicGift.amount / basicGift.months); }, [filteredGifts]); const userCountOptions = useMemo(() => { - const uniqueUserCounts = new Set(gifts?.map((gift) => gift.users)); - return Array.from(uniqueUserCounts).sort((a, b) => a - b); + return unique((gifts?.map((winner) => winner.users) || [])).sort((a, b) => a - b); }, [gifts]); - useEffect(() => { - if (isOpen) { - setSelectedMonthOption(prepaidGiveaway ? prepaidGiveaway.months : gifts?.[0].months); - } - }, [gifts, isOpen, prepaidGiveaway]); + const winnerCountOptions = useMemo(() => { + return unique((selectedStarOption?.winners?.map((winner) => winner.users) || [])).sort((a, b) => a - b); + }, [selectedStarOption]); useEffect(() => { - if (prepaidGiveaway) { + if (isOpen && gifts?.length && !isStarsPrepaidGiveaway) { + setSelectedMonthOption(gifts?.[0].months); + } + }, [isOpen, gifts, isStarsPrepaidGiveaway]); + + useEffect(() => { + if (isOpen && starsGiftOptions?.length && !isPremiumPrepaidGiveaway) { + setSelectedStarOption(starsGiftOptions?.[0]); + } + }, [isOpen, starsGiftOptions, isPremiumPrepaidGiveaway]); + + useEffect(() => { + if (isOpen && isStarsPrepaidGiveaway) { + setSelectedRandomUserCount(prepaidGiveaway.quantity); + setDataStarsPrepaidGiveaway(prepaidGiveaway); + } + }, [isOpen, isStarsPrepaidGiveaway, prepaidGiveaway]); + + useEffect(() => { + if (isOpen && isPremiumPrepaidGiveaway) { setSelectedRandomUserCount(prepaidGiveaway.quantity); setDataPrepaidGiveaway(prepaidGiveaway); + setSelectedMonthOption(prepaidGiveaway.months); } - }, [prepaidGiveaway]); + }, [isOpen, isPremiumPrepaidGiveaway, prepaidGiveaway]); useEffect(() => { if (selectedMemberList) { @@ -235,10 +279,44 @@ const GiveawayModal: FC = ({ openPremiumModal(); }); + const handleClose = useLastCallback(() => { + setDataStarsPrepaidGiveaway(undefined); + setDataPrepaidGiveaway(undefined); + setSelectedStarOption(undefined); + setSelectedMonthOption(undefined); + setSelectedRandomUserCount(DEFAULT_BOOST_COUNT); + closeGiveawayModal(); + }); + const handleClick = useLastCallback(() => { - if (isRandomUsers) { + if (isPremiumGiveaway) { + if (selectedUserIds?.length) { + openInvoice({ + type: 'giftcode', + boostChannelId: chatId!, + userIds: selectedUserIds, + currency: selectedGift!.currency, + amount: selectedGift!.amount, + option: selectedGift!, + }); + } else { + openInvoice({ + type: 'giveaway', + chatId: chatId!, + additionalChannelIds: selectedChannelIds, + isOnlyForNewSubscribers: selectedSubscriberOption === 'new', + countries: selectedCountryIds, + areWinnersVisible: shouldShowWinners, + prizeDescription, + untilDate: customExpireDate / 1000, + currency: selectedGift!.currency, + amount: selectedGift!.amount, + option: selectedGift!, + }); + } + } else { openInvoice({ - type: 'giveaway', + type: 'starsgiveaway', chatId: chatId!, additionalChannelIds: selectedChannelIds, isOnlyForNewSubscribers: selectedSubscriberOption === 'new', @@ -246,47 +324,61 @@ const GiveawayModal: FC = ({ areWinnersVisible: shouldShowWinners, prizeDescription, untilDate: customExpireDate / 1000, - currency: selectedGift!.currency, - amount: selectedGift!.amount, - option: selectedGift!, - }); - } else { - openInvoice({ - type: 'giftcode', - boostChannelId: chatId!, - userIds: selectedUserIds, - currency: selectedGift!.currency, - amount: selectedGift!.amount, - option: selectedGift!, + currency: selectedStarOption!.currency, + amount: selectedStarOption!.amount, + stars: selectedStarOption!.stars, + users: selectedRandomUserCount, }); } - closeGiveawayModal(); + handleClose(); }); const confirmLaunchPrepaidGiveaway = useLastCallback(() => { - launchPrepaidGiveaway({ - chatId: chatId!, - giveawayId: dataPrepaidGiveaway!.id, - paymentPurpose: { - additionalChannelIds: selectedChannelIds, - countries: selectedCountryIds, - prizeDescription, - areWinnersVisible: shouldShowWinners, - untilDate: customExpireDate / 1000, - currency: selectedGift!.currency, - amount: selectedGift!.amount, - }, - }); + if (isStarsPrepaidGiveaway) { + launchPrepaidStarsGiveaway({ + chatId: chatId!, + giveawayId: dataStarsPrepaidGiveaway!.id, + paymentPurpose: { + additionalChannelIds: selectedChannelIds, + countries: selectedCountryIds, + prizeDescription, + areWinnersVisible: shouldShowWinners, + untilDate: customExpireDate / 1000, + stars: dataStarsPrepaidGiveaway!.stars, + currency: selectedStarsGift!.currency, + amount: selectedStarsGift!.amount, + users: dataStarsPrepaidGiveaway!.quantity, + }, + }); + } else { + launchPrepaidGiveaway({ + chatId: chatId!, + giveawayId: dataPrepaidGiveaway!.id, + paymentPurpose: { + additionalChannelIds: selectedChannelIds, + countries: selectedCountryIds, + prizeDescription, + areWinnersVisible: shouldShowWinners, + untilDate: customExpireDate / 1000, + currency: selectedGift!.currency, + amount: selectedGift!.amount, + }, + }); + } closeConfirmModal(); - closeGiveawayModal(); + handleClose(); }); const handleRandomUserCountChange = useLastCallback((newValue) => { setSelectedRandomUserCount(newValue); }); + const handleWinnerCountChange = useLastCallback((newValue) => { + setSelectedRandomUserCount(newValue); + }); + const handlePrizeDescriptionChange = useLastCallback((e: ChangeEvent) => { setPrizeDescription(e.target.value); }); @@ -309,6 +401,7 @@ const GiveawayModal: FC = ({ const handleChangeTypeOption = useLastCallback((value: ApiGiveawayType) => { setGiveawayOption(value); setSelectedUserIds([]); + setSelectedRandomUserCount(DEFAULT_BOOST_COUNT); }); const handleExpireDateChange = useLastCallback((date: Date) => { @@ -323,7 +416,7 @@ const GiveawayModal: FC = ({ const handleSelectedUserIdsChange = useLastCallback((newSelectedIds: string[]) => { setSelectedUserIds(newSelectedIds); if (!newSelectedIds.length) { - setGiveawayOption('random_users'); + setGiveawayOption('premium_giveaway'); } }); @@ -331,10 +424,6 @@ const GiveawayModal: FC = ({ setSelectedChannelIds(newSelectedIds); }); - const handleClose = useLastCallback(() => { - closeGiveawayModal(); - }); - const handleShouldShowWinnersChange = useLastCallback((e: ChangeEvent) => { setShouldShowWinners(e.target.checked); }); @@ -347,7 +436,9 @@ const GiveawayModal: FC = ({ openCountryPickerModal(); }); - if (!gifts) return undefined; + const handleStarClick = useLastCallback((option) => { + setSelectedStarOption(option); + }); function renderTypeOptions() { return ( @@ -428,12 +519,177 @@ const GiveawayModal: FC = ({ setSelectedChannelIds(filteredChannelIds); } + function renderStarOptionList() { + return ( + + ); + } + + function renderGiveawayOptionList() { + return ( + <> +
+

+ {lang('BoostingChannelsGroupsIncludedGiveaway')} +

+ + + + + + {selectedChannelIds?.map((channelId) => { + return ( + deleteParticipantsHandler(channelId)} + rightElement={()} + > + + + ); + })} + + {selectedChannelIds.length < MAX_ADDITIONAL_CHANNELS && ( + + {lang('BoostingAddChannelOrGroup')} + + )} +
+ +
+

+ {lang('BoostingEligibleUsers')} +

+ + {renderSubscribersOptions()} +
+ +
+ {renderText(lang(isChannel ? 'BoostGift.LimitSubscribersInfo' : 'lng_giveaway_users_about_group'))} +
+ +
+
+

+ {lang('BoostingGiveawayAdditionalPrizes')} +

+ + +
+ + {shouldShowPrizes && ( +
+

+ {selectedRandomUserCount} +

+ +
+ )} +
+ + {shouldShowPrizes ? ( + !isStarsGiveaway && !isStarsPrepaidGiveaway ? ( +
+ {prizeDescription?.length ? renderText(lang('BoostingGiveawayAdditionPrizeCountNameHint', + dataPrepaidGiveaway + ? [dataPrepaidGiveaway.quantity, prizeDescription, monthQuantity] + : [selectedUserCount, prizeDescription, monthQuantity], + undefined, + selectedMonthOption), ['simple_markdown']) : renderText(lang('BoostingGiveawayAdditionPrizeCountHint', + dataPrepaidGiveaway + ? [dataPrepaidGiveaway.quantity, monthQuantity] + : [selectedUserCount, monthQuantity], + undefined, + selectedMonthOption), ['simple_markdown'])} +
+ ) : undefined + ) : ( +
+ {renderText(lang('BoostingGiveawayAdditionPrizeHint'))} +
+ )} + +
+
+

+ {lang('BoostingGiveawayShowWinners')} +

+ + +
+
+ +
+ {renderText(lang('BoostingGiveawayShowWinnersHint'))} +
+ +
+

+ {lang('BoostingDateWhenGiveawayEnds')} +

+ + +
+ + ); + } + return (
- {dataPrepaidGiveaway ? ( + {(dataPrepaidGiveaway || dataStarsPrepaidGiveaway) ? (
- + {dataStarsPrepaidGiveaway ? ( + + ) : ( + + )}

- {lang('BoostingTelegramPremiumCountPlural', dataPrepaidGiveaway.quantity)} + {dataStarsPrepaidGiveaway ? lang('Giveaway.Stars.Prepaid.Title', dataStarsPrepaidGiveaway?.stars) + : lang('BoostingTelegramPremiumCountPlural', dataPrepaidGiveaway!.quantity)}

-

{lang('PrepaidGiveawayMonths', dataPrepaidGiveaway.months)}

+

+ {dataStarsPrepaidGiveaway ? lang('Giveaway.Stars.Prepaid.Desc', dataStarsPrepaidGiveaway?.quantity) + : lang('PrepaidGiveawayMonths', dataPrepaidGiveaway?.months)} +

- {dataPrepaidGiveaway.quantity * (giveawayBoostPerPremiumLimit ?? GIVEAWAY_BOOST_PER_PREMIUM)} + {dataStarsPrepaidGiveaway ? dataStarsPrepaidGiveaway?.boosts + : dataPrepaidGiveaway!.quantity * (giveawayBoostPerPremiumLimit ?? GIVEAWAY_BOOST_PER_PREMIUM)}
@@ -484,9 +749,9 @@ const GiveawayModal: FC = ({
)} - {isRandomUsers && ( + {isPremiumGiveaway && !selectedUserIds?.length && ( <> - {!dataPrepaidGiveaway && ( + {!dataPrepaidGiveaway && !dataStarsPrepaidGiveaway && ( <>
@@ -514,151 +779,57 @@ const GiveawayModal: FC = ({ )} -
-

- {lang('BoostingChannelsIncludedGiveaway')} -

- - - - - - {selectedChannelIds?.map((channelId) => { - return ( - deleteParticipantsHandler(channelId)} - rightElement={()} - > - - - ); - })} - - {selectedChannelIds.length < MAX_ADDITIONAL_CHANNELS && ( - - {lang('BoostingAddChannelOrGroup')} - - )} -
- -
-

- {lang('BoostingEligibleUsers')} -

- - {renderSubscribersOptions()} -
- -
- {renderText(lang(isChannel ? 'BoostGift.LimitSubscribersInfo' : 'lng_giveaway_users_about_group'))} -
- -
-
-

- {lang('BoostingGiveawayAdditionalPrizes')} -

- - -
- - {shouldShowPrizes && ( -
-

- {dataPrepaidGiveaway ? dataPrepaidGiveaway.quantity : selectedUserCount} -

- -
- )} -
- - {shouldShowPrizes ? ( -
- {prizeDescription?.length ? renderText(lang('BoostingGiveawayAdditionPrizeCountNameHint', - dataPrepaidGiveaway - ? [dataPrepaidGiveaway.quantity, prizeDescription, monthQuantity] - : [selectedUserCount, prizeDescription, monthQuantity], - undefined, - selectedMonthOption), ['simple_markdown']) : renderText(lang('BoostingGiveawayAdditionPrizeCountHint', - dataPrepaidGiveaway - ? [dataPrepaidGiveaway.quantity, monthQuantity] - : [selectedUserCount, monthQuantity], - undefined, - selectedMonthOption), ['simple_markdown'])} -
- ) : ( -
- {renderText(lang('BoostingGiveawayAdditionPrizeHint'))} -
- )} - -
-
-

- {lang('BoostingGiveawayShowWinners')} -

- - -
-
- -
- {renderText(lang('BoostingGiveawayShowWinnersHint'))} -
- -
-

- {lang('BoostingDateWhenGiveawayEnds')} -

- - -
+ {renderGiveawayOptionList()} )} - {!dataPrepaidGiveaway && ( + {isStarsGiveaway && ( + <> + {!dataStarsPrepaidGiveaway && !dataPrepaidGiveaway && ( + <> +
+
+

+ {lang('BoostingStarsOptions')} +

+
+ +
+ {boostStarsQuantity} +
+
+
+ + {renderStarOptionList()} +
+ +
+ {renderText(lang('BoostGift.Stars.Info'))} +
+ +
+

+ {lang('BoostingStarsQuantityPrizes')} +

+ + + +
+ {renderText(lang('BoostingStarsQuantityPrizesInfo'))} +
+
+ + )} + + {renderGiveawayOptionList()} + + )} + + {!dataPrepaidGiveaway && !dataStarsPrepaidGiveaway && isPremiumGiveaway && ( <>

@@ -676,16 +847,11 @@ const GiveawayModal: FC = ({ {selectedGiveawayOption && (
-
)} @@ -748,10 +914,12 @@ export default memo(withGlobal((global): StateProps => { selectedMemberList: giveawayModal?.selectedMemberIds, selectedChannelList: giveawayModal?.selectedChannelIds, giveawayBoostPerPremiumLimit: global.appConfig?.giveawayBoostsPerPremium, + isStarsGiftsEnabled: global.appConfig?.isStarsGiftsEnabled, userSelectionLimit: global.appConfig?.giveawayAddPeersMax, countrySelectionLimit: global.appConfig?.giveawayCountriesMax, countryList: global.countryList.general, prepaidGiveaway: giveawayModal?.prepaidGiveaway, isChannel, + starsGiftOptions: giveawayModal?.starOptions, }; })(GiveawayModal)); diff --git a/src/components/main/premium/GiveawayTypeOption.module.scss b/src/components/main/premium/GiveawayTypeOption.module.scss index ef47c6b7a..366f88404 100644 --- a/src/components/main/premium/GiveawayTypeOption.module.scss +++ b/src/components/main/premium/GiveawayTypeOption.module.scss @@ -1,7 +1,7 @@ .wrapper { position: relative; display: block; - padding-inline: 3.8125rem 1rem; + padding-inline: 3.5rem 1rem; border: none; margin-bottom: 0; diff --git a/src/components/main/premium/GiveawayTypeOption.tsx b/src/components/main/premium/GiveawayTypeOption.tsx index ae13b35ad..70f73e945 100644 --- a/src/components/main/premium/GiveawayTypeOption.tsx +++ b/src/components/main/premium/GiveawayTypeOption.tsx @@ -11,7 +11,7 @@ import Icon from '../../common/icons/Icon'; import styles from './GiveawayTypeOption.module.scss'; -type ApiGiveawayType = 'random_users' | 'specific_users'; +type ApiGiveawayType = 'premium_giveaway' | 'stars_giveaway'; type OwnProps = { option: ApiGiveawayType; @@ -54,7 +54,6 @@ const GiveawayTypeOption: FC = ({

{isLink ? ( -
+
{displayText}
diff --git a/src/components/main/premium/PremiumGiftModal.module.scss b/src/components/main/premium/PremiumGiftModal.module.scss index c52fba33a..f26ea6a27 100644 --- a/src/components/main/premium/PremiumGiftModal.module.scss +++ b/src/components/main/premium/PremiumGiftModal.module.scss @@ -15,7 +15,6 @@ } .root :global(.modal-dialog) { - height: min(calc(55vh + 41px + 193px), 90vh); max-width: 26.25rem; } @@ -119,5 +118,5 @@ } .footer { - margin: 0 1.5rem; + margin: 0 1.5rem 1rem; } diff --git a/src/components/main/premium/PremiumSubscriptionOption.module.scss b/src/components/main/premium/PremiumSubscriptionOption.module.scss index b305de18a..c8dec1212 100644 --- a/src/components/main/premium/PremiumSubscriptionOption.module.scss +++ b/src/components/main/premium/PremiumSubscriptionOption.module.scss @@ -15,7 +15,7 @@ .giveawayWrapper { position: relative; display: block; - padding-inline: 3.8125rem 1rem; + padding-inline: 3.5rem 1rem; cursor: var(--custom-cursor, pointer); diff --git a/src/components/main/premium/StarsGiftModal.module.scss b/src/components/main/premium/StarsGiftModal.module.scss index 7f7880dbd..e0a863189 100644 --- a/src/components/main/premium/StarsGiftModal.module.scss +++ b/src/components/main/premium/StarsGiftModal.module.scss @@ -4,10 +4,6 @@ } } -.root { - z-index: calc(var(--z-modal-low-priority) + 1); -} - .root :global(.modal-content) { padding: 0; } @@ -15,11 +11,6 @@ .root :global(.modal-dialog) { height: min(calc(55vh + 41px + 193px), 90vh); max-width: 26.25rem; -} - -.root :global(.modal-dialog), -.root :global(.modal-content), -.transition { overflow: hidden; } @@ -28,6 +19,7 @@ overflow-y: scroll; display: flex; flex-direction: column; + align-items: center; } .headerInfo { diff --git a/src/components/main/premium/StarsGiftModal.tsx b/src/components/main/premium/StarsGiftModal.tsx index ffedc67f5..e61c4486e 100644 --- a/src/components/main/premium/StarsGiftModal.tsx +++ b/src/components/main/premium/StarsGiftModal.tsx @@ -116,6 +116,10 @@ const StarsGiftModal: FC = ({ setHeaderHidden(scrollTop <= 150); } + const handleClose = useLastCallback(() => { + closeStarsGiftModal(); + }); + function renderGiftTitle() { if (isCompleted) { return user ? renderText(oldLang('Notification.StarsGift.SentYou', @@ -149,12 +153,12 @@ const StarsGiftModal: FC = ({ return ( -
+
@@ -216,14 +229,14 @@ const Giveaway = ({ const isResultsInfo = giveawayInfo.type === 'results'; const chatTitle = isApiPeerChat(sender) ? getChatTitle(lang, sender) : getUserFullName(sender); - const duration = lang('Chat.Giveaway.Info.Months', months); const endDate = formatDateAtTime(lang, untilDate * 1000); const otherChannelsCount = giveaway?.channelIds ? giveaway.channelIds.length - 1 : 0; const otherChannelsString = lang('Chat.Giveaway.Info.OtherChannels', otherChannelsCount); const isSeveral = otherChannelsCount > 0; const firstKey = isResultsInfo ? 'BoostingGiveawayHowItWorksTextEnd' : 'BoostingGiveawayHowItWorksText'; - const firstParagraph = lang(firstKey, [chatTitle, quantity, duration], undefined, quantity); + const giveawayDuration = isResultsInfo ? lang('Chat.Giveaway.Info.Months', months) : lang('Stars', stars, 'i'); + const firstParagraph = lang(firstKey, [chatTitle, quantity, giveawayDuration], undefined, quantity); const additionalPrizes = prizeDescription ? lang('BoostingGiveawayHowItWorksIncludeText', [chatTitle, quantity, prizeDescription], undefined, quantity) diff --git a/src/components/middle/message/Message.scss b/src/components/middle/message/Message.scss index 4c2e31dff..2de044b43 100644 --- a/src/components/middle/message/Message.scss +++ b/src/components/middle/message/Message.scss @@ -731,6 +731,10 @@ width: 1px; visibility: hidden; } + + .giveaway-result-content { + min-width: 17rem; + } } // Border-radius styles diff --git a/src/components/middle/message/Message.tsx b/src/components/middle/message/Message.tsx index b9e8be02e..cd7286c48 100644 --- a/src/components/middle/message/Message.tsx +++ b/src/components/middle/message/Message.tsx @@ -1576,7 +1576,9 @@ const Message: FC = ({ )} {withAvatar && renderAvatar()}
- {!isGift && !noHeaderImage && ( + {!isGift && !isPrizeStars && !noHeaderImage && ( withAvatar ? ( ) : ( diff --git a/src/components/modals/stars/StarTopupOptionList.module.scss b/src/components/modals/stars/StarTopupOptionList.module.scss index 0dcf8090d..b0b3277e0 100644 --- a/src/components/modals/stars/StarTopupOptionList.module.scss +++ b/src/components/modals/stars/StarTopupOptionList.module.scss @@ -28,6 +28,10 @@ } } +.active { + --_background-color: var(--color-background-secondary-accent); +} + .wideOption { grid-column: 1 / -1; } diff --git a/src/components/modals/stars/StarTopupOptionList.tsx b/src/components/modals/stars/StarTopupOptionList.tsx index 7dfd5039c..c165ab6ea 100644 --- a/src/components/modals/stars/StarTopupOptionList.tsx +++ b/src/components/modals/stars/StarTopupOptionList.tsx @@ -1,13 +1,17 @@ import type { FC } from '../../../lib/teact/teact'; -import React, { memo, useEffect, useMemo } from '../../../lib/teact/teact'; +import React, { + memo, useEffect, useMemo, +} from '../../../lib/teact/teact'; -import type { ApiStarTopupOption } from '../../../api/types'; +import type { ApiStarGiveawayOption, ApiStarTopupOption } from '../../../api/types'; import buildClassName from '../../../util/buildClassName'; import { formatCurrency } from '../../../util/formatCurrency'; import { formatInteger } from '../../../util/textFormat'; +import renderText from '../../common/helpers/renderText'; import useFlag from '../../../hooks/useFlag'; +import useLang from '../../../hooks/useLang'; import useOldLang from '../../../hooks/useOldLang'; import Icon from '../../common/icons/Icon'; @@ -20,18 +24,25 @@ const MAX_STARS_COUNT = 6; type OwnProps = { isActive?: boolean; - options?: ApiStarTopupOption[]; + options?: ApiStarTopupOption[] | ApiStarGiveawayOption[]; + selectedStarOption?: ApiStarTopupOption | ApiStarGiveawayOption; + selectedStarCount?: number; starsNeeded?: number; - onClick: (option: ApiStarTopupOption) => void; + className?: string; + onClick: (option: ApiStarTopupOption | ApiStarGiveawayOption) => void; }; const StarTopupOptionList: FC = ({ isActive, + className, options, + selectedStarOption, + selectedStarCount, starsNeeded, onClick, }) => { - const lang = useOldLang(); + const oldLang = useOldLang(); + const lang = useLang(); const [areOptionsExtended, markOptionsExtended, unmarkOptionsExtended] = useFlag(); @@ -51,7 +62,7 @@ const StarTopupOptionList: FC = ({ )); const forceShowAll = starsNeeded && maxOption.stars < starsNeeded; - const result: { option: ApiStarTopupOption; starsCount: number; isWide: boolean }[] = []; + const result: { option: ApiStarTopupOption | ApiStarGiveawayOption; starsCount: number; isWide: boolean }[] = []; let currentStackedStarsCount = 0; let canExtendOptions = false; options.forEach((option, index) => { @@ -73,13 +84,24 @@ const StarTopupOptionList: FC = ({ }, [areOptionsExtended, options, starsNeeded]); return ( -
+
{renderingOptions?.map(({ option, starsCount, isWide }) => { const length = renderingOptions?.length; const isOdd = length % 2 === 0; + const isActiveOption = option === selectedStarOption; + + let perUserStarCount; + if (option && 'winners' in option) { + const winner = option.winners.find((opt) => opt.users === selectedStarCount) + || option.winners.reduce((max, opt) => (opt.users > max.users ? opt : max), option.winners[0]); + perUserStarCount = winner?.perUserStars; + } + return (
onClick?.(option)} > @@ -92,14 +114,21 @@ const StarTopupOptionList: FC = ({
- {formatCurrency(option.amount, option.currency, lang.code)} + {formatCurrency(option.amount, option.currency, oldLang.code)}
+ {(isActiveOption || (selectedStarOption && 'winners' in selectedStarOption)) && perUserStarCount && ( +
+
+ {renderText(oldLang('BoostGift.Stars.PerUser', formatInteger(perUserStarCount)))} +
+
+ )}
); })} {!areOptionsExtended && canExtend && ( )} diff --git a/src/components/modals/stars/transaction/StarsTransactionModal.tsx b/src/components/modals/stars/transaction/StarsTransactionModal.tsx index eb67b9b2b..cc0c48594 100644 --- a/src/components/modals/stars/transaction/StarsTransactionModal.tsx +++ b/src/components/modals/stars/transaction/StarsTransactionModal.tsx @@ -56,6 +56,7 @@ const StarsTransactionModal: FC = ({ const lang = useLang(); const { transaction } = modal || {}; const isGift = transaction?.isGift; + const isPrizeStars = transaction?.isPrizeStars; const handleOpenMedia = useLastCallback(() => { const media = transaction?.extendedMedia; @@ -158,7 +159,7 @@ const StarsTransactionModal: FC = ({ onClick={handleOpenMedia} /> )} - {isGift ? animatedStickerData : ( + {(isGift || isPrizeStars) ? animatedStickerData : ( = ({ /> )} {title &&

{title}

} - {isGift && ( + {(isGift || isPrizeStars) && (

- {transaction?.isMyGift ? oldLang('StarsGiftSent') : oldLang('StarsGiftReceived')} + {isPrizeStars ? oldLang('StarsGiveawayPrizeReceived') + : transaction?.isMyGift ? oldLang('StarsGiftSent') : oldLang('StarsGiftReceived')}

)}

{description}

@@ -199,7 +201,14 @@ const StarsTransactionModal: FC = ({ tableData.push([oldLang('Stars.Transaction.Media'), ]); } - if (transaction.id) { + if (isPrizeStars) { + tableData.push( + [oldLang('BoostReason'), oldLang('Giveaway')], + [oldLang('Gift'), oldLang('Stars', transaction.stars, 'i')], + ); + } + + if (transaction.id && !isPrizeStars) { tableData.push([ oldLang('Stars.Transaction.Id'), ( @@ -241,7 +250,9 @@ const StarsTransactionModal: FC = ({ footer, avatarPeer: !transaction.photo ? (peer || customPeer) : undefined, }; - }, [transaction, oldLang, peer, isGift, animatedStickerData, giftOutAboutText, giftEntryAboutText]); + }, [ + transaction, oldLang, peer, isGift, isPrizeStars, animatedStickerData, giftOutAboutText, giftEntryAboutText, + ]); const prevModalData = usePreviousDeprecated(starModalData); const renderingModalData = prevModalData || starModalData; @@ -252,6 +263,7 @@ const StarsTransactionModal: FC = ({ className={styles.modal} header={renderingModalData?.header} isGift={isGift} + isPrizeStars={isPrizeStars} tableData={renderingModalData?.tableData} footer={renderingModalData?.footer} noHeaderImage={Boolean(transaction?.extendedMedia)} diff --git a/src/components/right/statistics/BoostStatistics.tsx b/src/components/right/statistics/BoostStatistics.tsx index 52603a7aa..51c3eb78f 100644 --- a/src/components/right/statistics/BoostStatistics.tsx +++ b/src/components/right/statistics/BoostStatistics.tsx @@ -3,7 +3,7 @@ import React, { } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { ApiBoost, ApiBoostStatistics, ApiPrepaidGiveaway } from '../../../api/types'; +import type { ApiBoost, ApiBoostStatistics, ApiTypePrepaidGiveaway } from '../../../api/types'; import type { TabState } from '../../../global/types'; import { @@ -17,7 +17,7 @@ import { } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; import { formatDateAtTime } from '../../../util/dates/dateFormat'; -import { CUSTOM_PEER_TO_BE_DISTRIBUTED } from '../../../util/objects/customPeer'; +import { CUSTOM_PEER_STAR, CUSTOM_PEER_TO_BE_DISTRIBUTED } from '../../../util/objects/customPeer'; import { formatInteger } from '../../../util/textFormat'; import { getBoostProgressInfo } from '../../common/helpers/boostInfo'; @@ -40,6 +40,7 @@ import styles from './BoostStatistics.module.scss'; import GiftBlueRound from '../../../assets/premium/GiftBlueRound.svg'; import GiftGreenRound from '../../../assets/premium/GiftGreenRound.svg'; import GiftRedRound from '../../../assets/premium/GiftRedRound.svg'; +import GiftStar from '../../../assets/premium/GiftStar.svg'; type StateProps = { boostStatistics: TabState['boostStatistics']; @@ -196,6 +197,8 @@ const BoostStatistics = ({ }); const renderBoostList = useLastCallback((boost) => { + const hasStars = Boolean(boost?.stars); + return ( { - e.preventDefault(); + const handleGiveawayClick = useLastCallback(() => { openGiveawayModal({ chatId }); }); @@ -228,7 +231,7 @@ const BoostStatistics = ({ loadMoreBoosters({ isGifts: tabType === 'giftedBoostList' }); }); - const launchPrepaidGiveawayHandler = useLastCallback((prepaidGiveaway: ApiPrepaidGiveaway) => { + const launchPrepaidGiveawayHandler = useLastCallback((prepaidGiveaway: ApiTypePrepaidGiveaway) => { openGiveawayModal({ chatId, prepaidGiveaway }); }); @@ -271,45 +274,65 @@ const BoostStatistics = ({

{lang('BoostingPreparedGiveaways')}

- {statsOverview?.prepaidGiveaways?.map((prepaidGiveaway) => ( - launchPrepaidGiveawayHandler(prepaidGiveaway)} - > -
-
- {lang('Giveaway')} -
-
-

- {lang('BoostingTelegramPremiumCountPlural', prepaidGiveaway.quantity)} -

-

{lang('PrepaidGiveawayMonths', prepaidGiveaway.months)}

-
-
-
- -
- {prepaidGiveaway.quantity * (giveawayBoostsPerPremium ?? GIVEAWAY_BOOST_PER_PREMIUM)} + {statsOverview?.prepaidGiveaways?.map((prepaidGiveaway) => { + const isStarsGiveaway = 'stars' in prepaidGiveaway; + + return ( + launchPrepaidGiveawayHandler(prepaidGiveaway)} + > +
+
+ {isStarsGiveaway + ? ( + {lang('GiftStar')} + ) : ( + {lang('Giveaway')} + )} +
+
+

+ {isStarsGiveaway + ? lang('Giveaway.Stars.Prepaid.Title', prepaidGiveaway.stars) + : lang('BoostingTelegramPremiumCountPlural', prepaidGiveaway.quantity)} +

+

{ + isStarsGiveaway ? lang('Giveaway.Stars.Prepaid.Desc', prepaidGiveaway.quantity) + : lang('PrepaidGiveawayMonths', prepaidGiveaway.months) + } +

+
+
+
+ +
+ {isStarsGiveaway ? prepaidGiveaway.boosts + : prepaidGiveaway.quantity * (giveawayBoostsPerPremium ?? GIVEAWAY_BOOST_PER_PREMIUM)} +
-
- - ))} + + ); + })}

{lang('BoostingSelectPaidGiveaway')}

)} -
+
{shouldDisplayGiftList ? (
) : ( -
+ <>

{lang('BoostingBoostsCount', boostStatistics?.boosts?.count)}

@@ -335,25 +358,23 @@ const BoostStatistics = ({
)} {boostStatistics?.boosts?.list?.map((boost) => renderBoostList(boost))} -
+ + )} + {Boolean(boostersToLoadCount) && ( + + {boostStatistics?.isLoadingBoosters ? ( + + ) : ( + + )} + {lang('ShowVotes', boostersToLoadCount, 'i')} + )} -
- {Boolean(boostersToLoadCount) && ( - - {boostStatistics?.isLoadingBoosters ? ( - - ) : ( - - )} - {lang('ShowVotes', boostersToLoadCount, 'i')} - - )} -
{isGiveawayAvailable && ( diff --git a/src/components/ui/RangeSliderWithMarks.module.scss b/src/components/ui/RangeSliderWithMarks.module.scss index b3c261448..516699ba5 100644 --- a/src/components/ui/RangeSliderWithMarks.module.scss +++ b/src/components/ui/RangeSliderWithMarks.module.scss @@ -7,14 +7,16 @@ background: var(--color-links); border-radius: 50%; cursor: var(--custom-cursor, pointer); - transform: scale(1); + position: absolute; + left: var(--fill-percentage); + transform: scale(1) translate(-45%, -50%); transition: transform 0.3s ease-in-out; z-index: 2; -webkit-appearance: none; appearance: none; &:hover { - transform: scale(1.5); + transform: scale(1.5) translate(-30%, -30%); } } @@ -70,30 +72,6 @@ ); } -.slider::before, -.slider::after { - content: ''; - position: absolute; - top: 0; - height: 100%; - transition: transform 0.2s ease; - z-index: -1; - transform-origin: left; -} - -.slider::before { - left: 0; - background-color: var(--color-links); - transform: scaleX(var(--fill-percentage-before)); -} - -.slider::after { - right: 0; - background: var(--color-text-secondary); - transform: scaleX(var(--fill-percentage-after)); - transform-origin: right; -} - .slider::-webkit-slider-thumb { @include thumb-styles(); } diff --git a/src/config.ts b/src/config.ts index 7560ff35c..e3777c6f7 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-v40'; +export const LANG_CACHE_NAME = 'tt-lang-packs-v42'; 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/payments.ts b/src/global/actions/api/payments.ts index 2ce1da692..4899fd082 100644 --- a/src/global/actions/api/payments.ts +++ b/src/global/actions/api/payments.ts @@ -11,7 +11,11 @@ import { buildQueryString } from '../../../util/requestQuery'; import { extractCurrentThemeParams } from '../../../util/themeStyle'; import { callApi } from '../../../api/gramjs'; import { isChatChannel, isChatSuperGroup } from '../../helpers'; -import { getRequestInputInvoice, getStarsTransactionFromGift } from '../../helpers/payments'; +import { + getPrizeStarsTransactionFromGiveaway, + getRequestInputInvoice, + getStarsTransactionFromGift, +} from '../../helpers/payments'; import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { appendStarsTransactions, closeInvoice, @@ -457,12 +461,12 @@ addActionHandler('openGiveawayModal', async (global, actions, payload): Promise< chat, }); - if (!result) { + const starOptions = await callApi('fetchStarsGiveawayOptions'); + + if (!result || !starOptions) { return; } - global = getGlobal(); - const isOpen = Boolean(chatId); global = updateTabState(global, { @@ -471,6 +475,7 @@ addActionHandler('openGiveawayModal', async (global, actions, payload): Promise< gifts: result, isOpen, prepaidGiveaway, + starOptions, }, }, tabId); setGlobal(global); @@ -546,6 +551,22 @@ addActionHandler('openStarsTransactionFromGift', (global, actions, payload): Act return openStarsTransactionModal(global, transaction, tabId); }); +addActionHandler('openPrizeStarsTransactionFromGiveaway', (global, actions, payload): ActionReturnType => { + const { + chatId, + messageId, + tabId = getCurrentTabId(), + } = payload || {}; + + const message = selectChatMessage(global, chatId, messageId); + if (!message) return undefined; + + const transaction = getPrizeStarsTransactionFromGiveaway(message); + if (!transaction) return undefined; + + return openStarsTransactionModal(global, transaction, tabId); +}); + addActionHandler('openPremiumGiftModal', async (global, actions, payload): Promise => { const { forUserIds, tabId = getCurrentTabId(), @@ -974,6 +995,41 @@ addActionHandler('launchPrepaidGiveaway', async (global, actions, payload): Prom actions.openBoostStatistics({ chatId, tabId }); }); +addActionHandler('launchPrepaidStarsGiveaway', async (global, actions, payload): Promise => { + const { + chatId, giveawayId, paymentPurpose, tabId = getCurrentTabId(), + } = payload; + + const chat = selectChat(global, chatId); + if (!chat) return; + + const additionalChannels = paymentPurpose?.additionalChannelIds?.map((id) => selectChat(global, id)).filter(Boolean); + + const result = await callApi('launchPrepaidGiveaway', { + chat, + giveawayId, + paymentPurpose: { + type: 'starsgiveaway', + chat, + areWinnersVisible: paymentPurpose?.areWinnersVisible, + additionalChannels, + countries: paymentPurpose?.countries, + prizeDescription: paymentPurpose.prizeDescription, + untilDate: paymentPurpose.untilDate, + currency: paymentPurpose.currency, + amount: paymentPurpose.amount, + stars: paymentPurpose.stars, + users: paymentPurpose.users, + }, + }); + + if (!result) { + return; + } + + actions.openBoostStatistics({ chatId, tabId }); +}); + addActionHandler('loadStarStatus', async (global): Promise => { const currentStatus = global.stars; const needsTopupOptions = !currentStatus?.topupOptions; diff --git a/src/global/helpers/payments.ts b/src/global/helpers/payments.ts index 10e9c00d7..c9f1fd20b 100644 --- a/src/global/helpers/payments.ts +++ b/src/global/helpers/payments.ts @@ -85,6 +85,36 @@ export function getRequestInputInvoice( }; } + if (inputInvoice.type === 'starsgiveaway') { + const { + chatId, additionalChannelIds, amount, currency, untilDate, areWinnersVisible, countries, + isOnlyForNewSubscribers, prizeDescription, stars, users, + } = inputInvoice; + const chat = selectChat(global, chatId); + if (!chat) { + return undefined; + } + const additionalChannels = additionalChannelIds?.map((id) => selectChat(global, id)).filter(Boolean); + + return { + type: 'starsgiveaway', + purpose: { + type: 'starsgiveaway', + amount, + currency, + chat, + additionalChannels, + untilDate, + areWinnersVisible, + countries, + isOnlyForNewSubscribers, + prizeDescription, + stars, + users, + }, + }; + } + if (inputInvoice.type === 'giveaway') { const { chatId, additionalChannelIds, amount, currency, option, untilDate, areWinnersVisible, countries, @@ -207,3 +237,22 @@ export function getStarsTransactionFromGift(message: ApiMessage): ApiStarsTransa isMyGift: message.isOutgoing || undefined, }; } + +export function getPrizeStarsTransactionFromGiveaway(message: ApiMessage): ApiStarsTransaction | undefined { + const { action } = message.content; + + if (action?.type !== 'prizeStars') return undefined; + + const { transactionId, stars, targetChatId } = action; + + return { + id: transactionId!, + stars: stars!, + peer: { + type: 'peer', + id: targetChatId!, + }, + date: message.date, + isPrizeStars: true, + }; +} diff --git a/src/global/types.ts b/src/global/types.ts index b9fc53b90..1db1b4bec 100644 --- a/src/global/types.ts +++ b/src/global/types.ts @@ -54,7 +54,6 @@ import type { ApiPostStatistics, ApiPremiumGiftCodeOption, ApiPremiumPromo, - ApiPrepaidGiveaway, ApiQuickReply, ApiReaction, ApiReactionKey, @@ -64,7 +63,7 @@ import type { ApiSendMessageAction, ApiSession, ApiSessionData, - ApiSponsoredMessage, + ApiSponsoredMessage, ApiStarGiveawayOption, ApiStarsTransaction, ApiStarTopupOption, ApiStealthMode, @@ -76,6 +75,7 @@ import type { ApiTimezone, ApiTopic, ApiTranscription, + ApiTypePrepaidGiveaway, ApiTypeStoryView, ApiTypingStatus, ApiUpdate, @@ -716,7 +716,8 @@ export type TabState = { gifts?: ApiPremiumGiftCodeOption[]; selectedMemberIds?: string[]; selectedChannelIds?: string[]; - prepaidGiveaway?: ApiPrepaidGiveaway; + prepaidGiveaway?: ApiTypePrepaidGiveaway; + starOptions?: ApiStarGiveawayOption[]; }; deleteMessageModal?: { @@ -1798,6 +1799,11 @@ export interface ActionPayloads { messageId: number; } & WithTabId; closeStarsTransactionModal: WithTabId | undefined; + openPrizeStarsTransactionFromGiveaway: { + chatId: string; + messageId: number; + } & WithTabId; + closePrizeStarsTransactionFromGiveaway: WithTabId | undefined; sendCredentialsInfo: { credentials: ApiCredentials; } & WithTabId; @@ -2239,6 +2245,22 @@ export interface ActionPayloads { }; } & WithTabId; + launchPrepaidStarsGiveaway: { + chatId: string; + giveawayId: string; + paymentPurpose: { + additionalChannelIds?: string[]; + areWinnersVisible?: boolean; + countries?: string[]; + prizeDescription?: string; + untilDate: number; + currency: string; + stars: number; + users: number; + amount: number; + }; + } & WithTabId; + loadStarStatus: undefined; loadStarsTransactions: { type: StarsTransactionType; @@ -3248,7 +3270,7 @@ export interface ActionPayloads { openGiveawayModal: ({ chatId: string; gifts?: number[] | undefined; - prepaidGiveaway?: ApiPrepaidGiveaway | undefined; + prepaidGiveaway?: ApiTypePrepaidGiveaway | undefined; } & WithTabId); closeGiveawayModal: WithTabId | undefined; diff --git a/src/lib/gramjs/tl/AllTLObjects.js b/src/lib/gramjs/tl/AllTLObjects.js index 75f399cc8..7f41990d0 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 = 186; +const LAYER = 187; 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 8f77e9ae1..e8e4a2013 100644 --- a/src/lib/gramjs/tl/api.d.ts +++ b/src/lib/gramjs/tl/api.d.ts @@ -70,7 +70,7 @@ namespace Api { export type TypeChatPhoto = ChatPhotoEmpty | ChatPhoto; export type TypeMessage = MessageEmpty | Message | MessageService; export type TypeMessageMedia = MessageMediaEmpty | MessageMediaPhoto | MessageMediaGeo | MessageMediaContact | MessageMediaUnsupported | MessageMediaDocument | MessageMediaWebPage | MessageMediaVenue | MessageMediaGame | MessageMediaInvoice | MessageMediaGeoLive | MessageMediaPoll | MessageMediaDice | MessageMediaStory | MessageMediaGiveaway | MessageMediaGiveawayResults | MessageMediaPaidMedia; - export type TypeMessageAction = MessageActionEmpty | MessageActionChatCreate | MessageActionChatEditTitle | MessageActionChatEditPhoto | MessageActionChatDeletePhoto | MessageActionChatAddUser | MessageActionChatDeleteUser | MessageActionChatJoinedByLink | MessageActionChannelCreate | MessageActionChatMigrateTo | MessageActionChannelMigrateFrom | MessageActionPinMessage | MessageActionHistoryClear | MessageActionGameScore | MessageActionPaymentSentMe | MessageActionPaymentSent | MessageActionPhoneCall | MessageActionScreenshotTaken | MessageActionCustomAction | MessageActionBotAllowed | MessageActionSecureValuesSentMe | MessageActionSecureValuesSent | MessageActionContactSignUp | MessageActionGeoProximityReached | MessageActionGroupCall | MessageActionInviteToGroupCall | MessageActionSetMessagesTTL | MessageActionGroupCallScheduled | MessageActionSetChatTheme | MessageActionChatJoinedByRequest | MessageActionWebViewDataSentMe | MessageActionWebViewDataSent | MessageActionGiftPremium | MessageActionTopicCreate | MessageActionTopicEdit | MessageActionSuggestProfilePhoto | MessageActionRequestedPeer | MessageActionSetChatWallPaper | MessageActionGiftCode | MessageActionGiveawayLaunch | MessageActionGiveawayResults | MessageActionBoostApply | MessageActionRequestedPeerSentMe | MessageActionPaymentRefunded | MessageActionGiftStars; + export type TypeMessageAction = MessageActionEmpty | MessageActionChatCreate | MessageActionChatEditTitle | MessageActionChatEditPhoto | MessageActionChatDeletePhoto | MessageActionChatAddUser | MessageActionChatDeleteUser | MessageActionChatJoinedByLink | MessageActionChannelCreate | MessageActionChatMigrateTo | MessageActionChannelMigrateFrom | MessageActionPinMessage | MessageActionHistoryClear | MessageActionGameScore | MessageActionPaymentSentMe | MessageActionPaymentSent | MessageActionPhoneCall | MessageActionScreenshotTaken | MessageActionCustomAction | MessageActionBotAllowed | MessageActionSecureValuesSentMe | MessageActionSecureValuesSent | MessageActionContactSignUp | MessageActionGeoProximityReached | MessageActionGroupCall | MessageActionInviteToGroupCall | MessageActionSetMessagesTTL | MessageActionGroupCallScheduled | MessageActionSetChatTheme | MessageActionChatJoinedByRequest | MessageActionWebViewDataSentMe | MessageActionWebViewDataSent | MessageActionGiftPremium | MessageActionTopicCreate | MessageActionTopicEdit | MessageActionSuggestProfilePhoto | MessageActionRequestedPeer | MessageActionSetChatWallPaper | MessageActionGiftCode | MessageActionGiveawayLaunch | MessageActionGiveawayResults | MessageActionBoostApply | MessageActionRequestedPeerSentMe | MessageActionPaymentRefunded | MessageActionGiftStars | MessageActionPrizeStars; export type TypeDialog = Dialog | DialogFolder; export type TypePhoto = PhotoEmpty | Photo; export type TypePhotoSize = PhotoSizeEmpty | PhotoSize | PhotoCachedSize | PhotoStrippedSize | PhotoSizeProgressive | PhotoPathSize; @@ -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; + 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; @@ -168,7 +168,7 @@ namespace Api { export type TypeLangPackString = LangPackString | LangPackStringPluralized | LangPackStringDeleted; export type TypeLangPackDifference = LangPackDifference; export type TypeLangPackLanguage = LangPackLanguage; - export type TypeChannelAdminLogEventAction = ChannelAdminLogEventActionChangeTitle | ChannelAdminLogEventActionChangeAbout | ChannelAdminLogEventActionChangeUsername | ChannelAdminLogEventActionChangePhoto | ChannelAdminLogEventActionToggleInvites | ChannelAdminLogEventActionToggleSignatures | ChannelAdminLogEventActionUpdatePinned | ChannelAdminLogEventActionEditMessage | ChannelAdminLogEventActionDeleteMessage | ChannelAdminLogEventActionParticipantJoin | ChannelAdminLogEventActionParticipantLeave | ChannelAdminLogEventActionParticipantInvite | ChannelAdminLogEventActionParticipantToggleBan | ChannelAdminLogEventActionParticipantToggleAdmin | ChannelAdminLogEventActionChangeStickerSet | ChannelAdminLogEventActionTogglePreHistoryHidden | ChannelAdminLogEventActionDefaultBannedRights | ChannelAdminLogEventActionStopPoll | ChannelAdminLogEventActionChangeLinkedChat | ChannelAdminLogEventActionChangeLocation | ChannelAdminLogEventActionToggleSlowMode | ChannelAdminLogEventActionStartGroupCall | ChannelAdminLogEventActionDiscardGroupCall | ChannelAdminLogEventActionParticipantMute | ChannelAdminLogEventActionParticipantUnmute | ChannelAdminLogEventActionToggleGroupCallSetting | ChannelAdminLogEventActionParticipantJoinByInvite | ChannelAdminLogEventActionExportedInviteDelete | ChannelAdminLogEventActionExportedInviteRevoke | ChannelAdminLogEventActionExportedInviteEdit | ChannelAdminLogEventActionParticipantVolume | ChannelAdminLogEventActionChangeHistoryTTL | ChannelAdminLogEventActionParticipantJoinByRequest | ChannelAdminLogEventActionToggleNoForwards | ChannelAdminLogEventActionSendMessage | ChannelAdminLogEventActionChangeAvailableReactions | ChannelAdminLogEventActionChangeUsernames | ChannelAdminLogEventActionToggleForum | ChannelAdminLogEventActionCreateTopic | ChannelAdminLogEventActionEditTopic | ChannelAdminLogEventActionDeleteTopic | ChannelAdminLogEventActionPinTopic | ChannelAdminLogEventActionToggleAntiSpam | ChannelAdminLogEventActionChangePeerColor | ChannelAdminLogEventActionChangeProfilePeerColor | ChannelAdminLogEventActionChangeWallpaper | ChannelAdminLogEventActionChangeEmojiStatus | ChannelAdminLogEventActionChangeEmojiStickerSet | ChannelAdminLogEventActionToggleSignatureProfiles; + export type TypeChannelAdminLogEventAction = ChannelAdminLogEventActionChangeTitle | ChannelAdminLogEventActionChangeAbout | ChannelAdminLogEventActionChangeUsername | ChannelAdminLogEventActionChangePhoto | ChannelAdminLogEventActionToggleInvites | ChannelAdminLogEventActionToggleSignatures | ChannelAdminLogEventActionUpdatePinned | ChannelAdminLogEventActionEditMessage | ChannelAdminLogEventActionDeleteMessage | ChannelAdminLogEventActionParticipantJoin | ChannelAdminLogEventActionParticipantLeave | ChannelAdminLogEventActionParticipantInvite | ChannelAdminLogEventActionParticipantToggleBan | ChannelAdminLogEventActionParticipantToggleAdmin | ChannelAdminLogEventActionChangeStickerSet | ChannelAdminLogEventActionTogglePreHistoryHidden | ChannelAdminLogEventActionDefaultBannedRights | ChannelAdminLogEventActionStopPoll | ChannelAdminLogEventActionChangeLinkedChat | ChannelAdminLogEventActionChangeLocation | ChannelAdminLogEventActionToggleSlowMode | ChannelAdminLogEventActionStartGroupCall | ChannelAdminLogEventActionDiscardGroupCall | ChannelAdminLogEventActionParticipantMute | ChannelAdminLogEventActionParticipantUnmute | ChannelAdminLogEventActionToggleGroupCallSetting | ChannelAdminLogEventActionParticipantJoinByInvite | ChannelAdminLogEventActionExportedInviteDelete | ChannelAdminLogEventActionExportedInviteRevoke | ChannelAdminLogEventActionExportedInviteEdit | ChannelAdminLogEventActionParticipantVolume | ChannelAdminLogEventActionChangeHistoryTTL | ChannelAdminLogEventActionParticipantJoinByRequest | ChannelAdminLogEventActionToggleNoForwards | ChannelAdminLogEventActionSendMessage | ChannelAdminLogEventActionChangeAvailableReactions | ChannelAdminLogEventActionChangeUsernames | ChannelAdminLogEventActionToggleForum | ChannelAdminLogEventActionCreateTopic | ChannelAdminLogEventActionEditTopic | ChannelAdminLogEventActionDeleteTopic | ChannelAdminLogEventActionPinTopic | ChannelAdminLogEventActionToggleAntiSpam | ChannelAdminLogEventActionChangePeerColor | ChannelAdminLogEventActionChangeProfilePeerColor | ChannelAdminLogEventActionChangeWallpaper | ChannelAdminLogEventActionChangeEmojiStatus | ChannelAdminLogEventActionChangeEmojiStickerSet | ChannelAdminLogEventActionToggleSignatureProfiles | ChannelAdminLogEventActionParticipantSubExtend; export type TypeChannelAdminLogEvent = ChannelAdminLogEvent; export type TypeChannelAdminLogEventsFilter = ChannelAdminLogEventsFilter; export type TypePopularContact = PopularContact; @@ -279,7 +279,7 @@ namespace Api { export type TypeNotificationSound = NotificationSoundDefault | NotificationSoundNone | NotificationSoundLocal | NotificationSoundRingtone; export type TypeAttachMenuPeerType = AttachMenuPeerTypeSameBotPM | AttachMenuPeerTypeBotPM | AttachMenuPeerTypePM | AttachMenuPeerTypeChat | AttachMenuPeerTypeBroadcast; export type TypeInputInvoice = InputInvoiceMessage | InputInvoiceSlug | InputInvoicePremiumGiftCode | InputInvoiceStars | InputInvoiceChatInviteSubscription; - export type TypeInputStorePaymentPurpose = InputStorePaymentPremiumSubscription | InputStorePaymentGiftPremium | InputStorePaymentPremiumGiftCode | InputStorePaymentPremiumGiveaway | InputStorePaymentStarsTopup | InputStorePaymentStarsGift; + export type TypeInputStorePaymentPurpose = InputStorePaymentPremiumSubscription | InputStorePaymentGiftPremium | InputStorePaymentPremiumGiftCode | InputStorePaymentPremiumGiveaway | InputStorePaymentStarsTopup | InputStorePaymentStarsGift | InputStorePaymentStarsGiveaway; export type TypePremiumGiftOption = PremiumGiftOption; export type TypePaymentFormMethod = PaymentFormMethod; export type TypeEmojiStatus = EmojiStatusEmpty | EmojiStatus | EmojiStatusUntil; @@ -318,7 +318,7 @@ namespace Api { export type TypeMediaArea = MediaAreaVenue | InputMediaAreaVenue | MediaAreaGeoPoint | MediaAreaSuggestedReaction | MediaAreaChannelPost | InputMediaAreaChannelPost | MediaAreaUrl | MediaAreaWeather; export type TypePeerStories = PeerStories; export type TypePremiumGiftCodeOption = PremiumGiftCodeOption; - export type TypePrepaidGiveaway = PrepaidGiveaway; + export type TypePrepaidGiveaway = PrepaidGiveaway | PrepaidStarsGiveaway; export type TypeBoost = Boost; export type TypeMyBoost = MyBoost; export type TypeStoryFwdHeader = StoryFwdHeader; @@ -375,6 +375,8 @@ namespace Api { export type TypeStarsSubscriptionPricing = StarsSubscriptionPricing; export type TypeStarsSubscription = StarsSubscription; export type TypeMessageReactor = MessageReactor; + export type TypeStarsGiveawayOption = StarsGiveawayOption; + export type TypeStarsGiveawayWinnersOption = StarsGiveawayWinnersOption; export type TypeResPQ = ResPQ; export type TypeP_Q_inner_data = PQInnerData | PQInnerDataDc | PQInnerDataTemp | PQInnerDataTempDc; export type TypeServer_DH_Params = ServerDHParamsFail | ServerDHParamsOk; @@ -934,11 +936,15 @@ namespace Api { url: string; }; export class InputMediaPaidMedia extends VirtualClass<{ + // flags: undefined; starsAmount: long; extendedMedia: Api.TypeInputMedia[]; + payload?: string; }> { + // flags: undefined; starsAmount: long; extendedMedia: Api.TypeInputMedia[]; + payload?: string; }; export class InputChatPhotoEmpty extends VirtualClass {}; export class InputChatUploadedPhoto extends VirtualClass<{ @@ -1903,7 +1909,8 @@ namespace Api { countriesIso2?: string[]; prizeDescription?: string; quantity: int; - months: int; + months?: int; + stars?: long; untilDate: int; }> { // flags: undefined; @@ -1913,7 +1920,8 @@ namespace Api { countriesIso2?: string[]; prizeDescription?: string; quantity: int; - months: int; + months?: int; + stars?: long; untilDate: int; }; export class MessageMediaGiveawayResults extends VirtualClass<{ @@ -1926,7 +1934,8 @@ namespace Api { winnersCount: int; unclaimedCount: int; winners: long[]; - months: int; + months?: int; + stars?: long; prizeDescription?: string; untilDate: int; }> { @@ -1939,7 +1948,8 @@ namespace Api { winnersCount: int; unclaimedCount: int; winners: long[]; - months: int; + months?: int; + stars?: long; prizeDescription?: string; untilDate: int; }; @@ -2235,11 +2245,21 @@ namespace Api { cryptoCurrency?: string; cryptoAmount?: long; }; - export class MessageActionGiveawayLaunch extends VirtualClass {}; + export class MessageActionGiveawayLaunch extends VirtualClass<{ + // flags: undefined; + stars?: long; + } | void> { + // flags: undefined; + stars?: long; + }; export class MessageActionGiveawayResults extends VirtualClass<{ + // flags: undefined; + stars?: true; winnersCount: int; unclaimedCount: int; }> { + // flags: undefined; + stars?: true; winnersCount: int; unclaimedCount: int; }; @@ -2287,6 +2307,21 @@ namespace Api { cryptoAmount?: long; transactionId?: string; }; + export class MessageActionPrizeStars extends VirtualClass<{ + // flags: undefined; + unclaimed?: true; + stars: long; + transactionId: string; + boostPeer: Api.TypePeer; + giveawayMsgId: int; + }> { + // flags: undefined; + unclaimed?: true; + stars: long; + transactionId: string; + boostPeer: Api.TypePeer; + giveawayMsgId: int; + }; export class Dialog extends VirtualClass<{ // flags: undefined; pinned?: true; @@ -3901,6 +3936,20 @@ namespace Api { peer: Api.TypePeer; status: Api.TypeStarsRevenueStatus; }; + export class UpdateBotPurchasedPaidMedia extends VirtualClass<{ + userId: long; + payload: string; + qts: int; + }> { + userId: long; + payload: string; + qts: int; + }; + export class UpdatePaidReactionPrivacy extends VirtualClass<{ + private: Bool; + }> { + private: Bool; + }; export class UpdatesTooLong extends VirtualClass {}; export class UpdateShortMessage extends VirtualClass<{ // flags: undefined; @@ -6990,6 +7039,13 @@ namespace Api { }> { newValue: Bool; }; + export class ChannelAdminLogEventActionParticipantSubExtend extends VirtualClass<{ + prevParticipant: Api.TypeChannelParticipant; + newParticipant: Api.TypeChannelParticipant; + }> { + prevParticipant: Api.TypeChannelParticipant; + newParticipant: Api.TypeChannelParticipant; + }; export class ChannelAdminLogEvent extends VirtualClass<{ id: long; date: int; @@ -7021,6 +7077,7 @@ namespace Api { invites?: true; send?: true; forums?: true; + subExtend?: true; } | void> { // flags: undefined; join?: true; @@ -7041,6 +7098,7 @@ namespace Api { invites?: true; send?: true; forums?: true; + subExtend?: true; }; export class PopularContact extends VirtualClass<{ clientId: long; @@ -8831,6 +8889,35 @@ namespace Api { currency: string; amount: long; }; + export class InputStorePaymentStarsGiveaway extends VirtualClass<{ + // flags: undefined; + onlyNewSubscribers?: true; + winnersAreVisible?: true; + stars: long; + boostPeer: Api.TypeInputPeer; + additionalPeers?: Api.TypeInputPeer[]; + countriesIso2?: string[]; + prizeDescription?: string; + randomId: long; + untilDate: int; + currency: string; + amount: long; + users: int; + }> { + // flags: undefined; + onlyNewSubscribers?: true; + winnersAreVisible?: true; + stars: long; + boostPeer: Api.TypeInputPeer; + additionalPeers?: Api.TypeInputPeer[]; + countriesIso2?: string[]; + prizeDescription?: string; + randomId: long; + untilDate: int; + currency: string; + amount: long; + users: int; + }; export class PremiumGiftOption extends VirtualClass<{ // flags: undefined; months: int; @@ -9530,6 +9617,19 @@ namespace Api { quantity: int; date: int; }; + export class PrepaidStarsGiveaway extends VirtualClass<{ + id: long; + stars: long; + quantity: int; + boosts: int; + date: int; + }> { + id: long; + stars: long; + quantity: int; + boosts: int; + date: int; + }; export class Boost extends VirtualClass<{ // flags: undefined; gift?: true; @@ -9542,6 +9642,7 @@ namespace Api { expires: int; usedGiftSlug?: string; multiplier?: int; + stars?: long; }> { // flags: undefined; gift?: true; @@ -9554,6 +9655,7 @@ namespace Api { expires: int; usedGiftSlug?: string; multiplier?: int; + stars?: long; }; export class MyBoost extends VirtualClass<{ // flags: undefined; @@ -10079,10 +10181,14 @@ namespace Api { showPreviews: Bool; }; export class BroadcastRevenueBalances extends VirtualClass<{ + // flags: undefined; + withdrawalEnabled?: true; currentBalance: long; availableBalance: long; overallRevenue: long; }> { + // flags: undefined; + withdrawalEnabled?: true; currentBalance: long; availableBalance: long; overallRevenue: long; @@ -10163,6 +10269,7 @@ namespace Api { msgId?: int; extendedMedia?: Api.TypeMessageMedia[]; subscriptionPeriod?: int; + giveawayPostId?: int; }> { // flags: undefined; refund?: true; @@ -10183,6 +10290,7 @@ namespace Api { msgId?: int; extendedMedia?: Api.TypeMessageMedia[]; subscriptionPeriod?: int; + giveawayPostId?: int; }; export class FoundStory extends VirtualClass<{ peer: Api.TypePeer; @@ -10293,6 +10401,38 @@ namespace Api { peerId?: Api.TypePeer; count: int; }; + export class StarsGiveawayOption extends VirtualClass<{ + // flags: undefined; + extended?: true; + default?: true; + stars: long; + yearlyBoosts: int; + storeProduct?: string; + currency: string; + amount: long; + winners: Api.TypeStarsGiveawayWinnersOption[]; + }> { + // flags: undefined; + extended?: true; + default?: true; + stars: long; + yearlyBoosts: int; + storeProduct?: string; + currency: string; + amount: long; + winners: Api.TypeStarsGiveawayWinnersOption[]; + }; + export class StarsGiveawayWinnersOption extends VirtualClass<{ + // flags: undefined; + default?: true; + users: int; + perUserStars: long; + }> { + // flags: undefined; + default?: true; + users: int; + perUserStars: long; + }; export class ResPQ extends VirtualClass<{ nonce: int128; serverNonce: int128; @@ -12520,18 +12660,20 @@ namespace Api { refunded?: true; startDate: int; giftCodeSlug?: string; + starsPrize?: long; finishDate: int; winnersCount: int; - activatedCount: int; + activatedCount?: int; }> { // flags: undefined; winner?: true; refunded?: true; startDate: int; giftCodeSlug?: string; + starsPrize?: long; finishDate: int; winnersCount: int; - activatedCount: int; + activatedCount?: int; }; export class StarsStatus extends VirtualClass<{ // flags: undefined; @@ -16451,18 +16593,18 @@ namespace Api { }; export class SendPaidReaction extends Request, Api.TypeUpdates> { // flags: undefined; - private?: true; peer: Api.TypeInputPeer; msgId: int; count: int; randomId: long; + private?: Bool; }; export class TogglePaidReactionPrivacy extends Request {}; } export namespace updates { @@ -17700,6 +17843,7 @@ namespace Api { peer: Api.TypeInputPeer; subscriptionId: string; }; + export class GetStarsGiveawayOptions extends Request {}; } export namespace stickers { @@ -18639,14 +18783,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.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 | 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.ViewSponsoredMessage | channels.GetSponsoredMessages | 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.ClickSponsoredMessage | channels.UpdateColor | channels.ToggleViewForumAsMessages | channels.GetChannelRecommendations | channels.UpdateEmojiStatus | channels.SetBoostsToUnblockRestrictions | channels.SetEmojiStickers | channels.ReportSponsoredMessage | 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 - | 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.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 | 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 7cc22251c..de2263687 100644 --- a/src/lib/gramjs/tl/apiTl.js +++ b/src/lib/gramjs/tl/apiTl.js @@ -36,7 +36,7 @@ inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector s inputMediaDice#e66fbf7b emoticon:string = InputMedia; inputMediaStory#89fdd778 peer:InputPeer id:int = InputMedia; inputMediaWebPage#c21b8849 flags:# force_large_media:flags.0?true force_small_media:flags.1?true optional:flags.2?true url:string = InputMedia; -inputMediaPaidMedia#aa661fc3 stars_amount:long extended_media:Vector = InputMedia; +inputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector payload:flags.0?string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#bdcdaec0 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.3?VideoSize = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; @@ -108,8 +108,8 @@ messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; -messageMediaGiveaway#daad85b0 flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector countries_iso2:flags.1?Vector prize_description:flags.3?string quantity:int months:int until_date:int = MessageMedia; -messageMediaGiveawayResults#c6991068 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector months:int prize_description:flags.1?string until_date:int = MessageMedia; +messageMediaGiveaway#aa073beb flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector countries_iso2:flags.1?Vector prize_description:flags.3?string quantity:int months:flags.4?int stars:flags.5?long until_date:int = MessageMedia; +messageMediaGiveawayResults#ceaa3ea1 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector months:flags.4?int stars:flags.5?long prize_description:flags.1?string until_date:int = MessageMedia; messageMediaPaidMedia#a8852491 stars_amount:long extended_media:Vector = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#bd47cbad title:string users:Vector = MessageAction; @@ -150,12 +150,13 @@ messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAction; messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; -messageActionGiveawayLaunch#332ba9ed = MessageAction; -messageActionGiveawayResults#2a9fadc5 winners_count:int unclaimed_count:int = MessageAction; +messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; +messageActionGiveawayResults#87e2f155 flags:# stars:flags.0?true winners_count:int unclaimed_count:int = MessageAction; messageActionBoostApply#cc02aa6d boosts:int = MessageAction; messageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector = MessageAction; messageActionPaymentRefunded#41b3e202 flags:# peer:Peer currency:string total_amount:long payload:flags.0?bytes charge:PaymentCharge = MessageAction; messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long crypto_currency:flags.0?string crypto_amount:flags.0?long transaction_id:flags.1?string = MessageAction; +messageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction; dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; photoEmpty#2331b22d id:long = Photo; @@ -369,6 +370,8 @@ updateBroadcastRevenueTransactions#dfd961f5 peer:Peer balances:BroadcastRevenueB updateStarsBalance#fb85198 balance:long = 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; 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; @@ -830,9 +833,10 @@ channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_valu channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; channelAdminLogEventActionChangeEmojiStickerSet#46d840ab prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatureProfiles#60a79c79 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantSubExtend#64642db3 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; -channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true = ChannelAdminLogEventsFilter; +channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; messages.favedStickers#2cb51097 hash:long packs:Vector stickers:Vector = messages.FavedStickers; @@ -1117,6 +1121,7 @@ inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_ inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; inputStorePaymentStarsTopup#dddd0f56 stars:long currency:string amount:long = InputStorePaymentPurpose; inputStorePaymentStarsGift#1d741ef7 user_id:InputUser stars:long currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentStarsGiveaway#751f08fa flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true stars:long boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long users:int = InputStorePaymentPurpose; premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption; paymentFormMethod#88f8f21b url:string title:string = PaymentFormMethod; emojiStatusEmpty#2de11aae = EmojiStatus; @@ -1218,9 +1223,10 @@ messages.webPage#fd5e12bd webpage:WebPage chats:Vector users:Vector premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption; payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo; -payments.giveawayInfoResults#cd5570 flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.0?string finish_date:int winners_count:int activated_count:int = payments.GiveawayInfo; +payments.giveawayInfoResults#e175e66f flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.3?string stars_prize:flags.4?long finish_date:int winners_count:int activated_count:flags.2?int = payments.GiveawayInfo; prepaidGiveaway#b2539d54 id:long months:int quantity:int date:int = PrepaidGiveaway; -boost#2a1c8c71 flags:# gift:flags.1?true giveaway:flags.2?true unclaimed:flags.3?true id:string user_id:flags.0?long giveaway_msg_id:flags.2?int date:int expires:int used_gift_slug:flags.4?string multiplier:flags.5?int = Boost; +prepaidStarsGiveaway#9a9d77e0 id:long stars:long quantity:int boosts:int date:int = PrepaidGiveaway; +boost#4b3e14d6 flags:# gift:flags.1?true giveaway:flags.2?true unclaimed:flags.3?true id:string user_id:flags.0?long giveaway_msg_id:flags.2?int date:int expires:int used_gift_slug:flags.4?string multiplier:flags.5?int stars:flags.6?long = Boost; premium.boostsList#86f8613c flags:# count:int boosts:Vector next_offset:flags.0?string users:Vector = premium.BoostsList; myBoost#c448415c flags:# slot:int peer:flags.0?Peer date:int expires:int cooldown_until_date:flags.1?int = MyBoost; premium.myBoosts#9ae228e2 my_boosts:Vector chats:Vector users:Vector = premium.MyBoosts; @@ -1310,7 +1316,7 @@ stats.broadcastRevenueTransactions#87158466 count:int transactions:Vector documents:Vector = messages.AvailableEffects; @@ -1323,7 +1329,7 @@ starsTransactionPeerFragment#e92fd902 = StarsTransactionPeer; starsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer; starsTransactionPeerAds#60682812 = StarsTransactionPeer; starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#433aeb2b 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 = StarsTransaction; +starsTransaction#ee7522d5 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int = StarsTransaction; payments.starsStatus#bbfa316c flags:# balance:long subscriptions:flags.1?Vector subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; foundStory#e87acbc0 peer:Peer story:StoryItem = FoundStory; stories.foundStories#e2de7737 flags:# count:int stories:Vector next_offset:flags.0?string chats:Vector users:Vector = stories.FoundStories; @@ -1340,6 +1346,8 @@ bots.previewInfo#ca71d64 media:Vector lang_codes:Vector starsSubscriptionPricing#5416d58 period:int amount:long = StarsSubscriptionPricing; starsSubscription#538ecf18 flags:# canceled:flags.0?true can_refulfill:flags.1?true missing_balance:flags.2?true id:string peer:Peer until_date:int pricing:StarsSubscriptionPricing chat_invite_hash:flags.3?string = StarsSubscription; messageReactor#4ba3a95a flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer count:int = MessageReactor; +starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true stars:long yearly_boosts:int store_product:flags.2?string currency:string amount:long winners:Vector = StarsGiveawayOption; +starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; ---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; @@ -1643,6 +1651,7 @@ payments.sendStarsForm#2bb731d flags:# form_id:long invoice:InputInvoice = payme payments.refundStarsCharge#25ae8f4a user_id:InputUser charge_id:string = Updates; payments.getStarsTransactionsByID#27842d2e peer:InputPeer id:Vector = payments.StarsStatus; payments.getStarsGiftOptions#d3c96bc8 flags:# user_id:flags.0?InputUser = Vector; +payments.getStarsGiveawayOptions#bd1efd3e = Vector; phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; diff --git a/src/lib/gramjs/tl/static/api.json b/src/lib/gramjs/tl/static/api.json index 941bf479d..3a0fd0680 100644 --- a/src/lib/gramjs/tl/static/api.json +++ b/src/lib/gramjs/tl/static/api.json @@ -368,6 +368,7 @@ "payments.getStarsTransactionsByID", "payments.sendStarsForm", "payments.getStarsGiftOptions", + "payments.getStarsGiveawayOptions", "payments.refundStarsCharge", "payments.getStarsGiftOptions", "fragment.getCollectibleInfo" diff --git a/src/lib/gramjs/tl/static/api.tl b/src/lib/gramjs/tl/static/api.tl index 43eb16b94..3fa1380f9 100644 --- a/src/lib/gramjs/tl/static/api.tl +++ b/src/lib/gramjs/tl/static/api.tl @@ -45,7 +45,7 @@ inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector s inputMediaDice#e66fbf7b emoticon:string = InputMedia; inputMediaStory#89fdd778 peer:InputPeer id:int = InputMedia; inputMediaWebPage#c21b8849 flags:# force_large_media:flags.0?true force_small_media:flags.1?true optional:flags.2?true url:string = InputMedia; -inputMediaPaidMedia#aa661fc3 stars_amount:long extended_media:Vector = InputMedia; +inputMediaPaidMedia#c4103386 flags:# stars_amount:long extended_media:Vector payload:flags.0?string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#bdcdaec0 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.3?VideoSize = InputChatPhoto; @@ -133,8 +133,8 @@ messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; -messageMediaGiveaway#daad85b0 flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector countries_iso2:flags.1?Vector prize_description:flags.3?string quantity:int months:int until_date:int = MessageMedia; -messageMediaGiveawayResults#c6991068 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector months:int prize_description:flags.1?string until_date:int = MessageMedia; +messageMediaGiveaway#aa073beb flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector countries_iso2:flags.1?Vector prize_description:flags.3?string quantity:int months:flags.4?int stars:flags.5?long until_date:int = MessageMedia; +messageMediaGiveawayResults#ceaa3ea1 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector months:flags.4?int stars:flags.5?long prize_description:flags.1?string until_date:int = MessageMedia; messageMediaPaidMedia#a8852491 stars_amount:long extended_media:Vector = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; @@ -176,12 +176,13 @@ messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAction; messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; -messageActionGiveawayLaunch#332ba9ed = MessageAction; -messageActionGiveawayResults#2a9fadc5 winners_count:int unclaimed_count:int = MessageAction; +messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction; +messageActionGiveawayResults#87e2f155 flags:# stars:flags.0?true winners_count:int unclaimed_count:int = MessageAction; messageActionBoostApply#cc02aa6d boosts:int = MessageAction; messageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector = MessageAction; messageActionPaymentRefunded#41b3e202 flags:# peer:Peer currency:string total_amount:long payload:flags.0?bytes charge:PaymentCharge = MessageAction; messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long crypto_currency:flags.0?string crypto_amount:flags.0?long transaction_id:flags.1?string = MessageAction; +messageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction; dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -422,6 +423,8 @@ updateBroadcastRevenueTransactions#dfd961f5 peer:Peer balances:BroadcastRevenueB updateStarsBalance#fb85198 balance:long = 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; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -1013,12 +1016,13 @@ channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_valu channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; channelAdminLogEventActionChangeEmojiStickerSet#46d840ab prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatureProfiles#60a79c79 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantSubExtend#64642db3 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; -channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true = ChannelAdminLogEventsFilter; +channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true sub_extend:flags.18?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; @@ -1472,6 +1476,7 @@ inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_ inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; inputStorePaymentStarsTopup#dddd0f56 stars:long currency:string amount:long = InputStorePaymentPurpose; inputStorePaymentStarsGift#1d741ef7 user_id:InputUser stars:long currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentStarsGiveaway#751f08fa flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true stars:long boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long users:int = InputStorePaymentPurpose; premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption; @@ -1633,11 +1638,12 @@ premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags. payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo; -payments.giveawayInfoResults#cd5570 flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.0?string finish_date:int winners_count:int activated_count:int = payments.GiveawayInfo; +payments.giveawayInfoResults#e175e66f flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.3?string stars_prize:flags.4?long finish_date:int winners_count:int activated_count:flags.2?int = payments.GiveawayInfo; prepaidGiveaway#b2539d54 id:long months:int quantity:int date:int = PrepaidGiveaway; +prepaidStarsGiveaway#9a9d77e0 id:long stars:long quantity:int boosts:int date:int = PrepaidGiveaway; -boost#2a1c8c71 flags:# gift:flags.1?true giveaway:flags.2?true unclaimed:flags.3?true id:string user_id:flags.0?long giveaway_msg_id:flags.2?int date:int expires:int used_gift_slug:flags.4?string multiplier:flags.5?int = Boost; +boost#4b3e14d6 flags:# gift:flags.1?true giveaway:flags.2?true unclaimed:flags.3?true id:string user_id:flags.0?long giveaway_msg_id:flags.2?int date:int expires:int used_gift_slug:flags.4?string multiplier:flags.5?int stars:flags.6?long = Boost; premium.boostsList#86f8613c flags:# count:int boosts:Vector next_offset:flags.0?string users:Vector = premium.BoostsList; @@ -1795,7 +1801,7 @@ reactionNotificationsFromAll#4b9e22a0 = ReactionNotificationsFrom; reactionsNotifySettings#56e34970 flags:# messages_notify_from:flags.0?ReactionNotificationsFrom stories_notify_from:flags.1?ReactionNotificationsFrom sound:NotificationSound show_previews:Bool = ReactionsNotifySettings; -broadcastRevenueBalances#8438f1c6 current_balance:long available_balance:long overall_revenue:long = BroadcastRevenueBalances; +broadcastRevenueBalances#c3ff71e7 flags:# withdrawal_enabled:flags.0?true current_balance:long available_balance:long overall_revenue:long = BroadcastRevenueBalances; availableEffect#93c3e27e flags:# premium_required:flags.2?true id:long emoticon:string static_icon_id:flags.0?long effect_sticker_id:long effect_animation_id:flags.1?long = AvailableEffect; @@ -1814,7 +1820,7 @@ starsTransactionPeerAds#60682812 = StarsTransactionPeer; starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; -starsTransaction#433aeb2b 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 = StarsTransaction; +starsTransaction#ee7522d5 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector subscription_period:flags.12?int giveaway_post_id:flags.13?int = StarsTransaction; 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; @@ -1848,6 +1854,10 @@ starsSubscription#538ecf18 flags:# canceled:flags.0?true can_refulfill:flags.1?t messageReactor#4ba3a95a flags:# top:flags.0?true my:flags.1?true anonymous:flags.2?true peer_id:flags.3?Peer count:int = MessageReactor; +starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true stars:long yearly_boosts:int store_product:flags.2?string currency:string amount:long winners:Vector = StarsGiveawayOption; + +starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -2244,8 +2254,9 @@ messages.editFactCheck#589ee75 peer:InputPeer msg_id:int text:TextWithEntities = messages.deleteFactCheck#d1da940c peer:InputPeer msg_id:int = Updates; messages.getFactCheck#b9cdc5ee peer:InputPeer msg_id:Vector = Vector; messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; -messages.sendPaidReaction#25c8fe3e flags:# private:flags.0?true peer:InputPeer msg_id:int count:int random_id:long = Updates; +messages.sendPaidReaction#9dd6a67b flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?Bool = Updates; messages.togglePaidReactionPrivacy#849ad397 peer:InputPeer msg_id:int private:Bool = Bool; +messages.getPaidReactionPrivacy#472455aa = Updates; 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; @@ -2411,6 +2422,7 @@ payments.getStarsGiftOptions#d3c96bc8 flags:# user_id:flags.0?InputUser = Vector payments.getStarsSubscriptions#32512c5 flags:# missing_balance:flags.0?true peer:InputPeer offset:string = payments.StarsStatus; payments.changeStarsSubscription#c7770878 flags:# peer:InputPeer subscription_id:string canceled:flags.0?Bool = Bool; payments.fulfillStarsSubscription#cc5bebb3 peer:InputPeer subscription_id:string = Bool; +payments.getStarsGiveawayOptions#bd1efd3e = Vector; 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/index.ts b/src/types/index.ts index 5740c4749..8b1709b88 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -514,14 +514,16 @@ export type InlineBotSettings = { }; export type CustomPeerType = 'premium' | 'toBeDistributed' | 'contacts' | 'nonContacts' -| 'groups' | 'channels' | 'bots' | 'excludeMuted' | 'excludeArchived' | 'excludeRead'; +| 'groups' | 'channels' | 'bots' | 'excludeMuted' | 'excludeArchived' | 'excludeRead' | 'stars'; export interface CustomPeer { isCustomPeer: true; + key?: string | number; titleKey: string; subtitleKey?: string; avatarIcon: IconName; isAvatarSquare?: boolean; + titleValue?: number; peerColorId?: number; customPeerAvatarColor?: string; withPremiumGradient?: boolean; diff --git a/src/types/language.d.ts b/src/types/language.d.ts index b6c3d679e..8f04f95d6 100644 --- a/src/types/language.d.ts +++ b/src/types/language.d.ts @@ -1539,6 +1539,9 @@ export interface LangPair { 'GiftStarsOutgoing': { 'user': string | number; }; + 'PrizeCredits': { + 'count': string | number; + }; } export type LangKey = keyof LangPair; diff --git a/src/util/objects/customPeer.ts b/src/util/objects/customPeer.ts index 5f058af27..287c6677c 100644 --- a/src/util/objects/customPeer.ts +++ b/src/util/objects/customPeer.ts @@ -18,6 +18,14 @@ export const CUSTOM_PEER_TO_BE_DISTRIBUTED: UniqueCustomPeer = { withPremiumGradient: true, }; +export const CUSTOM_PEER_STAR: UniqueCustomPeer = { + isCustomPeer: true, + type: 'stars', + titleKey: 'Stars', + avatarIcon: 'star', + peerColorId: 1, +}; + export const CUSTOM_PEER_INCLUDED_CHAT_TYPES: UniqueCustomPeer[] = [ { isCustomPeer: true,