Skip to content

grammyjs/components

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪄 Components for grammY

🚧 Under development. Please do not use in production yet

Set of useful components for grammY.

Documentation »

Install

Node

// TODO

Deno

// TODO

Usage

// 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();

Component List

Repository contents

  • Packages
    • components - Package that provides all the components
      • web - Module that creates buttons of web components
      • keyboard - Module that implements keyboard components
  • Apps

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy