Skip to content

hikari-risa

Components V2 views for hikari, with state that survives restarts.

Get started Learn by example

uv add hikari-risa

Risa, the mascot of hikari-risa

Survives restarts. The state travels inside the message. Add Redis or Postgres when it outgrows the message or many people click at once.

Components V2 first. Build with containers, sections and galleries. A row of buttons is the simple case.

Typed all the way. risa passes pyright strict, so your editor knows every field.

Coming from miru? See what changes.

@risa.register(name="counter")
class Counter(risa.View):
    count: int = 0

    def render(self) -> ui.Layout:
        return ui.Container(
            ui.TextDisplay(f"Clicks: **{self.count}**"),
            ui.Row(ui.Button(self.click, label="+1")),
        )

    @risa.handler
    async def click(self, ctx: risa.ComponentContext) -> None:
        self.count += 1
        await ctx.rerender()
Risa BotAPPToday at 12:00

Clicks: 0

+1

custom_id 1aDON~-7b~!0Z2${yC076d0FeL

Click it. In a real bot the count survives a restart, because it lives in the button itself.