-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
73 lines (59 loc) · 1.53 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const Composer = require('telegraf/composer');
const session = require('telegraf/session');
// const { PythonShell } = require('python-shell');
// let ps = new PythonShell('main.py');
require('dotenv').config();
const { getTop10List, getPriceOfTopCoins } = require('./src/topCoins');
const priceHistoryOf = require('./src/priceHistory');
const {
coinListForPrice,
morePriceList,
getPriceOfChoosedCoin,
} = require('./src/price');
const {
moreWatchList,
myWatchList,
startWatchingCoin,
stopWatchingCoin,
toWatchList,
} = require('./src/watchCoin');
const { priceArr, watchArr } = require('./src/coinListArr');
const startBot = require('./src/start');
//keys
const API_KEY = process.env.API_KEY;
let top10Coins = [];
let scale = 5;
let symbol;
let followList = {};
let shouldStop = false;
const bot = new Composer();
bot.use(session());
// ps.send('BTC-USD');
// ps.on('message', (msg) => {
// console.log(msg);
// });
// ps.end(function (err) {
// if (err) {
// console.log('error');
// } else {
// console.log('success.');
// }
// });
//start bot
startBot(bot);
//Price Section
coinListForPrice(bot);
morePriceList(bot);
getPriceOfChoosedCoin(bot, symbol, priceArr, API_KEY);
// toplist
getTop10List(bot, top10Coins, API_KEY);
getPriceOfTopCoins(bot, top10Coins, API_KEY);
//watching
toWatchList(bot);
moreWatchList(bot);
startWatchingCoin(bot, symbol, watchArr, followList, scale, API_KEY);
myWatchList(bot, followList);
stopWatchingCoin(bot, shouldStop, followList);
//history
priceHistoryOf(bot);
module.exports = bot;