Skip to content

expose ephemeralMessageId on Message / CallbackQueryContext (Bot API 10.2) #5

Description

@adriangalilea

Bot API 10.2 ephemeral messages carry ephemeral_message_id instead of an ordinary message_id, and it's the only handle for editEphemeralMessageText. @gramio/types 10.2.0 already types the field on TelegramMessage, but contexts (0.9.0) has no getter, so a callback handler that wants to edit the tapped ephemeral view in place has to read the raw payload.

We're shimming it locally in the meantime. Suggested shape, mirroring threadId / db7bf0f:

src/structures/message.ts:

/** For ephemeral messages, identifier of the ephemeral message inside this chat (Bot API 10.2). */
@Inspect({ nullable: false })
get ephemeralMessageId() {
	return this.payload.ephemeral_message_id;
}

src/contexts/callback-query.ts, next to threadId:

/** Identifier of the originating ephemeral message, or undefined for an ordinary one. The only
 *  handle for editing the tapped ephemeral view in place (editEphemeralMessageText). */
get ephemeralMessageId() {
	return this.message?.ephemeralMessageId;
}

Needs the @gramio/types dep at ^10.2.0 for the field's typing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions