added indexes and stuff

This commit is contained in:
Dhravya 2024-06-23 17:24:10 -05:00
parent 47e7528f67
commit 9df975e88f
5 changed files with 735 additions and 9 deletions

View file

@ -0,0 +1,28 @@
import { Bot, webhookCallback } from "grammy";
import { User } from "grammy/types";
export const runtime = "edge";
if (!process.env.TELEGRAM_BOT_TOKEN) {
throw new Error("TELEGRAM_BOT_TOKEN is not defined");
}
console.log("Telegram bot activated");
const token = process.env.TELEGRAM_BOT_TOKEN;
const bot = new Bot(token);
bot.command("start", async (ctx) => {
const user: User = (await ctx.getAuthor()).user;
await ctx.reply(
`Welcome to Supermemory bot, ${user.first_name}. I am here to help you remember things better.`,
);
});
bot.on("message", async (ctx) => {
await ctx.reply(
"Hi there! This is Supermemory bot. I am here to help you remember things better.",
);
});
export const POST = webhookCallback(bot, "std/http");