import { Api } from 'telegram' ; import { Update } from './Update' ; import { From } from '../Utils/From' ; import { Telegram } from '../Telegram' ; import { Snake } from '../client' ; export class UpdateUserStatus extends Update { user ! : From ; status ! : string ; constructor ( ) { super ( ) ; this [ '_' ] = 'UpdateUserStatus' ; } async init ( update , SnakeClient ) { this . telegram = SnakeClient . telegram ; if ( update . userId ) { let user = new From ( ) ; await user . init ( update . userId , SnakeClient ) ; this . user = user ; } if ( update . status ) { switch ( update . status . className ) { case 'UserStatusOnline' : this . status = 'online' ; break ; case 'UserStatusOffline' : this . status = 'offline' ; break ; case 'UserStatusRecently' : this . status = 'recently' ; break ; case 'UserStatusLastWeek' : this . status = 'withinWeek' ; break ; case 'UserStatusLastMonth' : this . status = 'withinMonth' ; break ; default : this . status = 'longTimeAgo' ; } } return this ; } }