import { Wechaty } from 'wechaty' ; import { CronJob } from 'cron' ; import { randomQuestion } from '../message/interview' ; export default async ( bot ) => { return new CronJob ( '0 9 * * *' , async ( ) => { const rooms = await bot . Room . findAll ( { topic : /前端面试|前端进阶/ } ) ; const q = await randomQuestion ( ) ; for ( const room of rooms ) { for ( const text of q ) { if ( room . owner ( ) . name ( ) . includes ( '山月' ) ) { await room . say ( text ) ; } } } } , null , true , 'Asia/Shanghai' ) ; } ;