grammyjs/website

Tutorial problem

murluki opened this issue · 5 comments

The code example from here https://grammy.dev/guide/getting-started.html
works for javascript but for typescript doesn't.

 import { Bot } from "grammy";

// Create an instance of the `Bot` class and pass your bot token to it.
const bot = new Bot(""); // <-- put your bot token between the ""

// You can now register listeners on your bot object `bot`.
// grammY will call the listeners when users send messages to your bot.

// Handle the /start command.
bot.command("start", (ctx) => ctx.reply("Welcome! Up and running."));
// Handle other messages.
bot.on("message", (ctx) => ctx.reply("Got another message!"));

// Now that you specified how to handle messages, you can start your bot.
// This will connect to the Telegram servers and wait for messages.

// Start the bot.
bot.start();

It gives the error : TypeError
shim_node_js_1.AbortController is not a constructor
for bot.start(); on https://codesandbox.io/s/inspiring-davinci-h7s2ll and gives a bunch of fs, os, https, path related issues on my local linux machine, even when I define them in the webconfig.

Could you maybe correct it or advise what is causing it?

rojvv commented

What’s the TypeScript version there in the sandbox? It’s working fine for me on TypeScript 5.0.3.

@roj1512 it's 4.5.4, let me try to update it

@roj1512 I've updated the version, but still same result
Plus it also gives an error on neutral codesandbox.io

Can you run the code locally without problems? It seems like this is a compatibility problem with the service that you're using.

Closing due to inactivity.