Skip to content
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

Merged
merged 3 commits into from
Jul 26, 2023
Merged

Update code examples to use new Deno APIs #881

merged 3 commits into from
Jul 26, 2023

Conversation

rojvv
Copy link
Member

@rojvv rojvv commented Jul 26, 2023

No description provided.

@rojvv rojvv added not translatable Translator intervention is not required. 🇪🇸 ES Modifies or is related to the Spanish translations. 🇨🇳 ZH Modifies or is related to the Chinese translations. 🇮🇩 ID Modifies or is related to the Indonesian translations. 🇺🇦 UK Modifies or is related to the Ukrainian translations. labels Jul 26, 2023
Copy link
Contributor

@roziscoding roziscoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link

@github-actions github-actions bot temporarily deployed to pull request July 26, 2023 15:52 Inactive
@rojvv rojvv added this pull request to the merge queue Jul 26, 2023
Merged via the queue into main with commit 982e875 Jul 26, 2023
4 checks passed
@rojvv rojvv deleted the ce branch July 26, 2023 15:52
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) => {
Copy link
Member

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.

Copy link
Member Author

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) => {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right.

@KnorpelSenf
Copy link
Member

I think this is what I meant in #781

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🇨🇳 ZH Modifies or is related to the Chinese translations. 🇪🇸 ES Modifies or is related to the Spanish translations. 🇮🇩 ID Modifies or is related to the Indonesian translations. not translatable Translator intervention is not required. 🇺🇦 UK Modifies or is related to the Ukrainian translations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants