import * as ms from 'ms' ; import * as signale from 'signale' ; import * as entryQuery from './db/entryQuery' ; import * as botController from './controllers/botController' ; import { wait } from '../client/utils' ; import config from './config' ; setInterval ( async ( ) => { try { const entries = await entryQuery . getNonBots ( ) ; for ( const entry of entries ) { try { await wait ( 10000 ) ; const members = await botController . getChatMembers ( entry . username ) ; await entryQuery . update ( entry . username , { members } , true ) ; } catch ( error ) { if ( config . is_dev ) signale . fatal ( error ) ; } } } catch ( error ) { if ( config . is_dev ) signale . fatal ( error ) ; } } , ms ( '24 hours' ) ) ;