grammyjs / grammyjs/menu

feat: Static menus

Open
#2 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
35
Forks
14
Avg merge
6h 39m
Merged PRs (30d)
2

Description

Menus cannot be sent via `bot.api` because they require an installed API transformer. This transformer is only installed during `bot.use(menu)`.

One way would be to directly provide the API transformer to be installed on `bot.api`, but this does not follow the intuitive pattern of the rest of the plugin.

Instead, it would be cool if we can have a statically rendered version of the menu (a menu range) that can be passed to the constructor of the menu. Whenever the menu is sent (the internal `Proxy` is accessed), this static menu is rendered and sent. It obviously may not depend on a context object, so we should throw an error if someone tries to use dynamic strings/dynamic ranges.

```ts
const menu = new Menu('id', {
static: new Menu.Range().text('go', ctx => ctx.reply('whee'))
})
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.