refactor: async I/O, input sanitisation, and shared utilities cleanup
This commit is contained in:
@@ -55,3 +55,28 @@ def is_public_destination(target: str) -> bool:
|
||||
except Exception as e:
|
||||
logger.warning(f"Cannot resolve {target}: {e}")
|
||||
return False
|
||||
|
||||
async def handle_command(room, message, bot, prefix, config):
|
||||
"""No-op handler so the bot doesn't crash when loading this module as a plugin."""
|
||||
pass
|
||||
|
||||
async def send_html_message(bot, room_id, html_body, markdown_fallback):
|
||||
"""Send an HTML-formatted message with a Markdown fallback.
|
||||
|
||||
Args:
|
||||
bot: simplematrixbotlib.Bot instance
|
||||
room_id: Matrix room ID
|
||||
html_body: HTML string (table, etc.)
|
||||
markdown_fallback: Markdown/plain text for clients that don't render HTML
|
||||
"""
|
||||
content = {
|
||||
"msgtype": "m.text",
|
||||
"body": markdown_fallback,
|
||||
"format": "org.matrix.custom.html",
|
||||
"formatted_body": html_body
|
||||
}
|
||||
await bot.async_client.room_send(
|
||||
room_id=room_id,
|
||||
message_type="m.room.message",
|
||||
content=content
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user