-
Notifications
You must be signed in to change notification settings - Fork 11
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
added ctx.menu.at function #50
base: main
Are you sure you want to change the base?
Conversation
Will review it tonight. You can test your changes by running npm install github:zxsleebu/menu |
In fact, you can compile it simply by running |
@@ -34,7 +34,7 @@ const INJECT_METHODS = new Set([ | |||
* Context flavor for context objects in listeners that react to menus. Provides | |||
* `ctx.menu`, a control pane for the respective menu. | |||
*/ | |||
export interface MenuFlavor { | |||
export interface MenuFlavor<C extends Context> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change.
These changes make #14 outlines that menus should be accessible everywhere, so you can for example do this: bot.command("menu", ctx => ctx.reply("Menu:", {
// Send 'my-menu'
reply_markup: ctx.menu.at("my-menu")
})) Your changes do not permit that. |
yes, that was fully intended. const devSettingsMenu = new AutoMenu("devSettingsMenu", async (ctx, menu) => {
await ctx.reply(`Developer settings`, { reply_markup: menu });
}).text("Request API-Key", ctx => ctx.reply('API-Key requested successfuly'))
.fastBack() |
I neither understand your use case nor the code snippet and I'm also not sure if they have anything to do with each other |
Is that like a side-effect function that runs when the menu is sent somewhere? So you end up sending two menus? Or how else would you send a menu now? |
useful function for custom methods.
i don't actually have a deno environment, so you should necessarily test this pr!