import { BotPersonality , DatabaseConnection } from "@creature-chess/data" ; import { LobbyPlayer } from "@creature-chess/models" ; export const getBots = async ( database , count ) => { const output = [ ] ; const bots = await database . bot . getLeastPlayedBots ( count ) ; for ( const { ref : { id } , data : { nickname , personality } } of bots ! ) { const picture = Math . floor ( Math . random ( ) * 20 ) + 1 ; const player = { id , name : `[BOT] ${ nickname }` , profile : { title : null , picture } } ; await database . bot . addGamePlayed ( id ) ; output . push ( { player , personality } ) ; } return output ; } ;