import axios from 'axios'
import { Bot, GrammyError, HttpError, Keyboard, Context, session, Middleware } from "grammy";
import { COMMANDS } from './commands/commands';
// import { Menu } from "@grammyjs/menu";
import { parserInstance } from './utils/parser';
import {
type Conversation,
type ConversationFlavor,
conversations,
createConversation,
} from "@grammyjs/conversations";
const bot = new Bot(import.meta.env.VITE_TELEGRAM_TOKEN || "");
// await bot.init();
bot.use(conversations());
bot.use(createConversation(greeting));
type MyContext = Context & ConversationFlavor;
type MyConversation = Conversation<MyContext>;
const greeting: Middleware<MyContext> = async (ctx) => {
await ctx.reply("Hi there! What is your name?");
const { message } = await ctx.conversation.wait();
if (message) {
await ctx.reply(`Welcome to the chat, ${message.text}!`);
}
};
Trying to implement conversations but get errors also on bot.use(conversations()); saying Argument of type 'MiddlewareFn<Context & ConversationFlavor>' is not assignable to parameter of type 'Middleware'.
Trying to implement conversations but get errors also on bot.use(conversations()); saying Argument of type 'MiddlewareFn<Context & ConversationFlavor>' is not assignable to parameter of type 'Middleware'.
Any suggestion?