mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-05 23:40:57 +00:00
added indexes and stuff
This commit is contained in:
parent
47e7528f67
commit
9df975e88f
5 changed files with 735 additions and 9 deletions
28
apps/web/app/api/telegram/route.ts
Normal file
28
apps/web/app/api/telegram/route.ts
Normal 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");
|
||||
Loading…
Add table
Add a link
Reference in a new issue