mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-24 23:14:39 +03:00
fix(telegraf-service): ability to listen to all messages has been added
This commit is contained in:
parent
ee6d2f9b0e
commit
ed2c96c6f1
@ -109,10 +109,16 @@ export class TelegrafService {
|
||||
}
|
||||
|
||||
private setupOnMessage(handlers: Handler[]): void {
|
||||
const onMessageHandlers = handlers.filter(({ config }) => config.message)
|
||||
const onMessageHandlers = handlers.filter(
|
||||
({ config }) => config.message !== undefined
|
||||
)
|
||||
|
||||
onMessageHandlers.forEach(handler => {
|
||||
this.bot.hears(handler.config.message, this.adoptHandle(handler))
|
||||
if (handler.config.message) {
|
||||
this.bot.hears(handler.config.message, this.adoptHandle(handler))
|
||||
} else {
|
||||
this.bot.on('message', this.adoptHandle(handler))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user