fix: add docker, docker-compose

This commit is contained in:
2024-05-11 19:51:03 +03:00
parent 72d25fbefa
commit 902aa92dab
5 changed files with 194 additions and 4 deletions

View File

@@ -1,16 +1,19 @@
const chalk = require('chalk');
const {ImapFlow} = require('imapflow');
const simpleParser = require('mailparser').simpleParser
const {Telegraf} = require('telegraf');
require('dotenv').config()
const bot = new Telegraf(process.env.TELEGRAM_BOT_TOKEN);
const POLLING_TIMEOUT = 30
const MARK_STRING = 'test'
const MARK_STRING = process.env.MARK_STRING
const clientConfig = {
host: process.env.EMAIL_IMAP_SERVER,
port: 993,
port: process.env.EMAIL_IMAP_SERVER_PORT,
secure: true,
auth: {
user: process.env.EMAIL_ADDRESS,
@@ -38,6 +41,12 @@ const main = async () => {
const parsed = await simpleParser(email)
console.log('📌', chalk.cyan('Message:'), chalk.yellow(parsed.text));
if (parsed.text) {
bot.telegram.sendMessage(process.env.TELEGRAM_GROUP_ID, parsed.text)
.then()
.catch(console.error)
}
client.messageFlagsAdd(message.seq.toString(), ['\\Seen'])
.then((result: any) => console.log('📌', chalk.cyan(`Set seen flag for id-${message.seq}`), result))
.catch((error: any) => console.log(error))
@@ -58,3 +67,4 @@ const main = async () => {
setInterval(async () => {
main().then().catch(err => console.error(err));
}, POLLING_TIMEOUT * 1000)