Skip to main content

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

Works with
This package works with Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
100%
Published
2 weeks ago (0.0.2)

@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();
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @gramio/auto-retry

Import symbol

import * as mod from "@gramio/auto-retry";

Add Package

npx jsr add @gramio/auto-retry

Import symbol

import * as mod from "@gramio/auto-retry";

Add Package

yarn dlx jsr add @gramio/auto-retry

Import symbol

import * as mod from "@gramio/auto-retry";

Add Package

pnpm dlx jsr add @gramio/auto-retry

Import symbol

import * as mod from "@gramio/auto-retry";

Add Package

bunx jsr add @gramio/auto-retry

Import symbol

import * as mod from "@gramio/auto-retry";