feat(tl): updated to layer 187 (#69)
This commit is contained in:
parent
e58e62f649
commit
4bd57316a1
11 changed files with 86 additions and 3 deletions
|
@ -234,6 +234,7 @@ export async function _normalizeInputMedia(
|
|||
_: 'inputMediaPaidMedia',
|
||||
starsAmount: Long.isLong(media.starsAmount) ? media.starsAmount : Long.fromNumber(media.starsAmount),
|
||||
extendedMedia: medias,
|
||||
payload: media.payload,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -590,6 +590,11 @@ export interface InputMediaPaidMedia extends CaptionMixin {
|
|||
* Amount of stars that should be paid for the media
|
||||
*/
|
||||
starsAmount: number | tl.Long
|
||||
|
||||
/**
|
||||
* Custom payload (for bots only)
|
||||
*/
|
||||
payload?: string
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -497,6 +497,27 @@ export interface ActionStarsGifted {
|
|||
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 =
|
||||
| ActionChatCreated
|
||||
| ActionChannelCreated
|
||||
|
@ -542,6 +563,7 @@ export type MessageAction =
|
|||
| ActionBoostApply
|
||||
| ActionPaymentRefunded
|
||||
| ActionStarsGifted
|
||||
| ActionStarsPrize
|
||||
| null
|
||||
|
||||
/** @internal */
|
||||
|
@ -817,6 +839,15 @@ export function _messageActionFromTl(this: Message, act: tl.TypeMessageAction):
|
|||
stars: act.stars,
|
||||
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:
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -362,6 +362,16 @@ export interface ChatActionSignatureProfilesToggled {
|
|||
new: boolean
|
||||
}
|
||||
|
||||
export interface ChatActionSubscriptionExtended {
|
||||
type: 'sub_extend'
|
||||
|
||||
/** Previous participant information */
|
||||
prev: ChatMember
|
||||
|
||||
/** New participant information */
|
||||
new: ChatMember
|
||||
}
|
||||
|
||||
/** Chat event action (`null` if unsupported) */
|
||||
export type ChatAction =
|
||||
| ChatActionUserJoined
|
||||
|
@ -401,6 +411,7 @@ export type ChatAction =
|
|||
| ChatActionTopicEdited
|
||||
| ChatActionTopicDeleted
|
||||
| ChatActionSignatureProfilesToggled
|
||||
| ChatActionSubscriptionExtended
|
||||
| null
|
||||
|
||||
/** @internal */
|
||||
|
@ -627,6 +638,12 @@ export function _actionFromTl(e: tl.TypeChannelAdminLogEventAction, peers: Peers
|
|||
type: 'signature_profiles_toggled',
|
||||
new: e.newValue,
|
||||
}
|
||||
case 'channelAdminLogEventActionParticipantSubExtend':
|
||||
return {
|
||||
type: 'sub_extend',
|
||||
prev: new ChatMember(e.prevParticipant, peers),
|
||||
new: new ChatMember(e.newParticipant, peers),
|
||||
}
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -106,6 +106,14 @@ export function normalizeChatEventFilters(input: InputChatEventFilters): ChatEve
|
|||
case 'topic_deleted':
|
||||
serverFilter.forums = true
|
||||
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:
|
||||
assertNever(type)
|
||||
}
|
||||
|
|
|
@ -41,6 +41,11 @@ export class Boost {
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -106,6 +106,13 @@ export type StarsTransactionType =
|
|||
/** Period of the subscription, in seconds */
|
||||
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 {
|
||||
constructor(
|
||||
|
@ -186,6 +193,14 @@ export class StarsTransaction {
|
|||
case 'starsTransactionPeer': {
|
||||
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.reaction) {
|
||||
return {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -113,6 +113,7 @@
|
|||
"updateBotInlineSend": ["user_id"],
|
||||
"updateBotMenuButton": ["bot_id"],
|
||||
"updateBotPrecheckoutQuery": ["user_id"],
|
||||
"updateBotPurchasedPaidMedia": ["user_id"],
|
||||
"updateBotShippingQuery": ["user_id"],
|
||||
"updateBotStopped": ["user_id"],
|
||||
"updateBotChatInviteRequester": ["user_id"],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@mtcute/tl",
|
||||
"version": "186.0.0",
|
||||
"version": "187.0.0",
|
||||
"description": "TL schema used for mtcute",
|
||||
"author": "alina sireneva <alina@tei.su>",
|
||||
"license": "MIT",
|
||||
|
|
Loading…
Reference in a new issue