🚧 Under development. Please do not use in production yet
Set of useful components for grammY.
// TODO
// TODO
// TODO: add imports after publishing
// Extend bot context type
export type MyContext = Context & WebAppDataFlavor;
// Create a bot, specify the extended context
const bot = new Bot<MyContext>(""); // <-- put your authentication token between the ""
bot.command("start", async (ctx) => {
const keyboard = new Keyboard();
// Sending the component to the user
keyboard.webApp("Click to pick", new TimePicker().build());
await ctx.reply("Hey, pick a time!", {
reply_markup: keyboard,
});
});
// Handle time selected by a user
bot.filter(TimePicker.match(), (ctx) => {
const { time } = ctx.webAppData;
return ctx.reply(`You chose ${time.getUTCHours()}:${time.getUTCMinutes()}`);
});
bot.start();
- Color Picker let select a color.
- Date Picker let select a date.
- QR Scanner let scan a QR.
- Time Picker let select a time.
- Packages
components
- Package that provides all the componentsweb
- Module that creates buttons of web componentskeyboard
- Module that implements keyboard components
- Apps
web-components-app
- Web application that implements web componentsplayground-bot
- Demo bot that uses all components