mirror of
https://github.com/zhigang1992/telert.git
synced 2026-01-12 08:24:41 +08:00
feat: add example
This commit is contained in:
@@ -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!"`);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -64,7 +64,6 @@ router.post("/t/:webhookId", async (context) => {
|
||||
new Application().use(router.middleware).listen();
|
||||
|
||||
async function processUpdate(update: Update): Promise<void> {
|
||||
console.log(JSON.stringify(update, null, 2));
|
||||
if (update.message == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
11
wrangler.toml.example
Normal file
11
wrangler.toml.example
Normal file
@@ -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 = "***"
|
||||
Reference in New Issue
Block a user