From 4fa2cf3ca8a0855adc11da28002ca130df9d3874 Mon Sep 17 00:00:00 2001 From: Kyle Fang Date: Thu, 4 May 2023 21:05:59 +0800 Subject: [PATCH] feat: add example --- src/index.test.ts | 25 ------------------------- src/index.ts | 1 - wrangler.toml.example | 11 +++++++++++ 3 files changed, 11 insertions(+), 26 deletions(-) delete mode 100644 src/index.test.ts create mode 100644 wrangler.toml.example diff --git a/src/index.test.ts b/src/index.test.ts deleted file mode 100644 index 974364b..0000000 --- a/src/index.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { unstable_dev } from "wrangler"; -import type { UnstableDevWorker } from "wrangler"; -import { describe, expect, it, beforeAll, afterAll } from "vitest"; - -describe("Worker", () => { - let worker: UnstableDevWorker; - - beforeAll(async () => { - worker = await unstable_dev("src/index.ts", { - experimental: { disableExperimentalWarning: true }, - }); - }); - - afterAll(async () => { - await worker.stop(); - }); - - it("should return Hello World", async () => { - const resp = await worker.fetch(); - if (resp) { - const text = await resp.text(); - expect(text).toMatchInlineSnapshot(`"Hello World!"`); - } - }); -}); diff --git a/src/index.ts b/src/index.ts index 512678f..0fc1304 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,7 +64,6 @@ router.post("/t/:webhookId", async (context) => { new Application().use(router.middleware).listen(); async function processUpdate(update: Update): Promise { - console.log(JSON.stringify(update, null, 2)); if (update.message == null) { return; } diff --git a/wrangler.toml.example b/wrangler.toml.example new file mode 100644 index 0000000..9c81d39 --- /dev/null +++ b/wrangler.toml.example @@ -0,0 +1,11 @@ +name = "telert" +main = "src/index.ts" +compatibility_date = "2023-05-01" + +kv_namespaces = [ + { binding = "TG_GROUPS", id = "***", preview_id = "***" } +] + +[vars] +BOT_TOKEN = "***" +WEBHOOK_PREFIX = "***"