refactor: InlineKeyboardGroupBuilder 增加快捷方法, 用于添加返回按钮.

This commit is contained in:
LamGC 2022-04-22 13:36:38 +08:00
parent a67b5fa818
commit 5f245513f0
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -219,6 +219,13 @@ class InlineKeyboardRowBuilder(private val groupBuilder: InlineKeyboardGroupBuil
}
}
fun InlineKeyboardGroupBuilder.addBackButton(callback: InlineKeyboardCallback) {
rowButton {
text("<<< 返回上一级")
callbackData(callback)
}
}
val CallbackQuery.callbackData: InlineKeyboardCallback
get() {
val refJson = gson.fromJson(data, JsonObject::class.java)
@ -369,7 +376,7 @@ fun Random.randomString(length: Int): String {
fun callbackQueryOf(
action: String,
checkProfileOwner: Boolean = false,
checkProfileOwner: Boolean = true,
block: (BaseAbilityBot, Update) -> Unit
): Reply {
return Reply.of(block, mutableListOf<Predicate<Update>?>().apply {