From 5f245513f0d1b1cdd9a7b736bd4aa7fcaa891dca Mon Sep 17 00:00:00 2001 From: LamGC Date: Fri, 22 Apr 2022 13:36:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20InlineKeyboardGroupBuilder=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BF=AB=E6=8D=B7=E6=96=B9=E6=B3=95,=20?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E=E6=8C=89?= =?UTF-8?q?=E9=92=AE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/Utils.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/Utils.kt b/src/main/kotlin/Utils.kt index b5b25b3..b520c0e 100644 --- a/src/main/kotlin/Utils.kt +++ b/src/main/kotlin/Utils.kt @@ -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?>().apply {