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.
const menu = new Menu('id', {
static: new Menu.Range().text('go', ctx => ctx.reply('whee'))
})
Menus cannot be sent via
bot.apibecause they require an installed API transformer. This transformer is only installed duringbot.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
Proxyis 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.