Add /browse command to AnthropicTelegramInferenceBot

This commit is contained in:
cyclop-bot
2024-08-20 16:50:05 -05:00
parent 8ee1ae9224
commit 9f8418b47d
+11
View File
@@ -4,6 +4,7 @@ import logging
from anthropic import Anthropic from anthropic import Anthropic
from base_telegram_inference_bot import BaseTelegramInferenceBot from base_telegram_inference_bot import BaseTelegramInferenceBot
from telegram_helper import TelegramHelper from telegram_helper import TelegramHelper
from browse_command import browse_command, button_callback
class AnthropicTelegramInferenceBot(BaseTelegramInferenceBot): class AnthropicTelegramInferenceBot(BaseTelegramInferenceBot):
def __init__(self): def __init__(self):
@@ -101,9 +102,19 @@ class AnthropicTelegramInferenceBot(BaseTelegramInferenceBot):
else: else:
return "No active processing to abort." return "No active processing to abort."
async def browse(self, update, context):
await browse_command(update, context)
def main(): def main():
bot = AnthropicTelegramInferenceBot() bot = AnthropicTelegramInferenceBot()
telegram_helper = TelegramHelper(bot) telegram_helper = TelegramHelper(bot)
# Add the /browse command handler
telegram_helper.add_command_handler('browse', bot.browse)
# Add the button callback handler
telegram_helper.add_callback_query_handler(button_callback)
telegram_helper.run() telegram_helper.run()
if __name__ == '__main__': if __name__ == '__main__':