from botbuilder.core import TurnContext, MessageFactory, CardFactory from botbuilder.schema import Attachment from modules.database import DatabaseManager from modules.template import TemplateEngine class HelpCommand: def __init__(self, turn_context: TurnContext, database: DatabaseManager) -> None: self.turn_context = turn_context self.database = database async def handle_help(self) -> None: template = TemplateEngine("help-command-card") card = template.json_dict({ "card_title": "Help", "card_icon": "🚨", "card_description": "You can use the following commands to interact with the bot:", }) commands = [ { "title": "**/help**", "value": "Show this help message" }, { "title": "**/test** ", "value": "Test the bot" }, { "title": "**/webhooks** create", "value": "Create a new webhook" }, { "title": "**/webhooks** delete", "value": "Delete a webhook" }, { "title": "**/webhooks** list", "value": "List all webhooks" } ] card["body"][2]["facts"] = commands card_attachment = CardFactory.adaptive_card(card) await self.turn_context.send_activity(MessageFactory.attachment(card_attachment)) return