Voyage Bagage
Voyage Bagage
CDCloudflare Developers
Created by Voyage Bagage on 10/3/2024 in #workers-help
telegram bot issue wrkr not responding, no logs
I have one bot made the same way in JS that responding fine with telegraf api, but I have tried to build new ones with JS or TS , with hono JS or TS, grammY or without bot API . I tried to make very small project with only one bot.command() but it is not working properly as expected...the /start cmd are always pending and coming randomly all at once...so I have maybe 3 answers per cmd. I figure because I have one working that it should something I'm missing towards the functioning of workers. I pretty much do the same , but the working one is using KV.... are they some limits on the free tier ? example, this the grammyY starter that doesn't work... I DON'T GET ANY LOGS and the webhook is set
import { Bot, Context, webhookCallback } from "grammy";

export interface Env {
BOT_INFO: string;
BOT_TOKEN: string;
}
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext,
): Promise<Response> {
const bot = new Bot(env.BOT_TOKEN, { botInfo: JSON.parse(env.BOT_INFO) });
bot.command("start", async (ctx: Context) => {
await ctx.reply("Hello, world!");
});

return webhookCallback(bot, "cloudflare-mod")(request);
},
};
import { Bot, Context, webhookCallback } from "grammy";

export interface Env {
BOT_INFO: string;
BOT_TOKEN: string;
}
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext,
): Promise<Response> {
const bot = new Bot(env.BOT_TOKEN, { botInfo: JSON.parse(env.BOT_INFO) });
bot.command("start", async (ctx: Context) => {
await ctx.reply("Hello, world!");
});

return webhookCallback(bot, "cloudflare-mod")(request);
},
};
THANKS
2 replies