Skip to content

Add component formatting support with Table class - #113

Open
chrisdedman wants to merge 9 commits into
mainfrom
component-formatting-class
Open

Add component formatting support with Table class#113
chrisdedman wants to merge 9 commits into
mainfrom
component-formatting-class

Conversation

@chrisdedman

Copy link
Copy Markdown
Contributor

Description

Added a new Table component for structured message rendering and support for sending component-formatted messages in Room and Context. This will improve the messaging capabilities by allowing more organized and visually appealing message formats.

Type of Change

  • Feature
  • Refactor
  • Bug fix
  • Documentation
  • Other: ___

Pre-merge Checklist

  • Run tests: pytest
  • Run type check: mypy
  • Run formatting: black .

@chrisdedman chrisdedman added the feature A new feature label Jul 9, 2026
@chrisdedman
chrisdedman requested a review from PenguinBoi12 July 9, 2026 00:05
@chrisdedman chrisdedman self-assigned this Jul 9, 2026
Comment thread matrix/component.py Outdated

@PenguinBoi12 PenguinBoi12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mostly good for me, the only thing I don't like is the html formatting. While we don't use anything else; write raw html, I think it's worth doing something like https://github.com/Code-Society-Lab/ada/blob/bc56c97b129e8c53d63cd1418f520caa0f802d21/bot/extensions/moderation/kick_extension.py#L10

You also forgot tests

Comment thread matrix/room.py Outdated
@PenguinBoi12

Copy link
Copy Markdown
Contributor

main's history has to be rewritten to adjust a commit's message, no file content changed but your PR's diff may look off until you either click "Update branch" or rebase locally:

git fetch origin
git rebase origin/main
git push --force-with-lease

@chrisdedman
chrisdedman force-pushed the component-formatting-class branch from 1329faf to 2b76240 Compare July 30, 2026 22:58
@chrisdedman
chrisdedman requested a review from PenguinBoi12 July 30, 2026 23:11

@PenguinBoi12 PenguinBoi12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one thing that's kind of important but the rest lgtm!

Comment thread matrix/component.py
table title are HTML-escaped when rendered.
"""

def __init__(self, *, title: str, columns: int = 2) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a validation on columns to in case someone puts 0 or a negative amount of columns:

if columns < 1:
    raise ValueError(...)

nit: I think we should call that column_count or something. When I see columns I expect a list of columns.

Comment thread examples/table.py

@bot.command()
async def weather(ctx):
weather = Table(title="Los Angeles", columns=2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would remove columns=2 since it's the default value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants