"""Scaffolding to host your LangChain Chatbot on Steamship and connect it to Telegram.""" from typing import List, Optional, Type from pydantic import Field from agent.base import BuddyAgentBot from telegram.ext import CommandHandler, CallbackContext, Application, ContextTypes from telegram import Update from telegram.ext import ( CommandHandler, CallbackContext, MessageHandler, filters ) VERBOSE = True async def hello(update: Update, context: CallbackContext) -> None: intro_text = "๐Ÿค– Welcome to BearBuddy, crafted by rexthecoder! I'm your extraordinary AI companion capable of accomplishing the impossible!\n\n๐Ÿ’ฌ Feel free to ask me about anything, whether it's mouthwatering ๐Ÿ” recipes, exciting โœˆ๏ธ travel destinations, effective ๐Ÿ‹๏ธโ€โ™€๏ธ fitness routines, strategic ๐Ÿ“ฑ marketing tips, or any other topic you can think of.\n\nDon't worry about the language barrierโ€”I'm here to assist you in any language!\nHow can I assist you today?" await update.message.reply_text(intro_text) class BuddyPanda(BuddyAgentBot, ): """Deploy LangChain chatbots and connect them to Telegram.""" token: str application: Application def __init__(self, token, application): super().__init__() self.application = application # application.add_handler(CommandHandler('start', hello)) # Run the bot until the user presses Ctrl-C # self.application.run_polling() self.token = token def handlers(self): summary_handler = self.conversation_summary_handler() self.application.add_handler(MessageHandler( filters.TEXT & ~filters.COMMAND, self.process_conversation)) self.application.add_handler(summary_handler) self.application.add_handler(CommandHandler('start', hello)) self.application.run_polling()