import { Api } from 'telegram' ; import { Chat } from './Chat' ; import { From } from './From' ; import { Snake } from '../client' ; export class ForwardMessage { imported ? : boolean ; from ! : From ; fromName ? : string ; date ! : number | Date ; channelPost ? : number ; postAuthor ? : string ; savedFromChat ? : Chat ; savedFromMsgId ? : number ; psaType ? : string ; constructor ( ) { } async init ( forwardHeader , snakeClient ) { this . imported = forwardHeader . imported ; this . fromName = forwardHeader . fromName ; this . date = forwardHeader . date ; this . channelPost = forwardHeader . channelPost ; this . postAuthor = forwardHeader . postAuthor ; this . savedFromMsgId = forwardHeader . savedFromMsgId ; this . psaType = forwardHeader . psaType ; if ( forwardHeader . fromId ) { let from = new From ( ) ; await from . init ( forwardHeader . fromId , snakeClient ) ; this . from = from ; } if ( forwardHeader . savedFromPeer ) { let chat = new Chat ( ) ; await chat . init ( forwardHeader . savedFromPeer , snakeClient ) ; this . savedFromChat = chat ; } return this ; } }