This repository has been archived by the owner on Oct 16, 2024. It is now read-only.
generated from PonomareVlad/grammYVercel
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
396bd76
commit d28ada1
Showing
7 changed files
with
24 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import {webhookStream} from "vercel-grammy"; | ||
import {bot, secretToken} from "../src/bot.mjs"; | ||
import {webhookStream} from "vercel-grammy"; | ||
|
||
export const config = {runtime: "edge"}; | ||
|
||
// Custom grammY handler for incoming updates via webhooks with streaming response | ||
export default webhookStream(bot, { | ||
export const POST = webhookStream(bot, { | ||
timeoutMilliseconds: 59_000, | ||
secretToken, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import {setWebhookCallback} from "vercel-grammy"; | ||
import {bot, secretToken} from "../src/bot.mjs"; | ||
import {setWebhookCallback} from "vercel-grammy"; | ||
|
||
export const config = {runtime: "edge"}; | ||
|
||
// Handler to set webhook url based on request headers | ||
export default setWebhookCallback(bot, { | ||
secret_token: secretToken, | ||
export const POST = setWebhookCallback(bot, { | ||
path: "api/update", | ||
onError: "return" | ||
onError: "return", | ||
secretToken, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import {bot} from "../src/bot.mjs"; | ||
|
||
// Prevent error throw | ||
bot.catch(console.error); | ||
|
||
// Starts bot in long-polling mode | ||
await bot.start(); |