Comparing version 0.8.0 to 0.9.0
@@ -70,3 +70,3 @@ var debug = require('debug')('telegraf:core') | ||
/** | ||
* Generates filter `middleware` | ||
* Generates `middleware` for handling provided event types. | ||
* | ||
@@ -77,3 +77,3 @@ * @param {string|string[]} eventTypes | ||
*/ | ||
Telegraf.optional = function (eventTypes) { | ||
Telegraf.handler = function (eventTypes) { | ||
if (typeof eventTypes === 'string') { | ||
@@ -231,3 +231,3 @@ eventTypes = [eventTypes] | ||
var fns = [].slice.call(arguments, 1) | ||
this.use(Telegraf.optional(eventTypes, Telegraf.compose(fns))) | ||
this.use(Telegraf.handler(eventTypes, Telegraf.compose(fns))) | ||
return this | ||
@@ -253,3 +253,3 @@ } | ||
var middleware = Telegraf.optional('text', function * (next) { | ||
var middleware = Telegraf.handler('text', function * (next) { | ||
var result = regex.exec(this.message.text) | ||
@@ -256,0 +256,0 @@ if (result) { |
{ | ||
"name": "telegraf", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "📢 Modern Telegram bot framework", | ||
@@ -5,0 +5,0 @@ "main": "lib/telegraf.js", |
@@ -303,3 +303,3 @@ [![npm](https://img.shields.io/npm/l/telegraf.svg?style=flat-square)](https://www.npmjs.com/package/telegraf) | ||
- [`Telegraf.optional(messageType, handler, [handler...])`](#optional) | ||
- [`Telegraf.handler(messageType, handler, [handler...])`](#handler) | ||
- [`Telegraf.compose(middleware)`](#compose) | ||
@@ -343,4 +343,4 @@ - [`new Telegraf(token)`](#new) | ||
<a name="optional"></a> | ||
##### `Telegraf.optional(eventType, handler, [handler...])` | ||
<a name="handler"></a> | ||
##### `Telegraf.handler(eventType, handler, [handler...])` | ||
@@ -347,0 +347,0 @@ Generates middleware for handling provided [event type](#events). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49679