-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
126 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...in/kotlin/com/kotlindiscord/kord/extensions/pagination/builders/PageTransitionCallback.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.kotlindiscord.kord.extensions.pagination.builders | ||
|
||
import com.kotlindiscord.kord.extensions.pagination.BasePaginator | ||
import com.kotlindiscord.kord.extensions.pagination.pages.Page | ||
import dev.kord.rest.builder.message.EmbedBuilder | ||
|
||
public typealias PageMutator = suspend EmbedBuilder.(page: Page) -> Unit | ||
public typealias PaginatorMutator = suspend BasePaginator.() -> Unit | ||
|
||
/** Builder containing callbacks used to modify paginators and their page content. **/ | ||
public class PageTransitionCallback { | ||
/** @suppress Variable storing the page mutator. **/ | ||
public var pageMutator: PageMutator? = null | ||
|
||
/** @suppress Variable storing the paginator mutator. **/ | ||
public var paginatorMutator: PaginatorMutator? = null | ||
|
||
/** | ||
* Set the page mutator callback. | ||
* | ||
* Called just after we apply the page's embed builder, and just before the page modifies the embed's footer. | ||
*/ | ||
public fun page(body: PageMutator) { | ||
pageMutator = body | ||
} | ||
|
||
/** | ||
* Set the paginator mutator callback. | ||
* | ||
* Called just after we build a page embed, and just before that page is sent on Discord. | ||
*/ | ||
public fun paginator(body: PaginatorMutator) { | ||
paginatorMutator = body | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters