JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2302
  • Score
    100M100P100Q111459F
  • License MIT

Hydration plugin for grammY

Package Exports

  • @grammyjs/hydrate
  • @grammyjs/hydrate/out/mod.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@grammyjs/hydrate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Hydration plugin for grammY

Please confer the official documentation for this plugin to learn more about this plugin, including about its Installation.

Here is a brief description, though: This plugin installs useful methods on two types of objects, namely

  1. the results of API calls, and
  2. the objects on the context object ctx.

The purpose of this plugin is best illustrated by an example.

WITHOUT this plugin:

bot.on(":photo", async (ctx) => {
    const statusMessage = await ctx.reply("Processing your image, please wait");
    await doWork(); // some long image processing
    await ctx.api.deleteMessage(statusMessage.message_id);
});
bot.on("callback_query", async (ctx) => {
    await ctx.answerCallbackQuery();
});

WITH this plugin:

bot.on(":photo", async (ctx) => {
    const statusMessage = await ctx.reply("Processing your image, please wait");
    await doWork(); // some long image processing
    await statusMessage.delete(); // so easy!
});
bot.on("callback_query", async (ctx) => {
    await ctx.callbackQuery.answer(); // this works now, too
});