Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ctx.send and SendData #676

Open
Tracked by #675
KnorpelSenf opened this issue Dec 15, 2024 · 0 comments
Open
Tracked by #675

feat: ctx.send and SendData #676

KnorpelSenf opened this issue Dec 15, 2024 · 0 comments

Comments

@KnorpelSenf
Copy link
Member

We want to introduce SendData: an object that specifies all necessary information in order to send a message. This can be a string, or { text: string } or { photo: photo }, etc. Optionally, more parameters can be contained.

This lets us add ctx.send. In grammY 2.0, you can then call ctx.send("message") and ctx.send({ photo }) instead of ctx.reply("message") and ctx.replyWithPhoto(photo).

Similar objects will be introduced for editing messages.

Similar objects will be introduced for calling arbitrary API methods.

This has many advantages:

  • ctx.reply has nothing to do with replies so the name is misleading
  • it is currently impossible to write a function that generates message data—if you want modularity, you must pass around the context object, which is bad
  • menus have no way to edit their own content when they are being navigated to, and send data will make this much better

Naming ideas:

  • send data
  • send template
  • send spec objects
  • send blueprints
KnorpelSenf added a commit that referenced this issue Dec 16, 2024
Note that `ctx.send` does not exist yet. Adding it is tracked in
#676.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant