@grammyjs/hydrate
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

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
});

/@grammyjs/hydrate/

    Package Sidebar

    Install

    npm i @grammyjs/hydrate

    Weekly Downloads

    2,438

    Version

    1.4.1

    License

    MIT

    Unpacked Size

    55.4 kB

    Total Files

    33

    Last publish

    Collaborators

    • knorpelsenf