mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-09-02 07:15:34 +00:00
feat: add clear listener methods (#834)
- by @daniel0611 Co-authored-by: Mohammed Sohail <sohailsameja@gmail.com>
This commit is contained in:
@@ -1681,6 +1681,13 @@ class TelegramBot extends EventEmitter {
|
|||||||
return this._textRegexpCallbacks.splice(index, 1)[0];
|
return this._textRegexpCallbacks.splice(index, 1)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all listeners registered with `onText()`.
|
||||||
|
*/
|
||||||
|
clearTextListeners() {
|
||||||
|
this._textRegexpCallbacks = [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a reply to wait for a message response.
|
* Register a reply to wait for a message response.
|
||||||
* @param {Number|String} chatId The chat id where the message cames from.
|
* @param {Number|String} chatId The chat id where the message cames from.
|
||||||
@@ -1717,6 +1724,13 @@ class TelegramBot extends EventEmitter {
|
|||||||
return this._replyListeners.splice(index, 1)[0];
|
return this._replyListeners.splice(index, 1)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all replies that have been prev. registered for a message response.
|
||||||
|
*/
|
||||||
|
clearReplyListeners() {
|
||||||
|
this._replyListeners = [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to get up to date information about the chat
|
* Use this method to get up to date information about the chat
|
||||||
* (current name of the user for one-on-one conversations, current
|
* (current name of the user for one-on-one conversations, current
|
||||||
|
Reference in New Issue
Block a user