2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-29 21:37:58 +00:00

Merge branch 'knock-in-master'

This commit is contained in:
Yago 2016-06-06 23:20:34 +02:00
commit 9293fd4e67
2 changed files with 11 additions and 8 deletions

View File

@ -17,7 +17,7 @@
"prepublish": "./node_modules/.bin/babel -d ./lib src", "prepublish": "./node_modules/.bin/babel -d ./lib src",
"test": "./node_modules/.bin/mocha test/index.js --timeout 10000", "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", "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" "eslint": "./node_modules/.bin/eslint ./src"
}, },
"author": "Yago Pérez <yagoperezs@gmail.com>", "author": "Yago Pérez <yagoperezs@gmail.com>",

View File

@ -14,14 +14,17 @@ const URL = require('url');
const fs = require('fs'); const fs = require('fs');
const pump = require('pump'); 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 { class TelegramBot extends EventEmitter {
// Telegram message events static get messageTypes() {
static messageTypes = [ return _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'
];
/** /**
* Both request method to obtain messages are implemented. To use standard polling, set `polling: true` * 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); this._polling = new TelegramBotPolling(this.token, this.options.polling, this.processUpdate);
} }
processUpdate = (update) => { processUpdate(update) {
debug('Process Update %j', update); debug('Process Update %j', update);
const message = update.message; const message = update.message;
const inlineQuery = update.inline_query; const inlineQuery = update.inline_query;