Skip to content

Commit

Permalink
fix: add summary, on-the-go instructions and #build requirement
Browse files Browse the repository at this point in the history
Signed-off-by: Jasper Lutz Severino <jasperlutzseverino@gmail.com>
  • Loading branch information
lutzseverino committed Aug 8, 2022
1 parent f26e7b7 commit ec1d3d0
Showing 1 changed file with 59 additions and 2 deletions.
61 changes: 59 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ automatically on Discord.

## Summary

- [What is this?](#what-is-this-)
- [Summary](#summary)
- [Installation](#installation)
* [Available spins](#available-spins)
* [Versions](#versions)
- [Features](#features)
- [Usage](#usage)
* [Instantiating the library](#instantiating-the-library)
+ [Available default database technologies](#available-default-database-technologies)
* [Creating the book](#creating-the-book)
* [Adding pages](#adding-pages)
* [Customizing buttons](#customizing-buttons)
* [Adding component rows](#adding-component-rows)
* [Building the book](#building-the-book)
* [Registering the books](#registering-the-books)
* [Sending the books](#sending-the-books)
* [Sending on-the-go books](#sending-on-the-go-books)
* [Listening to the button event](#listening-to-the-button-event)
* [Handling errors](#handling-errors)
- [Credits](#credits)

## Installation

Add the following to your `pom.xml` file:
Expand Down Expand Up @@ -215,6 +236,22 @@ public class Example extends JDABook {
}
```

### Building the book

After all of that is done, we call the `#build()` method to stitch everything together.

```java
public class Example extends JDABook {
public Example() {
super("example");

// {...}

build();
}
}
```

### Registering the books

To register the books, you call the `#registerBooks` method.
Expand All @@ -228,7 +265,6 @@ public class Main {
}
}
```

### Sending the books

That was easy, right? Let's send the books!
Expand All @@ -238,9 +274,30 @@ be `JDAReceivable`.

```java
JDAReceivable jdaReceivable=new JDAReceivable(event.getChannel());
jdaReceivable.receive(DiscordBooks.getBook("example"));
jdaReceivable.receive(DiscordBooks.getBook("example"));
```

### Sending on-the-go books

Books don't necessarily need to be registered to be sent, you can create and send books on the spot.

```java
public class Main {
public static void main(String[] args) {
JDAReceivable jdaReceivable = new JDAReceivable(event.getChannel());

jdaReceivable.receive(new Book()
.addPages(
new SendableImpl("This is a temporary book!"),
new SendableImpl("With variable content, right " + event.getAuthor().getAsTag() + "?")
).build());
}
}
```

This book will be stored in the temporary database. Read [the first usage chapter](#instantiating-the-library) for more
information.

### Listening to the button event

The library comes with a pre-made listener for the buttons, you can use it by adding it to your respective library
Expand Down

0 comments on commit ec1d3d0

Please sign in to comment.