mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-29 13:27:44 +00:00
Generate Docs from /src directly
This commit is contained in:
parent
1b2afa71fd
commit
b117a5b5ae
@ -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>",
|
||||||
|
@ -14,15 +14,18 @@ const URL = require('url');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const pump = require('pump');
|
const pump = require('pump');
|
||||||
|
|
||||||
class TelegramBot extends EventEmitter {
|
const _messageTypes = [
|
||||||
|
|
||||||
// Telegram message events
|
|
||||||
static messageTypes = [
|
|
||||||
'text', 'audio', 'document', 'photo', 'sticker', 'video', 'voice', 'contact',
|
'text', 'audio', 'document', 'photo', 'sticker', 'video', 'voice', 'contact',
|
||||||
'location', 'new_chat_participant', 'left_chat_participant', 'new_chat_title',
|
'location', 'new_chat_participant', 'left_chat_participant', 'new_chat_title',
|
||||||
'new_chat_photo', 'delete_chat_photo', 'group_chat_created'
|
'new_chat_photo', 'delete_chat_photo', 'group_chat_created'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
class TelegramBot extends EventEmitter {
|
||||||
|
|
||||||
|
static get messageTypes() {
|
||||||
|
return _messageTypes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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`
|
||||||
* on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a SSL certificate.
|
* on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a SSL certificate.
|
||||||
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user