JSPM

@gramio/auto-retry

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 44
  • Score
    100M100P100Q77209F

Auto-retry plugin for GramIO

Package Exports

  • @gramio/auto-retry

Readme

@gramio/auto-retry

npm JSR JSR Score

A plugin that catches errors with the retry_after field (rate limit errors), waits for the specified time and repeats the API request.

import { Bot } from "gramio";
import { autoRetry } from "@gramio/auto-retry";

const bot = new Bot(process.env.TOKEN!)
    .extend(autoRetry())
    .command("start", async (context) => {
        for (let index = 0; index < 100; index++) {
            await context.reply(`some ${index}`);
        }
    })
    .onStart(console.log);

bot.start();