From 0b90ecf9adffb59e7e2108e25024726b2f4dae75 Mon Sep 17 00:00:00 2001 From: Ovler Date: Sat, 29 Jun 2024 17:59:58 +0000 Subject: [PATCH] chore: enable autoRetry --- package.json | 1 + pnpm-lock.yaml | 16 ++++++++++++++++ src/lib/server/index.ts | 2 ++ 3 files changed, 19 insertions(+) diff --git a/package.json b/package.json index 213c269..520e031 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "type": "module", "dependencies": { + "@grammyjs/auto-retry": "^2.0.1", "@roziscoding/grammy-autoquote": "^2.0.6", "fast-xml-parser": "^4.3.6", "grammy": "^1.21.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c0e2ee5..890b354 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: .: dependencies: + '@grammyjs/auto-retry': + specifier: ^2.0.1 + version: 2.0.1(grammy@1.21.1) '@roziscoding/grammy-autoquote': specifier: ^2.0.6 version: 2.0.6(grammy@1.21.1) @@ -206,6 +209,12 @@ packages: cpu: [x64] os: [win32] + '@grammyjs/auto-retry@2.0.1': + resolution: {integrity: sha512-4W2T3KeRp1IERUUqMV6jjr+3z0FD6qe7DgXdykdqzNmOb2O+MUM7cqWCcWzbIjUVwRyFyHeH+vREO1ZvKppCrg==} + engines: {node: '>=12.20.0 || >=14.13.1'} + peerDependencies: + grammy: ^1.10.0 + '@grammyjs/types@3.5.2': resolution: {integrity: sha512-KZlJcOdgD8N6SMIHWfwmb11L5/L2+rptWBxCexbzNCry/wfLXFFGFniyUrySnvFo+cWMxgy5GuImwY3mhUrP8g==} @@ -878,6 +887,13 @@ snapshots: '@esbuild/win32-x64@0.20.2': optional: true + '@grammyjs/auto-retry@2.0.1(grammy@1.21.1)': + dependencies: + debug: 4.3.4 + grammy: 1.21.1 + transitivePeerDependencies: + - supports-color + '@grammyjs/types@3.5.2': {} '@jridgewell/gen-mapping@0.3.3': diff --git a/src/lib/server/index.ts b/src/lib/server/index.ts index fe312f2..908be2d 100644 --- a/src/lib/server/index.ts +++ b/src/lib/server/index.ts @@ -3,6 +3,7 @@ import { BiliArchiver } from "./api.js"; import * as MARKUP from "./markup.js"; import { env } from "$env/dynamic/private"; import { autoQuote } from "@roziscoding/grammy-autoquote"; +import { autoRetry } from "@grammyjs/auto-retry"; import { handleBiliLink } from "./utils.js"; const token = env.BILIARCHIVER_BOT; @@ -11,6 +12,7 @@ if (!token) { } const bot = new Bot(token!); bot.use(autoQuote()); +bot.api.config.use(autoRetry()); const apiBase = env.BILIARCHIVER_API; if (!apiBase) { throw new Error("\x1b[31mBILIARCHIVER_API must be provided!\x1b[0m");