James58899 says to YSITD
var request = require('request'); var request = require('request'); var EventEmitter = require("events").EventEmitter; | var EventEmitter = require('events').EventEmitter; var util = require("util"); | var util = require('util') function TGBOT (options) { | function TelegramAPI (token) { EventEmitter.call(this); EventEmitter.call(this); > this.pollingEnabled = false; this.token = options.token; | this.token = token; this.timeout = options.timeout || 40; < < this.lastOffset = null; this.lastOffset = null; > this.pollCount = 0; > > this.pollingTimeout = null; > this.pollingTimeoutId = null; > > this.currentPollRequest = null; > // this.debug(); } } util.inherits(TGBOT, EventEmitter); | util.inherits(TelegramAPI, EventEmitter); TGBOT.prototype.start = function(){ | TelegramAPI.prototype.debug = function () { this.getUpdates(40,null); | function log() { }; | console.log('polling at: ' + self.lastOffset + ', cou | } TGBOT.prototype.getUpdates = function(timeout,offset){ < var self = this; var self = this; > log(); > setInterval(log, 10 * 60 * 1000) > } > TelegramAPI.prototype.startPolling = function (timeout) { > timeout = timeout == null ? 40 : timeout;