Skip to main content
Module

x/grammy/convenience/frameworks.deno.ts

The Telegram Bot Framework.
Very Popular
Go to Latest
File
import { adapters as sharedAdapters, SECRET_HEADER,} from "./frameworks.shared.ts";
const serveHttp = (requestEvent: Deno.RequestEvent) => ({ update: requestEvent.request.json(), header: requestEvent.request.headers.get(SECRET_HEADER) || undefined, end: () => requestEvent.respondWith(new Response(null, { status: 200 })), respond: (json: string) => requestEvent.respondWith( new Response(json, { status: 200, headers: { "Content-Type": "application/json" }, }), ), unauthorized: () => requestEvent.respondWith( new Response('"unauthorized"', { status: 401, statusText: "secret token is wrong", }), ),});
// please open a PR if you want to add anotherexport const adapters = { serveHttp, ...sharedAdapters,};export const defaultAdapter = "oak";