Skip to content

Comments

Group Factory#30

Merged
PenguinBoi12 merged 1 commit intomainfrom
group-factory
Feb 21, 2026
Merged

Group Factory#30
PenguinBoi12 merged 1 commit intomainfrom
group-factory

Conversation

@PenguinBoi12
Copy link
Contributor

@PenguinBoi12 PenguinBoi12 commented Feb 21, 2026

This PR adds a factory to create a group that can be used to extend the bot outside of the scope of the bot object. This is a first step to handle bigger bot.

# math_group.py
from matrix import group


@group("math", description="Math operations")
async def math_group(ctx):
    await ctx.reply("Math help")


@math_group.command()
async def add(ctx, a: int, b: int):
    await ctx.reply(f"{a + b}")

...
# bot.py
from matrix import Bot
from my_bot.math_group import math_group

bot = Bot(...)

...

bot.register_group(math_group)

@PenguinBoi12 PenguinBoi12 marked this pull request as ready for review February 21, 2026 04:10
await ctx.send_help()

ctx.logger.exception("error while executing command '%s'", self)
raise error
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a small fix that prevents errors from calling send_help twice.

Copy link
Contributor

@chrisdedman chrisdedman left a comment

Choose a reason for hiding this comment

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

LGTM

@PenguinBoi12 PenguinBoi12 merged commit dd753b6 into main Feb 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants