import { Update } from './Update' ; import { Api } from 'telegram' ; import { Snake } from '../client' ; import { Telegram } from '../Telegram' ; import { MessageContext } from '../Context/MessageContext' ; export class UpdateNewMessage extends Update { message ! : MessageContext ; constructor ( ) { super ( ) ; this [ '_' ] = 'UpdateNewMessage' ; } async init ( update , SnakeClient ) { this . telegram = SnakeClient . telegram ; let message = new MessageContext ( ) ; if ( update . message instanceof Api . Message ) { await message . init ( update . message as Api . Message , SnakeClient ) ; } if ( update . message instanceof Api . MessageService ) { await message . init ( update . message as Api . MessageService , SnakeClient ) ; } this . message = message ; return this ; } }