grammyjs / grammyjs/files

feat: add `message.file_id`

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10
Forks
2
PR merge metrics
No merged PRs in 30d

Description

When a file is sent, the server may change the type of message after it was sent. For example, `ctx.send({ video })` might end up returning a document message with `message.document.file_id` being the file identifier of the uploaded file. It isn't known which type of message we will receive, so it is tedious to check all different types of messages every time in order to obtain the file identifier.

We should hydrate API call results and install `message.file_id` on the resulting message object. It should be an alias for getting the file identifier from many different places.

For consistency, we should also do this for incoming messages—otherwise people will be confused why some message objects have this property and some don't.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how ctx.send API results are returned and how incoming messages are represented. Identify the hydration entry points and the existing locations of file identifiers, then ensure both outgoing results and incoming messages expose the requested alias consistently. Done means callers can obtain the uploaded file identifier through message.file_id without checking each message type.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.