diff --git a/src/index.ts b/src/index.ts index 5b7ca30..581c2c7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,20 +41,24 @@ const main = async () => { if (message.envelope.subject && message.envelope.subject.includes(MARK_STRING)) { let email = Buffer.from(message.source).toString() const parsed = await simpleParser(email) + //console.log('📌', chalk.cyan('Message:'), chalk.yellow(parsed.text)); let {title, groupName, subject, user, estimatedDate, estimatedTime} = parseMessage(parsed.text) - const estimated = (estimatedDate === undefined && estimatedTime === undefined) - ? `Время выполнения: не указано` - : `Время выполнения: ${estimatedDate} ${estimatedTime}` + console.log( + `📌 Новое обращение: ${title}`, '\n', + `Группа: ${groupName}`, '\n', + `${user}`, '\n', + `${subject}`, '\n', + `Время выполнения: ${estimatedDate} ${estimatedTime}`, '\n' + ) const preparedMessage = `📌 Новое обращение: ${title}\n` + `Группа: ${groupName}\n` + `${user}\n` + `${subject}\n` + - `Время выполнения: ${estimated}\n` - + `Время выполнения: ${estimatedDate} ${estimatedTime}\n` if (preparedMessage) { bot.telegram.sendMessage(process.env.TELEGRAM_GROUP_ID, preparedMessage)