Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/grammy_menu/deps.deno.ts>Context#entities

Interactive menus for grammY
Go to Latest
method Context.prototype.entities
Re-export
import { Context } from "https://deno.land/x/grammy_menu@v1.2.1/deps.deno.ts";

Get entities and their text. Extracts the text from ctx.msg.text or ctx.msg.caption. Returns an empty array if one of ctx.msg, ctx.msg.text or ctx.msg.entities is undefined.

You can filter specific entity types by passing the types parameter. Example:

ctx.entities() // Returns all entity types
ctx.entities('url') // Returns only url entities
ctx.enttities(['url', 'email']) // Returns url and email entities

Returns

Array<MessageEntity & { text: string; }>

Array of entities and their texts, or empty array when there's no text

Parameters

types: MaybeArray<T>

Returns

Array<MessageEntity & { type: T; text: string; }>