diff --git a/src/main/kotlin/cn/rtast/fancybot/commands/lookup/TheCatCommand.kt b/src/main/kotlin/cn/rtast/fancybot/commands/lookup/TheCatCommand.kt index ee3efdf..b490b03 100644 --- a/src/main/kotlin/cn/rtast/fancybot/commands/lookup/TheCatCommand.kt +++ b/src/main/kotlin/cn/rtast/fancybot/commands/lookup/TheCatCommand.kt @@ -26,7 +26,7 @@ class TheCatCommand : BaseCommand() { override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List) { val imageBase64= Http.get(theCatApiUrl) .fromArrayJson>().first().url - .proxy().toURL().readBytes().encodeToBase64() + .proxy.toURL().readBytes().encodeToBase64() val msg = MessageChain.Builder().addImage(imageBase64, true).build() message.reply(msg) } diff --git a/src/main/kotlin/cn/rtast/fancybot/commands/misc/TTSCommand.kt b/src/main/kotlin/cn/rtast/fancybot/commands/misc/TTSCommand.kt index 09b738f..2263089 100644 --- a/src/main/kotlin/cn/rtast/fancybot/commands/misc/TTSCommand.kt +++ b/src/main/kotlin/cn/rtast/fancybot/commands/misc/TTSCommand.kt @@ -36,7 +36,7 @@ class TTSCommand : BaseCommand() { .build() val response = Http.post(ttsApiUrl, form) val msg = MessageChain.Builder() - .addRecord(response.url.proxy()) + .addRecord(response.url.proxy) .build() listener.sendGroupMessage(message.groupId, msg) } diff --git a/src/main/kotlin/cn/rtast/fancybot/util/str/StringFormatter.kt b/src/main/kotlin/cn/rtast/fancybot/util/str/StringFormatter.kt index 9e36ad4..812f3e7 100644 --- a/src/main/kotlin/cn/rtast/fancybot/util/str/StringFormatter.kt +++ b/src/main/kotlin/cn/rtast/fancybot/util/str/StringFormatter.kt @@ -47,6 +47,4 @@ fun Int.formatToMinutes(): String { return "$minutes:${if (remainingSeconds < 10) "0" else ""}$remainingSeconds" } -fun String.proxy(): String { - return this.replace("https://", "https://proxy.rtast.cn/https/") -} \ No newline at end of file +val String.proxy: String get() = this.replace("https://", "https://proxy.rtast.cn/https/")