var TelegramBot = require('node-telegram-bot-api');
var getCurrency = require('./getCurrency');

// get from Heroku config variable
var token = process.env.token;
var channelID = process.env.channelID;
var port = process.env.PORT || 8443;
var host = process.env.HOST;

var webhook = {
	webHook: {
		port: port,
		host: host
	}
}

var bot = new TelegramBot(token, webhook);
var runCurrency = getCurrency(function(err, currency){
	return currency;
});

console.log('app start!');

// keep your server awake. run every 5 minutes.
setInterval(function(){
    console.log('Keep server awake.', runCurrency());
}, 5 * 60 * 1000);

// bot send message every hours.
setInterval(function(){
	bot.sendMessage(channelID, runCurrency());
}, 3600 * 1000);
@@ -370,26 +370,8 @@
 k);%0A
-var runCurrency = 
 getC
@@ -408,23 +408,28 @@
 )%7B%0A%09
-return 
+console.log(
 currency
 ;%0A%7D)
@@ -424,16 +424,17 @@
 currency
+)
 ;%0A%7D);%0A%0Ac
@@ -536,12 +536,48 @@
 ()%7B%0A
-    
+%09getCurrency(function(err, currency)%7B%0A%09%09
 cons
@@ -606,29 +606,29 @@
 wake.', 
-runC
+c
 urrency
-(
 )
+;%0A%09%7D
 );%0A%7D, 5 
@@ -699,16 +699,94 @@
 tion()%7B%0A
+%09getCurrency(function(err, currency)%7B%0A%09%09console.log('Keep server awake.', );%0A%09
 %09bot.sen
@@ -809,21 +809,21 @@
 ID, 
-runC
+c
 urrency
-(
 )
+;%0A%09%7D
 );%0A%7D

fix type error