Refactoring in progress

- Context variables are no longer stored in `EventContext`, they are stored in `ContextVars` from now on
- Context variables related stuff has been moved to `mab.context.vars`
- Removed `CTX_FILE`
- Changed variable builder name prefix to `autobuild_`
- Changed variable builder signature to (EventContext, ContextVars)
- Most examples are broken
This commit is contained in:
2026-10-31 16:30:24 +03:00
parent 33efd5e104
commit eacb0c0d25
13 changed files with 171 additions and 205 deletions

View File

@@ -13,9 +13,9 @@ from mab import *
from _environment import check_environment
async def on_text_message(ctx: EventContext) -> None:
async def on_text_message(ctx: EventContext, vars: ContextVars) -> None:
"""This callback is called when a text message arrives."""
await ctx.bot.send.text(ctx.room, ctx[CTX_MESSAGE].body)
await ctx.bot.send.text(ctx.room, vars[CTX_MESSAGE].body)
async def main() -> None:
"""Application entry point"""