"""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 LangChainAgentBot from telegram.ext import Updater, CommandHandler, CallbackContext, Application, ContextTypes from telegram import Update from telegram.ext import ( CommandHandler, ConversationHandler, CallbackContext, MessageHandler, filters ) VERBOSE = True async def hello(update: Update, context: CallbackContext) -> None: intro_text = f"šŸ¤– Greetings human!šŸ¤—\nI'm a bot built by Rexthecoder\nšŸ¦¾ I can do a lot of things" await update.message.reply_text(intro_text) class GirlfriendGPT(LangChainAgentBot, ): """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()