abeya-tg-api 0.0.1-security → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of abeya-tg-api might be problematic. Click here for more details.

@@ -0,0 +1,28 @@
1
+ # Experimental
2
+
3
+ Experimental features are things we are trying out. We are **not** sure
4
+ if they'll become stable and move into the `master` branch.
5
+ Try them out and give feedback to support stabilizing them.
6
+
7
+ * [Features](#features)
8
+ * [API Reference][api-experimental]
9
+ * [Installation](#installation)
10
+
11
+
12
+ <a name="features"></a>
13
+ ## features:
14
+
15
+ * Support API method `deleteMessage`
16
+
17
+ Open issues tagged `experimental`: [link](https://github.com/yagop/node-telegram-bot-api/issues?q=is%3Apr+is%3Aopen+label%3Aexperimental)
18
+
19
+
20
+ <a name="installation"></a>
21
+ ## installation:
22
+
23
+ ```bash
24
+ $ npm install yagop/node-telegram-bot-api#experimental
25
+ ```
26
+
27
+
28
+ [api-experimental]:https://github.com/yagop/node-telegram-bot-api/tree/experimental/doc/api.md
package/doc/help.md ADDED
@@ -0,0 +1,151 @@
1
+ # Help Information
2
+
3
+ * [Common Pitfalls](#pitfalls)
4
+ * [FAQs](#faqs)
5
+
6
+ <a name="pitfalls"></a>
7
+ ## Common Pitfalls
8
+
9
+ <a name="reply-to-message"></a>
10
+ ### Failing to receive reply with `ReplyToMessage`
11
+
12
+ The user has to **manually reply** to your message, by tapping on the bot's message and select *Reply*.
13
+
14
+ Sources:
15
+
16
+ * Issue [#113](https://github.com/yagop/node-telegram-bot-api/issues/113)
17
+
18
+ <a name="faqs"></a>
19
+ ## Frequently Asked Questions
20
+
21
+ > Check out [all questions ever asked][questions] on our Github Issues.
22
+
23
+ 1. [How do I send GIFs?](#gifs)
24
+ 1. [Why and When do I need a certificate when using WebHooks?](#webhook-cert)
25
+ 1. [How do I know when a user leaves a chat?](#leave-chat)
26
+ 1. [What does this error mean?](#error-meanings)
27
+ 1. [How do I know the selected option in reply keyboard?](#reply-keyboard)
28
+ 1. [How do I send multiple message in correct sequence?](#ordered-sending)
29
+ 1. [How do I run my bot behind a proxy?](#proxy)
30
+ 1. [Can you add feature X to the library?](#new-feature)
31
+ 1. [Is this scalable?](#scalable)
32
+ 1. [How do I listen for messages in a chat group?](#messages-in-chat)
33
+ 1. [How do I know when a user blocks the bot?](#blocked-bot)
34
+
35
+ <a name="gifs"></a>
36
+ ### How do I send GIFs?
37
+
38
+ You might be trying to send your animated GIFs using *TelegramBot#sendPhoto()*.
39
+ The method mostly supports static images. As noted by the community,
40
+ it seems you need to send them as documents, using *TelegramBot#sendDocument()*.
41
+
42
+ ```js
43
+ bot.sendDocument(chatId, 'cat.gif');
44
+ ```
45
+
46
+ Sources:
47
+
48
+ * Issue [#11](https://github.com/yagop/node-telegram-bot-api/issues/11)
49
+
50
+ <a name="webhook-cert"></a>
51
+ ### Why and When do I need a certificate when using WebHooks?
52
+
53
+ *Not done. PRs welcome!*
54
+
55
+ Sources:
56
+
57
+ * Issue [#63](https://github.com/yagop/node-telegram-bot-api/issues/63)
58
+ * Issue [#125](https://github.com/yagop/node-telegram-bot-api/issues/125)
59
+
60
+ <a name="leave-chat"></a>
61
+ ### How do I know when a user leaves a chat?
62
+
63
+ *Not done. PRs welcome!*
64
+
65
+ Sources:
66
+
67
+ * Issue [#248](https://github.com/yagop/node-telegram-bot-api/issues/248)
68
+
69
+ <a name="error-meanings"></a>
70
+ ### What does this error mean?
71
+
72
+ * [502 Bad Gateway](https://github.com/yagop/node-telegram-bot-api/issues/377)
73
+
74
+ *Not complete. PRs welcome!*
75
+
76
+ Sources:
77
+
78
+ * Issue [#73](https://github.com/yagop/node-telegram-bot-api/issues/73)
79
+ * Issue [#99](https://github.com/yagop/node-telegram-bot-api/issues/99)
80
+ * Issue [#101](https://github.com/yagop/node-telegram-bot-api/issues/101)
81
+ * Issue [#107](https://github.com/yagop/node-telegram-bot-api/issues/107)
82
+ * Issue [#156](https://github.com/yagop/node-telegram-bot-api/issues/156)
83
+ * Issue [#170](https://github.com/yagop/node-telegram-bot-api/issues/170)
84
+ * Issue [#244](https://github.com/yagop/node-telegram-bot-api/issues/244)
85
+
86
+ <a name="reply-keyboard"></a>
87
+ ### How do I know the selected option in reply keyboard?
88
+
89
+ *Not done. PRs welcome!*
90
+
91
+ Sources:
92
+
93
+ * Issue [#108](https://github.com/yagop/node-telegram-bot-api/issues/108)
94
+
95
+ <a name="ordered-sending"></a>
96
+ ### How do I send multiple message in correct sequence?
97
+
98
+ *Not done. PRs welcome!*
99
+
100
+ Sources:
101
+
102
+ * Issue [#240](https://github.com/yagop/node-telegram-bot-api/issues/240)
103
+
104
+ <a name="proxy"></a>
105
+ ### How do I run my bot behind a proxy?
106
+
107
+ *Not done. PRs welcome!*
108
+
109
+ Sources:
110
+
111
+ * Issue [#122](https://github.com/yagop/node-telegram-bot-api/issues/122)
112
+ * Issue [#253](https://github.com/yagop/node-telegram-bot-api/issues/253)
113
+ * Issue [#766](https://github.com/yagop/node-telegram-bot-api/issues/766)
114
+
115
+ <a name="new-feature"></a>
116
+ ### Can you add feature X to the library?
117
+
118
+ *Not done. PRs welcome!*
119
+
120
+ Sources:
121
+
122
+ * Issue [#238](https://github.com/yagop/node-telegram-bot-api/issues/238)
123
+
124
+ <a name="scalable"></a>
125
+ ### Is this scalable?
126
+
127
+ *Not done. PRs welcome!*
128
+
129
+ Sources:
130
+
131
+ * Issue [#219](https://github.com/yagop/node-telegram-bot-api/issues/219)
132
+
133
+ <a name="messages-in-chat"></a>
134
+ ### How do I listen for messages in a chat group?
135
+
136
+ *Not done. PRs welcome!*
137
+
138
+ Sources:
139
+
140
+ * Issue [#304](https://github.com/yagop/node-telegram-bot-api/issues/304)
141
+
142
+ <a name="blocked-bot"></a>
143
+ ### How do I know when a user blocks the bot?
144
+
145
+ *Not done. PRs welcome!*
146
+
147
+ Sources:
148
+
149
+ * Issue [#273](https://github.com/yagop/node-telegram-bot-api/issues/273)
150
+
151
+ [questions]:https://github.com/yagop/node-telegram-bot-api/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20
@@ -0,0 +1,12 @@
1
+ # Tutorials
2
+
3
+ * [node-telegram-bot-api-tutorial by @hosein2398](https://github.com/hosein2398/node-telegram-bot-api-tutorial)
4
+ * [node-telegram-bot-api-persian-language by @saeedhei](https://github.com/saeedhei/node-telegram-bot-api-persian-language)
5
+ * [Node.JS: Делаем своего Telegram бота [RUS]](https://archakov.im/post/telegram-bot-on-nodejs)
6
+ * [YouTube: Пишем Telegram бота на NodeJS [RUS]](https://www.youtube.com/watch?v=RS1nmDMf69U&list=PL6AOr-PZtK-mM2QC1ixyfa5CtJZGK61aN)
7
+ * [Node.jsでTelegramのチャットボットを作る - Qiita](https://qiita.com/neetshin/items/0e2f6fa3ade41adb77bc)
8
+ * [Guía: Creación de bots de Telegram en Nodejs [ES]](https://tecnonucleous.com/creacion-de-bots-de-telegram-en-nodejs/)
9
+ * [node-telegram-bot-api-tutorial:a telegram bot helper to send templates by sms](https://github.com/vito2005/chatManagerTelegramBot)
10
+ * [Telegram bot using blockchain services](https://ilanolkies.com/post/Telegram-bot-using-blockchain-services)
11
+ * [How to set webhooks using express local server and NGROK](https://github.com/leobloise/node-telegram-bot-api-wb-tutorial)
12
+ > Send a PR with useful links **not** listed above
package/doc/usage.md ADDED
@@ -0,0 +1,269 @@
1
+ # Usage
2
+
3
+ - [Usage](#usage)
4
+ - [Events](#events)
5
+ - [WebHooks](#webhooks)
6
+ - [Sending files](#sending-files)
7
+ - [File Options (metadata)](#file-options-metadata)
8
+ - [Performance Issue](#performance-issue)
9
+ - [Error handling](#error-handling)
10
+ - [Polling errors](#polling-errors)
11
+ - [WebHook errors](#webhook-errors)
12
+
13
+ <a name="events"></a>
14
+ ## Events
15
+
16
+ *TelegramBot* is an [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
17
+ that emits the following events:
18
+
19
+ 1. `message`: Received a new incoming [Message][message] of any kind
20
+ 1. Depending on the properties of the [Message][message], one of these
21
+ events may **ALSO** be emitted: `text`, `audio`, `document`, `photo`,
22
+ `sticker`, `video`, `voice`, `contact`, `location`,
23
+ `new_chat_members`, `left_chat_member`, `new_chat_title`,
24
+ `new_chat_photo`, `delete_chat_photo`, `group_chat_created`,
25
+ `game`, `pinned_message`, `poll`, `dice`, `migrate_from_chat_id`, `migrate_to_chat_id`,
26
+ `channel_chat_created`, `supergroup_chat_created`,
27
+ `successful_payment`, `invoice`, `video_note`
28
+ 1. **Arguments**: `message` ([Message][message]), `metadata` (`{ type?:string }`)
29
+ 1. `new_chat_participant`, `left_chat_participant` are **deprecated**
30
+ 1. `callback_query`: Received a new incoming [Callback Query][callback-query]
31
+ 1. `inline_query`: Received a new incoming [Inline Query][inline-query]
32
+ 1. `chosen_inline_result`: Received result of an inline query i.e. [ChosenInlineResult][chosen-inline-result]
33
+ 1. `channel_post`: Received a new incoming channel post of any kind
34
+ 1. `edited_message`: Received a new version of a message that is known to the bot and was edited
35
+ 1. `edited_message_text`
36
+ 1. `edited_message_caption`
37
+ 1. `edited_channel_post`: Received a new version of a channel post that is known to the bot and was edited
38
+ 1. `edited_channel_post_text`
39
+ 1. `edited_channel_post_caption`
40
+ 1. `shipping_query`: Received a new incoming shipping query
41
+ 1. `pre_checkout_query`: Received a new incoming pre-checkout query
42
+ 1. `poll`: Received a new incoming poll
43
+ 2. `poll_answer`: A user has changed their answer in a non-anonymous poll (Only polls sent by the bot)
44
+ 3. `chat_member`: A chat member's status was updated in a chat
45
+ 4. `my_chat_member`: The bot's chat member status was updated in a chat
46
+ 5. `chat_join_request`: A request to join the chat has been sent (The bot must have the can_invite_users administrator right)
47
+ 5. `polling_error`: Error occurred during polling. See [polling errors](#polling-errors).
48
+ 6. `webhook_error`: Error occurred handling a webhook request. See [webhook errors](#webhook-errors).
49
+ 7. `error`: Unexpected error occurred, usually fatal!
50
+
51
+ **Tip:** Its much better to listen a specific event rather than on
52
+ `message` in order to stay safe from the content.
53
+
54
+ **Tip:** Bot must be enabled on [inline mode][inline-mode] for receive some
55
+ messages.
56
+
57
+ <a name="webhooks"></a>
58
+ ## WebHooks
59
+
60
+ Telegram only supports HTTPS connections to WebHooks.
61
+ Therefore, in order to set a WebHook, you will need a SSL certificate.
62
+ Since August 29, 2015 Telegram supports self-signed ones, thus, you can
63
+ generate them:
64
+
65
+ ```bash
66
+ # Our private cert will be key.pem, keep this file private
67
+ $ openssl genrsa -out key.pem 2048
68
+
69
+ # Our public certificate will be crt.pem
70
+ $ openssl req -new -sha256 -key key.pem -out crt.pem
71
+ ```
72
+
73
+ Once they are generated, the `crt.pem` should be uploaded, when setting up
74
+ your webhook. For example,
75
+
76
+ ```js
77
+ bot.setWebHook('public-url.com', {
78
+ certificate: 'path/to/crt.pem', // Path to your crt.pem
79
+ });
80
+ ```
81
+
82
+ **Note:** If you encounter an error, like
83
+ `Error: error:0906D06C:PEM routines:PEM_read_bio:no start line`,
84
+ you may want to proceed to [this issue][issue-63] for more information.
85
+
86
+ <a name="sending-files"></a>
87
+ ## Sending files
88
+
89
+ The library makes it easy to get started sending files. *By default*, you
90
+ may provide a **file-path** and the library will handle reading it for you.
91
+ For example,
92
+
93
+ ```js
94
+ bot.sendAudio(chatId, 'path/to/audio.mp3');
95
+ ```
96
+
97
+ You may also pass in a **Readable Stream** from which data will be piped.
98
+ For example,
99
+
100
+ ```js
101
+ const stream = fs.createReadStream('path/to/audio.mp3');
102
+ bot.sendAudio(chatId, stream);
103
+ ```
104
+
105
+ You may also pass in a **Buffer** containing the contents of your file.
106
+ For example,
107
+
108
+ ```js
109
+ const buffer = fs.readFileSync('path/to/audio.mp3'); // sync! that's sad! :-( Just making a point!
110
+ bot.sendAudio(chatId, buffer);
111
+ ```
112
+
113
+ If you already have a **File ID**, you earlier retrieved from Telegram,
114
+ you may pass it in, for example:
115
+
116
+ ```js
117
+ const fileId = getFileIdSomehow();
118
+ bot.sendAudio(chatId, fileId);
119
+ ```
120
+
121
+ Some API methods, such as *SendPhoto*, allow passing a **HTTP URL**, that
122
+ the Telegram servers will use to download the file. For example,
123
+
124
+ ```js
125
+ const url = 'https://telegram.org/img/t_logo.png';
126
+ bot.sendPhoto(chatId, url);
127
+ ```
128
+
129
+ If you wish to explicitly specify the filename or
130
+ [MIME type](http://en.wikipedia.org/wiki/Internet_media_type),
131
+ you may pass an additional argument as file options, like so:
132
+
133
+ ```js
134
+ const fileOptions = {
135
+ // Explicitly specify the file name.
136
+ filename: 'customfilename',
137
+ // Explicitly specify the MIME type.
138
+ contentType: 'audio/mpeg',
139
+ };
140
+ bot.sendAudio(chatId, data, {}, fileOptions);
141
+ ```
142
+
143
+ **NOTE:** You **MUST** provide an empty object (`{}`) in place of
144
+ *Additional Telegram query options*, if you have **no** query options
145
+ to specify. For example,
146
+
147
+ ```js
148
+ // WRONG!
149
+ // 'fileOptions' will be taken as additional Telegram query options!!!
150
+ bot.sendAudio(chatId, data, fileOptions);
151
+
152
+ // RIGHT!
153
+ bot.sendAudio(chatId, data, {}, fileOptions);
154
+ ```
155
+
156
+
157
+ <a name="sending-files-options"></a>
158
+ ### File Options (metadata)
159
+
160
+ When sending files, the library automatically resolves
161
+ the `filename` and `contentType` properties.
162
+ **For now, this has to be manually activated using environment
163
+ variable `NTBA_FIX_350`.**
164
+
165
+ In order of highest-to-lowest precedence in searching for
166
+ a value, when resolving the `filename`:
167
+
168
+ *(`fileOptions` is the Object argument passed to the method.
169
+ The "file" argument passed to the method can be a `Stream`,
170
+ `Buffer` or `filepath`.)*
171
+
172
+ 1. Is `fileOptions.filename` explictly defined?
173
+ 1. Does `Stream#path` exist?
174
+ 1. Is `filepath` provided?
175
+ 1. Default to `"filename"`
176
+
177
+ And the `contentType`:
178
+
179
+ 1. Is `fileOptions.contentType` explictly-defined?
180
+ 1. Does `Stream#path` exist?
181
+ 1. Try detecting file-type from the `Buffer`
182
+ 1. Is `filepath` provided?
183
+ 1. Is `fileOptions.filename` explicitly defined?
184
+ 1. Default to `"application/octet-stream"`
185
+
186
+ <a name="sending-files-performance"></a>
187
+ ### Performance Issue
188
+
189
+ To support providing file-paths to methods that send files involves
190
+ performing a file operation, i.e. *fs.existsSync()*, that checks for
191
+ the existence of the file at the provided path. While the cost of
192
+ this operation *might* be negligible in most use cases, if you want
193
+ to squeeze the best performance out of this library, you may wish to
194
+ disable this behavior.
195
+
196
+ This will mean that you will **NOT** be able to pass in file-paths.
197
+ You will have to use Streams or Buffers to provide the file contents.
198
+
199
+ Disabling this behavior:
200
+
201
+ ```js
202
+ const bot = new TelegramBot(token, {
203
+ filepath: false,
204
+ });
205
+ ```
206
+
207
+ <a name="error-handling"></a>
208
+ ## Error handling
209
+
210
+ Every `Error` object we pass back has the properties:
211
+
212
+ * `code` (String):
213
+ * value is `EFATAL` if error was fatal e.g. network error
214
+ * value is `EPARSE` if response body could **not** be parsed
215
+ * value is `ETELEGRAM` if error was returned from Telegram servers
216
+ * `response` ([http.IncomingMessage](https://nodejs.org/api/http.html#http_class_http_incomingmessage)):
217
+ * available if `error.code` is **not** `EFATAL`
218
+ * `response.body` (String|Object): Error response from Telegram
219
+ * type is `String` if `error.code` is `EPARSE`
220
+ * type is `Object` if `error.code` is `ETELEGRAM`
221
+
222
+ For example, sending message to a non-existent user:
223
+
224
+ ```js
225
+ bot.sendMessage(nonExistentUserId, 'text').catch((error) => {
226
+ console.log(error.code); // => 'ETELEGRAM'
227
+ console.log(error.response.body); // => { ok: false, error_code: 400, description: 'Bad Request: chat not found' }
228
+ });
229
+ ```
230
+
231
+ <a name="polling-errors"></a>
232
+ ## Polling errors
233
+
234
+ An error may occur during polling. It is up to you to handle it
235
+ as you see fit. You may decide to crash your bot after a maximum number
236
+ of polling errors occurring. **It is all up to you.**
237
+
238
+ By default, the polling error is just logged to stderr, if you do
239
+ **not** handle this event yourself.
240
+
241
+ Listen on the `'polling_error'` event. For example,
242
+
243
+ ```js
244
+ bot.on('polling_error', (error) => {
245
+ console.log(error.code); // => 'EFATAL'
246
+ });
247
+ ```
248
+
249
+ <a name="webhook-errors"></a>
250
+ ## WebHook errors
251
+
252
+ Just like with [polling errors](#polling-errors), you decide on how to
253
+ handle it. By default, the error is logged to stderr.
254
+
255
+ Listen on the `'webhook_error'` event. For example,
256
+
257
+ ```js
258
+ bot.on('webhook_error', (error) => {
259
+ console.log(error.code); // => 'EPARSE'
260
+ });
261
+ ```
262
+
263
+ [update]:https://core.telegram.org/bots/api#update
264
+ [message]:https://core.telegram.org/bots/api#message
265
+ [callback-query]:https://core.telegram.org/bots/api#callbackquery
266
+ [inline-query]:https://core.telegram.org/bots/api#inlinequery
267
+ [chosen-inline-result]:https://core.telegram.org/bots/api#choseninlineresult
268
+ [inline-mode]:https://core.telegram.org/bots/api#inline-mode
269
+ [issue-63]:https://github.com/yagop/node-telegram-bot-api/issues/63
package/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * If running on Nodejs 5.x and below, we load the transpiled code.
3
+ * Otherwise, we use the ES6 code.
4
+ * We are deprecating support for Node.js v5.x and below.
5
+ */
6
+ const majorVersion = parseInt(process.versions.node.split('.')[0], 10);
7
+ if (majorVersion <= 5) {
8
+ const deprecate = require('./src/utils').deprecate;
9
+ deprecate('Node.js v5.x and below will no longer be supported in the future');
10
+ module.exports = require('./lib/telegram');
11
+ } else {
12
+ module.exports = require('./src/telegram');
13
+ }
package/lib/errors.js ADDED
@@ -0,0 +1,112 @@
1
+ 'use strict';
2
+
3
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
+
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
+
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10
+
11
+ exports.BaseError = function (_Error) {
12
+ _inherits(BaseError, _Error);
13
+
14
+ /**
15
+ * @class BaseError
16
+ * @constructor
17
+ * @private
18
+ * @param {String} code Error code
19
+ * @param {String} message Error message
20
+ */
21
+ function BaseError(code, message) {
22
+ _classCallCheck(this, BaseError);
23
+
24
+ var _this = _possibleConstructorReturn(this, (BaseError.__proto__ || Object.getPrototypeOf(BaseError)).call(this, code + ': ' + message));
25
+
26
+ _this.code = code;
27
+ return _this;
28
+ }
29
+
30
+ _createClass(BaseError, [{
31
+ key: 'toJSON',
32
+ value: function toJSON() {
33
+ return {
34
+ code: this.code,
35
+ message: this.message
36
+ };
37
+ }
38
+ }]);
39
+
40
+ return BaseError;
41
+ }(Error);
42
+
43
+ exports.FatalError = function (_exports$BaseError) {
44
+ _inherits(FatalError, _exports$BaseError);
45
+
46
+ /**
47
+ * Fatal Error. Error code is `"EFATAL"`.
48
+ * @class FatalError
49
+ * @constructor
50
+ * @param {String|Error} data Error object or message
51
+ */
52
+ function FatalError(data) {
53
+ _classCallCheck(this, FatalError);
54
+
55
+ var error = typeof data === 'string' ? null : data;
56
+ var message = error ? error.message : data;
57
+
58
+ var _this2 = _possibleConstructorReturn(this, (FatalError.__proto__ || Object.getPrototypeOf(FatalError)).call(this, 'EFATAL', message));
59
+
60
+ if (error) {
61
+ _this2.stack = error.stack;
62
+ _this2.cause = error;
63
+ }
64
+ return _this2;
65
+ }
66
+
67
+ return FatalError;
68
+ }(exports.BaseError);
69
+
70
+ exports.ParseError = function (_exports$BaseError2) {
71
+ _inherits(ParseError, _exports$BaseError2);
72
+
73
+ /**
74
+ * Error during parsing. Error code is `"EPARSE"`.
75
+ * @class ParseError
76
+ * @constructor
77
+ * @param {String} message Error message
78
+ * @param {http.IncomingMessage} response Server response
79
+ */
80
+ function ParseError(message, response) {
81
+ _classCallCheck(this, ParseError);
82
+
83
+ var _this3 = _possibleConstructorReturn(this, (ParseError.__proto__ || Object.getPrototypeOf(ParseError)).call(this, 'EPARSE', message));
84
+
85
+ _this3.response = response;
86
+ return _this3;
87
+ }
88
+
89
+ return ParseError;
90
+ }(exports.BaseError);
91
+
92
+ exports.TelegramError = function (_exports$BaseError3) {
93
+ _inherits(TelegramError, _exports$BaseError3);
94
+
95
+ /**
96
+ * Error returned from Telegram. Error code is `"ETELEGRAM"`.
97
+ * @class TelegramError
98
+ * @constructor
99
+ * @param {String} message Error message
100
+ * @param {http.IncomingMessage} response Server response
101
+ */
102
+ function TelegramError(message, response) {
103
+ _classCallCheck(this, TelegramError);
104
+
105
+ var _this4 = _possibleConstructorReturn(this, (TelegramError.__proto__ || Object.getPrototypeOf(TelegramError)).call(this, 'ETELEGRAM', message));
106
+
107
+ _this4.response = response;
108
+ return _this4;
109
+ }
110
+
111
+ return TelegramError;
112
+ }(exports.BaseError);