feat(core): support new message actions

This commit is contained in:
alina 🌸 2024-02-19 20:45:53 +03:00
parent 8460cc3ade
commit 2d01b38e95
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -404,6 +404,38 @@ export interface ActionWallpaperChanged {
wallpaper: tl.TypeWallPaper wallpaper: tl.TypeWallPaper
} }
/** A Telergam Premium gift code was received */
export interface ActionGiftCode {
readonly type: 'gift_code'
/** Information about the gift code */
raw: tl.RawMessageActionGiftCode
}
/** A Telergam Premium giveaway was started */
export interface ActionGiveawayStarted {
readonly type: 'giveaway_started'
}
/** A Telergam Premium giveaway was ended and results are available */
export interface ActionGiveawayEnded {
readonly type: 'giveaway_ended'
/** Number of winners in the giveaway */
winners: number
/** Number of undistributed prizes */
undistributed: number
}
/** Boosts were applied to the group */
export interface ActionBoostApply {
readonly type: 'boost_apply'
/** Number of boosts applied */
count: number
}
export type MessageAction = export type MessageAction =
| ActionChatCreated | ActionChatCreated
| ActionChannelCreated | ActionChannelCreated
@ -442,6 +474,10 @@ export type MessageAction =
| ActionPhotoSuggested | ActionPhotoSuggested
| ActionPeerChosen | ActionPeerChosen
| ActionWallpaperChanged | ActionWallpaperChanged
| ActionGiftCode
| ActionGiveawayStarted
| ActionGiveawayEnded
| ActionBoostApply
| null | null
/** @internal */ /** @internal */
@ -673,6 +709,26 @@ export function _messageActionFromTl(this: Message, act: tl.TypeMessageAction):
forBoth: act.forBoth!, forBoth: act.forBoth!,
wallpaper: act.wallpaper, wallpaper: act.wallpaper,
} }
case 'messageActionGiftCode':
return {
type: 'gift_code',
raw: act,
}
case 'messageActionGiveawayLaunch':
return {
type: 'giveaway_started',
}
case 'messageActionGiveawayResults':
return {
type: 'giveaway_ended',
winners: act.winnersCount,
undistributed: act.unclaimedCount,
}
case 'messageActionBoostApply':
return {
type: 'boost_apply',
count: act.boosts,
}
default: default:
return null return null
} }