-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update code examples to use new Deno APIs #881
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🚀 Deployed on https://64c14120bdd07a152447abe1--grammy.netlify.app |
import { webhookCallback } from "https://deno.land/x/grammy/mod.ts"; | ||
// You might modify this to the correct way to import your `Bot` object. | ||
import { bot } from "./bot.ts"; | ||
|
||
const port = 8000; | ||
const handleUpdate = webhookCallback(bot, "std/http"); | ||
|
||
serve(async (req) => { | ||
Deno.serve(async (req) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The server options is the first argument in Deno.serve
API. So, that { port }
(the second argument here) needs to go up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right.
@@ -49,7 +48,7 @@ bot.command("ping", (ctx) => ctx.reply(`Pong! ${new Date()}`)); | |||
|
|||
const handleUpdate = webhookCallback(bot, "std/http"); | |||
|
|||
serve(async (req) => { | |||
Deno.serve(async (req) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, right? The server handler must return a Response
, but it looks like in catch
it doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right.
I think this is what I meant in #781 |
No description provided.