request.post(requestData, function (err, response, body) request.post(requestData, function (err, response, body)
// console.log(response); // console.log(response);
if (err || response.statusCode !== 200) { if (err || response.statusCode !== 200) {
return cb(err || new Error('unexpect response cod return cb(err || new Error('unexpect response cod
} }
try { try {
body = JSON.parse(body); | body = JSON.parse(body)
} catch (e) { } catch (e) {
return cb(e); | return cb(e)
} }
if (body.ok !== true) { if (body.ok !== true) {
return cb (new Error('response in not ok')); | return cb (new Error('respense in not ok'))
} }
cb(null, body.result); cb(null, body.result);
}); });
}; | }
| TelegramAPI.prototype.getMe = function getMe(cb) {
TGBOT.prototype.getMe = function getMe(cb) { <
return this._invoke('getMe', null , cb); return this._invoke('getMe', null , cb);
}; | }
| TelegramAPI.prototype.answerInlineQuery = function answerInli
TGBOT.prototype.sendMessage = function sendMessage(chat_id, t | if ('string' !== typeof results) {
> results = JSON.stringify(results)
> }
> return this._invoke('answerInlineQuery', {
> inline_query_id: id,
> results: results
> } , cb);
> }
> TelegramAPI.prototype.sendMessage = function sendMessage(chat
datas = typeof datas === "object" ? datas : {}; datas = typeof datas === "object" ? datas : {};
datas.chat_id = chat_id; datas.chat_id = chat_id;
datas.text = text; datas.text = text;
return this._invoke('sendMessage', datas , cb); return this._invoke('sendMessage', datas , cb);
}; | }
| TelegramAPI.prototype.getFile = function getFile(file_id, cb,
TGBOT.prototype.addCommand = function(cmd,cb,desc){ | datas = typeof datas === "object" ? datas : {};
| datas.file_id = file_id;
}; | return this._invoke('getFile', datas , cb);
| }
var OwO = new TGBOT({token:"171804881:AAEqhxbpKjXAZnfSzNC-QNP | TelegramAPI.prototype.sendChatAction = function sendChatActio
OwO.start(); | datas = typeof datas === "object" ? datas : {};