feat(client): Message#textWithEntities

This commit is contained in:
alina 🌸 2023-11-23 22:11:23 +03:00
parent 8249bd2ea4
commit 1dcbf277ef
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -11,6 +11,7 @@ import { assertTypeIsNot } from '@mtcute/core/utils.js'
import { makeInspectable } from '../../utils/index.js' import { makeInspectable } from '../../utils/index.js'
import { memoizeGetters } from '../../utils/memoize.js' import { memoizeGetters } from '../../utils/memoize.js'
import { BotKeyboard, ReplyMarkup } from '../bots/keyboards.js' import { BotKeyboard, ReplyMarkup } from '../bots/keyboards.js'
import { TextWithEntities } from '../misc/index.js'
import { Chat } from '../peers/chat.js' import { Chat } from '../peers/chat.js'
import { PeersIndex } from '../peers/peers-index.js' import { PeersIndex } from '../peers/peers-index.js'
import { User } from '../peers/user.js' import { User } from '../peers/user.js'
@ -257,6 +258,15 @@ export class Message {
return entities return entities
} }
get textWithEntities(): TextWithEntities {
if (this.raw._ === 'messageService') return { text: '', entities: [] }
return {
text: this.raw.message,
entities: this.raw.entities,
}
}
/** /**
* Message action. `null` for non-service messages * Message action. `null` for non-service messages
* or for unsupported events. * or for unsupported events.