Commit e2ec4a50 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent a7c831c1
......@@ -11,8 +11,6 @@ const TelegramBot = require('node-telegram-bot-api');
const token = process.env.DEBUG === 'true' ? process.env.LOCAL_TOKEN : process.env.SERVER_TOKEN;
cron.schedule('*/15 * * * *', () => {
runCron()
......@@ -20,13 +18,9 @@ cron.schedule('*/15 * * * *', () => {
});
const bot = new TelegramBot(token, {polling: true});
runCron()
bot.on('message', (msg) => {
console.log(msg)
processMessage(msg)
......@@ -373,8 +367,8 @@ async function generateText(current, num, msg) {
async function runCron() {
let admins=await db.getAllAdmins()
let name = './back/'+'backup-' + moment().format('YYYY-MM-DD---HH-mm')+'.sql'
let name = './back/' + 'backup-' + moment().format('YYYY-MM-DD---HH-mm') + '.sql'
const result = await mysqldump({
connection: {
host: '195.201.22.255',
......@@ -383,11 +377,7 @@ async function runCron() {
database: 'accounting',
}, dumpToFile: name,
});
for (let i=0;i<admins.length;i++)
{
bot.sendDocument(admins[i].teleid, name)
}
bot.sendDocument('-1001392333493', name)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment