feat(tl): updated to layer 187 (#69)

This commit is contained in:
alina sireneva 2024-09-07 07:30:35 -07:00 committed by GitHub
parent e58e62f649
commit 4bd57316a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 86 additions and 3 deletions

View file

@ -234,6 +234,7 @@ export async function _normalizeInputMedia(
_: 'inputMediaPaidMedia', _: 'inputMediaPaidMedia',
starsAmount: Long.isLong(media.starsAmount) ? media.starsAmount : Long.fromNumber(media.starsAmount), starsAmount: Long.isLong(media.starsAmount) ? media.starsAmount : Long.fromNumber(media.starsAmount),
extendedMedia: medias, extendedMedia: medias,
payload: media.payload,
} }
} }

View file

@ -590,6 +590,11 @@ export interface InputMediaPaidMedia extends CaptionMixin {
* Amount of stars that should be paid for the media * Amount of stars that should be paid for the media
*/ */
starsAmount: number | tl.Long starsAmount: number | tl.Long
/**
* Custom payload (for bots only)
*/
payload?: string
} }
/** /**

View file

@ -497,6 +497,27 @@ export interface ActionStarsGifted {
transactionId?: string transactionId?: string
} }
/**
* Telegram Stars were awarded in a giveaway
*/
export interface ActionStarsPrize {
readonly type: 'stars_prize'
/** Whether this prize was claimed yet */
claimed: boolean
/** Stars prize */
stars: tl.Long
/** Transaction ID */
transactionId: string
boostPeer: Peer
/** Message ID containing the giveaway */
giveawayMessageId: number
}
export type MessageAction = export type MessageAction =
| ActionChatCreated | ActionChatCreated
| ActionChannelCreated | ActionChannelCreated
@ -542,6 +563,7 @@ export type MessageAction =
| ActionBoostApply | ActionBoostApply
| ActionPaymentRefunded | ActionPaymentRefunded
| ActionStarsGifted | ActionStarsGifted
| ActionStarsPrize
| null | null
/** @internal */ /** @internal */
@ -817,6 +839,15 @@ export function _messageActionFromTl(this: Message, act: tl.TypeMessageAction):
stars: act.stars, stars: act.stars,
transactionId: act.transactionId, transactionId: act.transactionId,
} }
case 'messageActionPrizeStars':
return {
type: 'stars_prize',
claimed: !act.unclaimed,
stars: act.stars,
transactionId: act.transactionId,
boostPeer: parsePeer(act.boostPeer, this._peers),
giveawayMessageId: act.giveawayMsgId,
}
default: default:
return null return null
} }

View file

@ -362,6 +362,16 @@ export interface ChatActionSignatureProfilesToggled {
new: boolean new: boolean
} }
export interface ChatActionSubscriptionExtended {
type: 'sub_extend'
/** Previous participant information */
prev: ChatMember
/** New participant information */
new: ChatMember
}
/** Chat event action (`null` if unsupported) */ /** Chat event action (`null` if unsupported) */
export type ChatAction = export type ChatAction =
| ChatActionUserJoined | ChatActionUserJoined
@ -401,6 +411,7 @@ export type ChatAction =
| ChatActionTopicEdited | ChatActionTopicEdited
| ChatActionTopicDeleted | ChatActionTopicDeleted
| ChatActionSignatureProfilesToggled | ChatActionSignatureProfilesToggled
| ChatActionSubscriptionExtended
| null | null
/** @internal */ /** @internal */
@ -627,6 +638,12 @@ export function _actionFromTl(e: tl.TypeChannelAdminLogEventAction, peers: Peers
type: 'signature_profiles_toggled', type: 'signature_profiles_toggled',
new: e.newValue, new: e.newValue,
} }
case 'channelAdminLogEventActionParticipantSubExtend':
return {
type: 'sub_extend',
prev: new ChatMember(e.prevParticipant, peers),
new: new ChatMember(e.newParticipant, peers),
}
default: default:
return null return null
} }

View file

@ -106,6 +106,14 @@ export function normalizeChatEventFilters(input: InputChatEventFilters): ChatEve
case 'topic_deleted': case 'topic_deleted':
serverFilter.forums = true serverFilter.forums = true
break break
case 'sub_extend':
// not documented so idk, enable all
serverFilter.invite = true
serverFilter.invites = true
serverFilter.join = true
serverFilter.info = true
serverFilter.settings = true
break
default: default:
assertNever(type) assertNever(type)
} }

View file

@ -41,6 +41,11 @@ export class Boost {
return new Date(this.raw.date * 1000) return new Date(this.raw.date * 1000)
} }
/** Amount of Telegram Stars that were awarded along with this boost */
get stars(): tl.Long | null {
return this.raw.stars ?? null
}
/** /**
* Date when this boost will automatically expire. * Date when this boost will automatically expire.
* *

View file

@ -106,6 +106,13 @@ export type StarsTransactionType =
/** Period of the subscription, in seconds */ /** Period of the subscription, in seconds */
period: number period: number
} }
| {
type: 'giveaway'
/** Related peer */
peer: Peer
/** ID of the message containing the giveaway where the stars were given */
messageId: number
}
export class StarsTransaction { export class StarsTransaction {
constructor( constructor(
@ -186,6 +193,14 @@ export class StarsTransaction {
case 'starsTransactionPeer': { case 'starsTransactionPeer': {
const peer = parsePeer(this.raw.peer.peer, this.peers) const peer = parsePeer(this.raw.peer.peer, this.peers)
if (this.raw.giveawayPostId) {
return {
type: 'giveaway',
peer,
messageId: this.raw.giveawayPostId,
}
}
if (this.raw.msgId) { if (this.raw.msgId) {
if (this.raw.reaction) { if (this.raw.reaction) {
return { return {

View file

@ -2,7 +2,7 @@
TL schema and related utils used for mtcute. TL schema and related utils used for mtcute.
Generated from TL layer **186** (last updated on 18.08.2024). Generated from TL layer **187** (last updated on 07.09.2024).
## About ## About

File diff suppressed because one or more lines are too long

View file

@ -113,6 +113,7 @@
"updateBotInlineSend": ["user_id"], "updateBotInlineSend": ["user_id"],
"updateBotMenuButton": ["bot_id"], "updateBotMenuButton": ["bot_id"],
"updateBotPrecheckoutQuery": ["user_id"], "updateBotPrecheckoutQuery": ["user_id"],
"updateBotPurchasedPaidMedia": ["user_id"],
"updateBotShippingQuery": ["user_id"], "updateBotShippingQuery": ["user_id"],
"updateBotStopped": ["user_id"], "updateBotStopped": ["user_id"],
"updateBotChatInviteRequester": ["user_id"], "updateBotChatInviteRequester": ["user_id"],

View file

@ -1,6 +1,6 @@
{ {
"name": "@mtcute/tl", "name": "@mtcute/tl",
"version": "186.0.0", "version": "187.0.0",
"description": "TL schema used for mtcute", "description": "TL schema used for mtcute",
"author": "alina sireneva <alina@tei.su>", "author": "alina sireneva <alina@tei.su>",
"license": "MIT", "license": "MIT",