Build written book items with a fluent API

BookBuilder

BookBuilder creates written book Item objects with a fluent interface.

from bridge import BookBuilder

book = (BookBuilder("My Guide", "Server")
        .page("Welcome to the server!")
        .page("Chapter 2: Rules")
        .page("Chapter 3: Commands")
        .build())

await player.open_book(book)

Constructor

BookBuilder(title="Book", author="Server")

Methods

All setter methods return BookBuilder for chaining.

.title(title)

Set the book title.

.author(author)

Set the book author.

.page(content)

Add a single page.

.pages(*contents)

Add multiple pages at once.

book = (BookBuilder("Story")
        .pages("Once upon a time...",
               "The hero ventured forth...",
               "The end.")
        .build())

.build()

Build the final book item.