-
Notifications
You must be signed in to change notification settings - Fork 0
Introduction
With Discord Books, you can create book-like messages on Discord by taking advantage of buttons. We do this by sending a message, placing navigation buttons, and editing the message to a particular page accordingly.
Before using this library, we must understand a vital limitation and how we work around it.
There is no actual “book”; Discord cannot store “pages”; we need to handle all of that ourselves.
To do that, the ID of the buttons point to what should be applied, e.g., book:example@1
. This button would point to page nº1 inside the “example” book.
This is important because, with this information, we now know that the book listening process – that is, the buttons actually “turning” the pages – cannot be permanent; they need to expire at some point because they exist in our program’s memory.
We can maximize the library’s abilities and workaround that issue with a significant trade-off.
By creating books that contain static content and registering them on every startup, books can survive reboots. This works because we don’t tie books with their respective messages; we tie them with something that exists in your source.
The apparent trade-off lies in the word “static”; content cannot be interactive if we choose this method.
The aforementioned trade-off is gigantic, so it makes sense that you use expiring or temporary books for specific use cases.
This is still possible using this library. You can create books on the spot, save them in a database of your choice, and customize the behavior once that book has expired.