Answer the question
In order to leave comments, you need to log in
Is it possible to receive data from the child in other ways?
I run fork
this.bot= child_process.fork(__dirname + '\\..\\bot\\src\\mainChild.js', [ jsonString ]);
async stopBot(username: string) {
const res = await this.bot.send({
query: 'deleteUser',
deleteUser: { username }
})
}
// Как получить ответ функции внутри дочернего процесса в переменной res?
interface Message {
query: 'addUser' | 'deleteUser',
addUser?: AddUser,
findUserForServer?: FindUserForServer,
deleteUser?: DeleteUser
}
const bot = new Bot(JSON.parse(process.argv[2]) as Options)
process.on('message', async (message: Message) => {
if (message.query === 'deleteUser') {
if (message.deleteUser)
return await bot .deleteUser(message.deleteUser.username)
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question