Wastu
Wastu10mo ago

Long Running Scripts

Hello, I want to create a telegram bot using grammy.dev as framework. But the script is ended even though I'm using bot.start();. Is there any way to make the script run longer? Here is my code:
import { Bot } from "https://deno.land/x/grammy@v1.20.3/mod.ts";
import * as wmill from "https://deno.land/x/windmill@v1.248.0/mod.ts";

export async function main(debug: boolean) {
const token = debug
? (await wmill.getVariable("u/x/telegram_bot_token_dev"))!
: (await wmill.getVariable("u/x/telegram_bot_token"))!;

const bot = new Bot(token);

bot.on("message", (ctx) => ctx.reply("Got another message!"));

bot.start();
}
import { Bot } from "https://deno.land/x/grammy@v1.20.3/mod.ts";
import * as wmill from "https://deno.land/x/windmill@v1.248.0/mod.ts";

export async function main(debug: boolean) {
const token = debug
? (await wmill.getVariable("u/x/telegram_bot_token_dev"))!
: (await wmill.getVariable("u/x/telegram_bot_token"))!;

const bot = new Bot(token);

bot.on("message", (ctx) => ctx.reply("Got another message!"));

bot.start();
}
2 Replies
rubenf
rubenf10mo ago
You need to await on it
Wastu
Wastu10mo ago
ah, silly me. Thanks!