const https = require('https');
const querystring = require('querystring');

const request = (host, path, data) => new Promise((resolve, reject) => {
  const qs = querystring.stringify(data);

  const req = https.request(
    {
      host,
      path: path + '?' + qs
    },
    res => {
      let content = '';
      res.setEncoding('utf8');
      res.on('data', chunk => content += chunk);
      res.on('end', () => resolve(JSON.parse(content)), console.log(content));
    }
  );

  req.on('error', reject);
  req.end();
});

module.exports = class Api {
  constructor(telegram_key) {
    this.telegram_key = telegram_key;
    this.hostname = 'api.telegram.org';
  }
  getUpdates(offset = 0) {
    return request(this.hostname, `/bot${this.telegram_key}/getupdates`, {
      offset
    });
  }
  sendMessage(chat_id, text) {
    return request(this.hostname, `/bot${this.telegram_key}/sendMessage`, {
      chat_id,
      text
    });
  }
};

@@ -799,16 +799,20 @@
 send
+Full
 Message(
 chat
@@ -811,21 +811,15 @@
 age(
-chat_id, text
+message
 ) %7B%0A
@@ -829,32 +829,39 @@
  return request(
+%0A      
 this.hostname, %60
@@ -850,32 +850,38 @@
   this.hostname,
+%0A     
  %60/bot$%7Bthis.tel
@@ -908,40 +908,107 @@
 ge%60,
- %7B%0A      chat_id,%0A     
+%0A      message%0A    );%0A  %7D%0A  sendMessage(chat_id, text) %7B%0A    return sendFullMessage(%7B chat_id,
  text
-%0A   
  %7D);

add method to send fullMessage