add tg support for largefetch

This commit is contained in:
2020-05-11 16:27:29 +02:00
parent 8939cd994a
commit bb23fa6bb2
4 changed files with 609 additions and 3 deletions

View File

@@ -1,12 +1,22 @@
const fetch = require("node-fetch");
var mysql = require('mysql');
const TelegramBot = require('node-telegram-bot-api');
const simCo = require('./simco-credentials');
const tgInfo = require('./telegram-credentials');
if (!simCo.cookie || !tgInfo.token) {
console.error("ERR: credentials not set.")
return;
}
var connection = mysql.createConnection({
host: 'localhost',
user: 'simcompanies',
password: '',
database: 'simcompanies'
});
const simCo = require('./simco-credentials');
const tgBot = new TelegramBot(tgInfo.token, { polling: false });
bot.sendMessage(tgInfo.debugChat, 'INF: started polling resource prices.');
const exchangeAPI = "https://www.simcompanies.com/api/market/";
const resourceAPI = "https://www.simcompanies.com/api/v3/en/encyclopedia/resources/";
@@ -76,6 +86,7 @@ const storeFullData = async marketData => {
}
});
});
bot.sendMessage(tgInfo.debugChat, 'INF: successfully stored new prices.');
}
storeFullData(getFullData());