fix(dispatcher): support text filters inside filters.replyTo
This commit is contained in:
parent
a0ed269b5e
commit
9e218e3457
1 changed files with 17 additions and 13 deletions
|
@ -1,10 +1,12 @@
|
||||||
import type {
|
import type {
|
||||||
BusinessCallbackQuery,
|
BusinessCallbackQuery,
|
||||||
BusinessMessage,
|
|
||||||
CallbackQuery,
|
CallbackQuery,
|
||||||
ChosenInlineResult,
|
ChosenInlineResult,
|
||||||
InlineCallbackQuery,
|
InlineCallbackQuery,
|
||||||
InlineQuery,
|
InlineQuery,
|
||||||
|
} from '@mtcute/core'
|
||||||
|
import {
|
||||||
|
BusinessMessage,
|
||||||
Message,
|
Message,
|
||||||
} from '@mtcute/core'
|
} from '@mtcute/core'
|
||||||
|
|
||||||
|
@ -12,9 +14,10 @@ import type { UpdateContextDistributed } from '../context/base.js'
|
||||||
|
|
||||||
import type { UpdateFilter } from './types.js'
|
import type { UpdateFilter } from './types.js'
|
||||||
|
|
||||||
type UpdatesWithText = UpdateContextDistributed<
|
type UpdatesWithText =
|
||||||
| Message
|
| Message
|
||||||
| BusinessMessage
|
| BusinessMessage
|
||||||
|
| UpdateContextDistributed<
|
||||||
| InlineQuery
|
| InlineQuery
|
||||||
| ChosenInlineResult
|
| ChosenInlineResult
|
||||||
| CallbackQuery
|
| CallbackQuery
|
||||||
|
@ -23,10 +26,11 @@ type UpdatesWithText = UpdateContextDistributed<
|
||||||
>
|
>
|
||||||
|
|
||||||
function extractText(obj: UpdatesWithText): string | null {
|
function extractText(obj: UpdatesWithText): string | null {
|
||||||
switch (obj._name) {
|
if (obj instanceof Message || obj instanceof BusinessMessage) {
|
||||||
case 'new_message':
|
|
||||||
case 'new_business_message':
|
|
||||||
return obj.text
|
return obj.text
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (obj._name) {
|
||||||
case 'inline_query':
|
case 'inline_query':
|
||||||
return obj.query
|
return obj.query
|
||||||
case 'chosen_inline_result':
|
case 'chosen_inline_result':
|
||||||
|
|
Loading…
Reference in a new issue