mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-29 05:17:41 +00:00
feat: add clear listener methods (#834)
- by @daniel0611 Co-authored-by: Mohammed Sohail <sohailsameja@gmail.com>
This commit is contained in:
parent
3829e727aa
commit
ec7e61e041
@ -1681,6 +1681,13 @@ class TelegramBot extends EventEmitter {
|
||||
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.
|
||||
* @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];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* (current name of the user for one-on-one conversations, current
|
||||
|
Loading…
x
Reference in New Issue
Block a user