diff --git a/package.json b/package.json index df820de..f679220 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "prepublish": "./node_modules/.bin/babel -d ./lib src", "test": "./node_modules/.bin/mocha test/index.js --timeout 10000", "test-cov": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", - "gen-doc": "./node_modules/.bin/babel --no-babelrc --plugins transform-es2015-spread,transform-es2015-destructuring,transform-strict-mode,transform-es2015-parameters,transform-es2015-shorthand-properties,transform-object-rest-spread,transform-class-properties -d lib-doc src && ./node_modules/.bin/jsdoc2md --src lib-doc/telegram.js -t README.hbs > README.md", + "gen-doc": "./node_modules/.bin/jsdoc2md --src src/telegram.js -t README.hbs > README.md", "eslint": "./node_modules/.bin/eslint ./src" }, "author": "Yago Pérez ", diff --git a/src/telegram.js b/src/telegram.js index 6bf77f0..cd0bc5f 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -14,14 +14,17 @@ const URL = require('url'); const fs = require('fs'); const pump = require('pump'); +const _messageTypes = [ + 'text', 'audio', 'document', 'photo', 'sticker', 'video', 'voice', 'contact', + 'location', 'new_chat_participant', 'left_chat_participant', 'new_chat_title', + 'new_chat_photo', 'delete_chat_photo', 'group_chat_created' +]; + class TelegramBot extends EventEmitter { - // Telegram message events - static messageTypes = [ - 'text', 'audio', 'document', 'photo', 'sticker', 'video', 'voice', 'contact', - 'location', 'new_chat_participant', 'left_chat_participant', 'new_chat_title', - 'new_chat_photo', 'delete_chat_photo', 'group_chat_created' - ]; + static get messageTypes() { + return _messageTypes; + } /** * Both request method to obtain messages are implemented. To use standard polling, set `polling: true` @@ -64,7 +67,7 @@ class TelegramBot extends EventEmitter { this._polling = new TelegramBotPolling(this.token, this.options.polling, this.processUpdate); } - processUpdate = (update) => { + processUpdate(update) { debug('Process Update %j', update); const message = update.message; const inlineQuery = update.inline_query;