diff --git a/site/docs/es/guide/deployment-types.md b/site/docs/es/guide/deployment-types.md index 2b4db828b..ba9728393 100644 --- a/site/docs/es/guide/deployment-types.md +++ b/site/docs/es/guide/deployment-types.md @@ -258,26 +258,26 @@ El segundo parámetro pasado a `webhookCallback` ([API reference](/ref/core/webh Debido a cómo funciona este enfoque, normalmente necesitamos un adaptador para cada framework pero, dado que algunos frameworks comparten una interfaz similar, hay adaptadores que se sabe que funcionan con múltiples frameworks. A continuación se muestra una tabla con los adaptadores disponibles actualmente, los frameworks o APIs con los que se sabe que funcionan y los tiempos de ejecución en los que están disponibles. -| Adapter | Framework/API/Runtime | -| ------------------ | ------------------------------------------------------------------------------ | -| `aws-lambda` | AWS Lambda Functions | -| `aws-lambda-async` | AWS Lambda Functions with `async`/`await` | -| `azure` | Azure Functions | -| `bun` | `Bun.serve` | -| `cloudflare` | Cloudflare Workers | -| `cloudflare-mod` | Cloudflare Module Workers | -| `express` | Express, Google Cloud Functions | -| `fastify` | Fastify | -| `hono` | Hono | -| `http`, `https` | Node.js `http`/`https` modules, Vercel | -| `koa` | Koa | -| `next-js` | Next.js | -| `nhttp` | NHttp | -| `oak` | Oak | -| `serveHttp` | `Deno.serveHttp` | -| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift` | -| `sveltekit` | SvelteKit | -| `worktop` | Worktop | +| Adapter | Framework/API/Runtime | +| ------------------ | --------------------------------------------------------------------------------------------------- | +| `aws-lambda` | AWS Lambda Functions | +| `aws-lambda-async` | AWS Lambda Functions with `async`/`await` | +| `azure` | Azure Functions | +| `bun` | `Bun.serve` | +| `cloudflare` | Cloudflare Workers | +| `cloudflare-mod` | Cloudflare Module Workers | +| `express` | Express, Google Cloud Functions | +| `fastify` | Fastify | +| `hono` | Hono | +| `http`, `https` | Node.js `http`/`https` modules, Vercel Serverless | +| `koa` | Koa | +| `next-js` | Next.js | +| `nhttp` | NHttp | +| `oak` | Oak | +| `serveHttp` | `Deno.serveHttp` | +| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift`, Vercel Edge Runtime | +| `sveltekit` | SvelteKit | +| `worktop` | Worktop | ### Webhook Reply diff --git a/site/docs/es/hosting/vercel.md b/site/docs/es/hosting/vercel.md index 41c6494a2..a97e69aed 100644 --- a/site/docs/es/hosting/vercel.md +++ b/site/docs/es/hosting/vercel.md @@ -88,12 +88,21 @@ Puedes seguir usando el paquete principal de grammY y un número de plugins, per Actualmente, no tenemos una lista completa de plugins compatibles, así que tienes que probarlo por ti mismo. -Añada esta línea al fragmento anterior si desea cambiar a Edge Functions: +Utilice este fragmento si desea cambiar a Funciones sin servidor: ```ts +import { Bot, webhookCallback } from "grammy"; + +const token = process.env.BOT_TOKEN; +if (!token) throw new Error("BOT_TOKEN no está definido"); + +const bot = new Bot(token); + export const config = { runtime: "edge", }; + +export default webhookCallback(bot, "std/http"); ``` ::: diff --git a/site/docs/guide/deployment-types.md b/site/docs/guide/deployment-types.md index c40f44dae..cdc79ac72 100644 --- a/site/docs/guide/deployment-types.md +++ b/site/docs/guide/deployment-types.md @@ -257,26 +257,26 @@ The second parameter passed to `webhookCallback` ([API reference](/ref/core/webh Because of how this approach works, we usually need an adapter for each framework but, since some frameworks share a similiar interface, there are adapters that are known to work with multiple frameworks. Below is a table containing the currently available adapters, and the framework, APIs, or runtimes they are known to work with. -| Adapter | Framework/API/Runtime | -| ------------------ | ------------------------------------------------------------------------------ | -| `aws-lambda` | AWS Lambda Functions | -| `aws-lambda-async` | AWS Lambda Functions with `async`/`await` | -| `azure` | Azure Functions | -| `bun` | `Bun.serve` | -| `cloudflare` | Cloudflare Workers | -| `cloudflare-mod` | Cloudflare Module Workers | -| `express` | Express, Google Cloud Functions | -| `fastify` | Fastify | -| `hono` | Hono | -| `http`, `https` | Node.js `http`/`https` modules, Vercel | -| `koa` | Koa | -| `next-js` | Next.js | -| `nhttp` | NHttp | -| `oak` | Oak | -| `serveHttp` | `Deno.serveHttp` | -| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift` | -| `sveltekit` | SvelteKit | -| `worktop` | Worktop | +| Adapter | Framework/API/Runtime | +| ------------------ | --------------------------------------------------------------------------------------------------- | +| `aws-lambda` | AWS Lambda Functions | +| `aws-lambda-async` | AWS Lambda Functions with `async`/`await` | +| `azure` | Azure Functions | +| `bun` | `Bun.serve` | +| `cloudflare` | Cloudflare Workers | +| `cloudflare-mod` | Cloudflare Module Workers | +| `express` | Express, Google Cloud Functions | +| `fastify` | Fastify | +| `hono` | Hono | +| `http`, `https` | Node.js `http`/`https` modules, Vercel Serverless | +| `koa` | Koa | +| `next-js` | Next.js | +| `nhttp` | NHttp | +| `oak` | Oak | +| `serveHttp` | `Deno.serveHttp` | +| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift`, Vercel Edge Runtime | +| `sveltekit` | SvelteKit | +| `worktop` | Worktop | ### Webhook Reply diff --git a/site/docs/hosting/vercel.md b/site/docs/hosting/vercel.md index f61bcb4cb..3c7002da0 100644 --- a/site/docs/hosting/vercel.md +++ b/site/docs/hosting/vercel.md @@ -88,12 +88,21 @@ You can still use the core grammY package and a number of plugins, but others ma Currently, we don't have a comprehensive list of compatible plugins, so you need to test it by yourself. -Add this line to snippet above if you want to switch to Edge Functions: +Use this snippet below if you want to switch to Edge Functions: ```ts +import { Bot, webhookCallback } from "grammy"; + +const token = process.env.BOT_TOKEN; +if (!token) throw new Error("BOT_TOKEN is unset"); + +const bot = new Bot(token); + export const config = { runtime: "edge", }; + +export default webhookCallback(bot, "std/http"); ``` ::: diff --git a/site/docs/id/guide/deployment-types.md b/site/docs/id/guide/deployment-types.md index bb46e5f39..02583ac06 100644 --- a/site/docs/id/guide/deployment-types.md +++ b/site/docs/id/guide/deployment-types.md @@ -263,26 +263,26 @@ Karena menggunakan pendekatan dengan cara tersebut, biasanya kita membutuhkan se Tetapi, berhubung beberapa framework memiliki interface yang mirip, kita bisa menggunakan adapter yang sama untuk beberapa framework sekaligus. Di bawah ini adalah tabel berisi berbagai macam adapter yang tersedia beserta jenis framework, API, dan runtime yang diketahui berfungsi dengan baik di grammY. -| Adapter | Framework/API/Runtime | -| ------------------ | ------------------------------------------------------------------------------ | -| `aws-lambda` | AWS Lambda Functions | -| `aws-lambda-async` | AWS Lambda Functions dengan `async`/`await` | -| `azure` | Azure Functions | -| `bun` | `Bun.serve` | -| `cloudflare` | Cloudflare Workers | -| `cloudflare-mod` | Cloudflare Module Workers | -| `express` | Express, Google Cloud Functions | -| `fastify` | Fastify | -| `hono` | Hono | -| `http`, `https` | Node.js `http`/`https` modules, Vercel | -| `koa` | Koa | -| `next-js` | Next.js | -| `nhttp` | NHttp | -| `oak` | Oak | -| `serveHttp` | `Deno.serveHttp` | -| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift` | -| `sveltekit` | SvelteKit | -| `worktop` | Worktop | +| Adapter | Framework/API/Runtime | +| ------------------ | --------------------------------------------------------------------------------------------------- | +| `aws-lambda` | AWS Lambda Functions | +| `aws-lambda-async` | AWS Lambda Functions dengan `async`/`await` | +| `azure` | Azure Functions | +| `bun` | `Bun.serve` | +| `cloudflare` | Cloudflare Workers | +| `cloudflare-mod` | Cloudflare Module Workers | +| `express` | Express, Google Cloud Functions | +| `fastify` | Fastify | +| `hono` | Hono | +| `http`, `https` | Node.js `http`/`https` modules, Vercel Serverless | +| `koa` | Koa | +| `next-js` | Next.js | +| `nhttp` | NHttp | +| `oak` | Oak | +| `serveHttp` | `Deno.serveHttp` | +| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift`, Vercel Edge Runtime | +| `sveltekit` | SvelteKit | +| `worktop` | Worktop | ### Webhook Reply diff --git a/site/docs/id/hosting/vercel.md b/site/docs/id/hosting/vercel.md index 1e8700f49..b16230159 100644 --- a/site/docs/id/hosting/vercel.md +++ b/site/docs/id/hosting/vercel.md @@ -88,12 +88,21 @@ Meski kamu masih bisa menggunakan paket inti grammY dan sejumlah plugin lainnya, Saat ini, kami tidak memiliki daftar lengkap plugin yang kompatibel, sehingga kamu perlu mencobanya sendiri. -Tambahkan baris ini pada kode di atas jika kamu ingin beralih ke Edge Functions: +Gunakan baris kode berikut jika kamu ingin beralih ke Edge Functions: ```ts +import { Bot, webhookCallback } from "grammy"; + +const token = process.env.BOT_TOKEN; +if (!token) throw new Error("BOT_TOKEN belum disetel!"); + +const bot = new Bot(token); + export const config = { runtime: "edge", }; + +export default webhookCallback(bot, "std/http"); ``` ::: diff --git a/site/docs/ru/guide/deployment-types.md b/site/docs/ru/guide/deployment-types.md index 80f42fd9a..e7dceb6fe 100644 --- a/site/docs/ru/guide/deployment-types.md +++ b/site/docs/ru/guide/deployment-types.md @@ -257,26 +257,26 @@ await bot.api.setWebhook(endpoint); Из-за того, что этот подход работает, нам обычно нужен адаптер для каждого фреймворка, но, поскольку некоторые фреймворки имеют схожий интерфейс, существуют адаптеры, которые, как известно, работают с несколькими фреймворками. Ниже приведена таблица с доступными на данный момент адаптерами, а также фреймворками, API или режимами выполнения, с которыми они работают. -| Адаптер | Фреймворк/API/Среда выполнения | -| ------------------ | ------------------------------------------------------------------------------ | -| `aws-lambda` | AWS Lambda Functions | -| `aws-lambda-async` | AWS Lambda Functions с `async`/`await` | -| `azure` | Azure Functions | -| `bun` | `Bun.serve` | -| `cloudflare` | Cloudflare Workers | -| `cloudflare-mod` | Cloudflare Module Workers | -| `express` | Express, Google Cloud Functions | -| `fastify` | Fastify | -| `hono` | Hono | -| `http`, `https` | Node.js `http`/`https` modules, Vercel | -| `koa` | Koa | -| `next-js` | Next.js | -| `nhttp` | NHttp | -| `oak` | Oak | -| `serveHttp` | `Deno.serveHttp` | -| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift` | -| `sveltekit` | SvelteKit | -| `worktop` | Worktop | +| Адаптер | Фреймворк/API/Среда выполнения | +| ------------------ | --------------------------------------------------------------------------------------------------- | +| `aws-lambda` | AWS Lambda Functions | +| `aws-lambda-async` | AWS Lambda Functions с `async`/`await` | +| `azure` | Azure Functions | +| `bun` | `Bun.serve` | +| `cloudflare` | Cloudflare Workers | +| `cloudflare-mod` | Cloudflare Module Workers | +| `express` | Express, Google Cloud Functions | +| `fastify` | Fastify | +| `hono` | Hono | +| `http`, `https` | Node.js `http`/`https` modules, Vercel Serverless | +| `koa` | Koa | +| `next-js` | Next.js | +| `nhttp` | NHttp | +| `oak` | Oak | +| `serveHttp` | `Deno.serveHttp` | +| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift`, Vercel Edge Runtime | +| `sveltekit` | SvelteKit | +| `worktop` | Worktop | ### Ответ вебхука diff --git a/site/docs/ru/hosting/vercel.md b/site/docs/ru/hosting/vercel.md index 0b14ad08f..f369e34ac 100644 --- a/site/docs/ru/hosting/vercel.md +++ b/site/docs/ru/hosting/vercel.md @@ -91,9 +91,18 @@ export default webhookCallback(bot, "https"); Добавьте эту строку к приведенному выше сниппету, если вы хотите перейти на Edge Functions: ```ts +import { Bot, webhookCallback } from "grammy"; + +const token = process.env.BOT_TOKEN; +if (!token) throw new Error("BOT_TOKEN не назначен"); + +const bot = new Bot(token); + export const config = { runtime: "edge", }; + +export default webhookCallback(bot, "std/http"); ``` ::: diff --git a/site/docs/uk/guide/deployment-types.md b/site/docs/uk/guide/deployment-types.md index b9be1dabf..a31c5ff38 100644 --- a/site/docs/uk/guide/deployment-types.md +++ b/site/docs/uk/guide/deployment-types.md @@ -257,26 +257,26 @@ await bot.api.setWebhook(endpoint); Через те, як працює цей підхід, нам зазвичай потрібен адаптер для кожного фреймворку, але, оскільки деякі фреймворки мають схожий інтерфейс, є адаптери, які працюють з кількома фреймворками. Нижче наведено таблицю з доступними на даний момент адаптерами, а також фреймворками, API або середовищами виконання, з якими вони працюють. -| Адаптер | Фреймворк, API або середовище виконання | -| ------------------ | ------------------------------------------------------------------------------ | -| `aws-lambda` | AWS Lambda Functions | -| `aws-lambda-async` | AWS Lambda Functions з `async/await` | -| `azure` | Azure Functions | -| `bun` | `Bun.serve` | -| `cloudflare` | Cloudflare Workers | -| `cloudflare-mod` | Cloudflare Module Workers | -| `express` | Express, Google Cloud Functions | -| `fastify` | Fastify | -| `hono` | Hono | -| `http`, `https` | Модулі Node.js `http` або `https`, Vercel | -| `koa` | Koa | -| `next-js` | Next.js | -| `nhttp` | NHttp | -| `oak` | Oak | -| `serveHttp` | `Deno.serveHttp` | -| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift` | -| `sveltekit` | SvelteKit | -| `worktop` | Worktop | +| Адаптер | Фреймворк, API або середовище виконання | +| ------------------ | --------------------------------------------------------------------------------------------------- | +| `aws-lambda` | AWS Lambda Functions | +| `aws-lambda-async` | AWS Lambda Functions з `async/await` | +| `azure` | Azure Functions | +| `bun` | `Bun.serve` | +| `cloudflare` | Cloudflare Workers | +| `cloudflare-mod` | Cloudflare Module Workers | +| `express` | Express, Google Cloud Functions | +| `fastify` | Fastify | +| `hono` | Hono | +| `http`, `https` | Модулі Node.js `http` або `https`, Vercel Serverless | +| `koa` | Koa | +| `next-js` | Next.js | +| `nhttp` | NHttp | +| `oak` | Oak | +| `serveHttp` | `Deno.serveHttp` | +| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift`, Vercel Edge Runtime | +| `sveltekit` | SvelteKit | +| `worktop` | Worktop | ### Відповідь вебхуку diff --git a/site/docs/uk/hosting/vercel.md b/site/docs/uk/hosting/vercel.md index 2ea63dc19..e0c02e300 100644 --- a/site/docs/uk/hosting/vercel.md +++ b/site/docs/uk/hosting/vercel.md @@ -88,12 +88,21 @@ export default webhookCallback(bot, "https"); Наразі ми не маємо повного списку сумісних плагінів, тому вам доведеться перевірити це самостійно. -Додайте цей рядок до фрагмента вище, якщо ви хочете переключитися на Edge Functions: +Використовуйте наведений нижче фрагмент коду, якщо ви хочете переключитися на Edge Functions: ```ts +import { Bot, webhookCallback } from "grammy"; + +const token = process.env.BOT_TOKEN; +if (!token) throw new Error("BOT_TOKEN is unset"); + +const bot = new Bot(token); + export const config = { runtime: "edge", }; + +export default webhookCallback(bot, "std/http"); ``` ::: diff --git a/site/docs/zh/guide/deployment-types.md b/site/docs/zh/guide/deployment-types.md index 20259a697..1cdac11a4 100644 --- a/site/docs/zh/guide/deployment-types.md +++ b/site/docs/zh/guide/deployment-types.md @@ -258,26 +258,26 @@ await bot.api.setWebhook(endpoint); 由于这种方法的工作方式,我们通常需要为每个框架配备一个适配器,但是,由于某些框架共享相似的接口,因此已知适配器可以与多个框架一起工作。 下表包含当前可用的适配器,以及它们已知可使用的框架、API 或运行时。 -| 适配器 | 框架/API/运行时 | -| ------------------ | ------------------------------------------------------------------------------ | -| `aws-lambda` | AWS Lambda Functions | -| `aws-lambda-async` | AWS Lambda Functions with `async`/`await` | -| `azure` | Azure Functions | -| `bun` | `Bun.serve` | -| `cloudflare` | Cloudflare Workers (Service Worker) | -| `cloudflare-mod` | Cloudflare Workers (Module Worker) | -| `express` | Express, Google Cloud Functions | -| `fastify` | Fastify | -| `hono` | Hono | -| `http`, `https` | Node.js `http`/`https` modules, Vercel | -| `koa` | Koa | -| `next-js` | Next.js | -| `nhttp` | NHttp | -| `oak` | Oak | -| `serveHttp` | `Deno.serveHttp` | -| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift` | -| `sveltekit` | SvelteKit | -| `worktop` | Worktop | +| 适配器 | 框架/API/运行时 | +| ------------------ | --------------------------------------------------------------------------------------------------- | +| `aws-lambda` | AWS Lambda Functions | +| `aws-lambda-async` | AWS Lambda Functions with `async`/`await` | +| `azure` | Azure Functions | +| `bun` | `Bun.serve` | +| `cloudflare` | Cloudflare Workers | +| `cloudflare-mod` | Cloudflare Module Workers | +| `express` | Express, Google Cloud Functions | +| `fastify` | Fastify | +| `hono` | Hono | +| `http`, `https` | Node.js `http`/`https` modules, Vercel Serverless | +| `koa` | Koa | +| `next-js` | Next.js | +| `nhttp` | NHttp | +| `oak` | Oak | +| `serveHttp` | `Deno.serveHttp` | +| `std/http` | `Deno.serve`, `std/http`, `Deno.upgradeHttp`, `Fresh`, `Ultra`, `Rutt`, `Sift`, Vercel Edge Runtime | +| `sveltekit` | SvelteKit | +| `worktop` | Worktop | ### Webhook Reply diff --git a/site/docs/zh/hosting/vercel.md b/site/docs/zh/hosting/vercel.md index 70e142d55..628afd421 100644 --- a/site/docs/zh/hosting/vercel.md +++ b/site/docs/zh/hosting/vercel.md @@ -88,12 +88,21 @@ export default webhookCallback(bot, "https"); 目前,我们没有完整的兼容插件列表,因此你需要自行测试。 -如果你想切换到 Edge Functions,请将此行添加到上面的代码片段中: +如果你想切换到 Edge Functions,请使用下面的代码片段: ```ts +import { Bot, webhookCallback } from "grammy"; + +const token = process.env.BOT_TOKEN; +if (!token) throw new Error("BOT_TOKEN is unset"); + +const bot = new Bot(token); + export const config = { runtime: "edge", }; + +export default webhookCallback(bot, "std/http"); ``` :::