From 1f8f9e4498b9bdf810d81e782eca7313b0e76a78 Mon Sep 17 00:00:00 2001 From: Dunkan <70066170+dcdunkan@users.noreply.github.com> Date: Thu, 14 Nov 2024 18:15:12 +0530 Subject: [PATCH] fix: change the deno kv prefix --- README.md | 16 ++++++++-------- deno.lock | 8 +++++++- deps.ts | 2 +- src/bot.ts | 2 +- src/helpers/session.ts | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 70e410f..713ee23 100644 --- a/README.md +++ b/README.md @@ -79,9 +79,9 @@ Make sure you have installed [Deno](https://deno.land). ### Deno Deploy The working bot, [@scripturbot](https://telegram.me/scripturbot) is currently -deployed on [Deno Deploy](https://deno.com/deploy). Even though I -have implemented a fine getbible.net API call caching system, it's not being -used since Deno Deploy currently does not provide file system writing access. If +deployed on [Deno Deploy](https://deno.com/deploy). Even though I have +implemented a fine getbible.net API call caching system, it's not being used +since Deno Deploy currently does not provide file system writing access. If you're deploying to Heroku or some other, you should be able to enable caching by providing a `USE_CACHE=1` in [environment variables](#environment-variables). @@ -100,11 +100,11 @@ to handle updates. ### Environment Variables -| Variable | Required? | Description | -| ----------- | --------- | -------------------------------------------------------------------------------- | -| `DEBUG` | No. | If not set, the bot would run in the webhook mode. Set to enable long polling. | -| `BOT_TOKEN` | **Yes.** | The API token of the Bot. Chat with https://t.me/BotFather to get one. | -| `USE_CACHE` | No. | Set the value to 1 if you want caching to work. | +| Variable | Required? | Description | +| ----------- | --------- | ------------------------------------------------------------------------------ | +| `DEBUG` | No. | If not set, the bot would run in the webhook mode. Set to enable long polling. | +| `BOT_TOKEN` | **Yes.** | The API token of the Bot. Chat with https://t.me/BotFather to get one. | +| `USE_CACHE` | No. | Set the value to 1 if you want caching to work. | ## License diff --git a/deno.lock b/deno.lock index bfa91e3..1132391 100644 --- a/deno.lock +++ b/deno.lock @@ -20,6 +20,9 @@ "integrity": "ab2c55f902b380cf28e0eec501b4906e4c1960d13f00e11cfbcd21de15f18fed" } }, + "redirects": { + "https://lib.deno.dev/x/grammy@1.x/mod.ts": "https://deno.land/x/grammy@v1.31.3/mod.ts" + }, "remote": { "https://cdn.skypack.dev/-/debug@v4.3.4-o4liVvMlOnQWbLSYZMXw/dist=es2019,mode=imports/optimized/debug.js": "671100993996e39b501301a87000607916d4d2d9f8fc8e9c5200ae5ba64a1389", "https://cdn.skypack.dev/-/ms@v2.1.2-giBDZ1IA5lmQ3ZXaa87V/dist=es2019,mode=imports/optimized/ms.js": "fd88e2d51900437011f1ad232f3393ce97db1b87a7844b3c58dd6d65562c1276", @@ -67,6 +70,9 @@ "https://deno.land/x/grammy_types@v3.15.0/passport.ts": "19820e7d6c279521f8bc8912d6a378239f73d4ab525453808994b5f44ef95215", "https://deno.land/x/grammy_types@v3.15.0/payment.ts": "c899cd6528ddcf464e3318c9761abe77b1f0590076e38d25c8aa6c563636e18f", "https://deno.land/x/grammy_types@v3.15.0/settings.ts": "f8ff810da6f1007ed24cd504809bf46820229c395ff9bfc3e5c8ceaef5b2aae1", - "https://deno.land/x/grammy_types@v3.15.0/update.ts": "71cc0d5ec860149b71415ba03282b1d7edd0466b36e2789521a3b3a3d7796493" + "https://deno.land/x/grammy_types@v3.15.0/update.ts": "71cc0d5ec860149b71415ba03282b1d7edd0466b36e2789521a3b3a3d7796493", + "https://raw.githubusercontent.com/grammyjs/storages/5eda80d5f0dc4232c1affdda6aada6cc0ca3160d/packages/denokv/src/adapter.ts": "4db9e2289ded90ee86002baf0341043086431d55111d1f1e2c464323b9be7738", + "https://raw.githubusercontent.com/grammyjs/storages/5eda80d5f0dc4232c1affdda6aada6cc0ca3160d/packages/denokv/src/deps.ts": "13bb68745f9737e6f06164a2bb674e4655fb3554e2461cf75a1787c947422346", + "https://raw.githubusercontent.com/grammyjs/storages/5eda80d5f0dc4232c1affdda6aada6cc0ca3160d/packages/denokv/src/mod.ts": "e1dac7718b7f09e478bcd73b1efab26956f8328b9b39e9d922088bd7e2cc44d7" } } diff --git a/deps.ts b/deps.ts index a895a0e..c1c2ca7 100644 --- a/deps.ts +++ b/deps.ts @@ -19,4 +19,4 @@ export type { } from "https://deno.land/x/grammy@v1.31.3/types.ts"; export { DenoKVAdapter, -} from "https://deno.land/x/grammy_storages@v2.4.2/denokv/src/mod.ts"; +} from "https://raw.githubusercontent.com/grammyjs/storages/5eda80d5f0dc4232c1affdda6aada6cc0ca3160d/packages/denokv/src/mod.ts"; diff --git a/src/bot.ts b/src/bot.ts index 78449f9..5f17e25 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -6,7 +6,7 @@ import { PRIVATE_CHAT_COMMANDS } from "./helpers/constants.ts"; const BOT_TOKEN = Deno.env.get("BOT_TOKEN"); if (BOT_TOKEN == null) { - throw new Error("Set BOT_TOKEN environment variable.") + throw new Error("Set BOT_TOKEN environment variable."); } export const bot = new Bot(BOT_TOKEN); diff --git a/src/helpers/session.ts b/src/helpers/session.ts index 7439daa..6588209 100644 --- a/src/helpers/session.ts +++ b/src/helpers/session.ts @@ -39,4 +39,4 @@ export function initial(): SessionData { } export const kv = await Deno.openKv(); -export const storage = new DenoKVAdapter(kv); +export const storage = new DenoKVAdapter(kv, ["users"]);