"""Send file tool — sends documents to the user via Telegram.""" from tools import messaging def send_file(file_content: str, filename: str, caption: str = '') -> str: """Send a file to the user as a Telegram document attachment. Args: file_content: The text content of the file to send. filename: The filename (e.g. 'report.txt', 'data.csv'). caption: Optional caption to display with the file. """ adapter = messaging._adapter if adapter is None: return 'No channel adapter configured.' if not hasattr(adapter, 'send_document'): return 'Channel adapter does not support file sending.' file_bytes = file_content.encode('utf-8') msg_id = adapter.send_document(file_bytes, filename, caption) return f'File "{filename}" sent (id={msg_id})' if msg_id else f'File "{filename}" sent'