chore: use ext property instead of func
This commit is contained in:
3 files changed
+3
-5
No files matched your search
@@ -26,7 +26,7 @@ class TheCatCommand : BaseCommand() {
|
||||
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
|
||||
val imageBase64= Http.get(theCatApiUrl)
|
||||
.fromArrayJson<List<Cat>>().first().url
|
||||
.proxy().toURL().readBytes().encodeToBase64()
|
||||
.proxy.toURL().readBytes().encodeToBase64()
|
||||
val msg = MessageChain.Builder().addImage(imageBase64, true).build()
|
||||
message.reply(msg)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class TTSCommand : BaseCommand() {
|
||||
.build()
|
||||
val response = Http.post<TTSResponse>(ttsApiUrl, form)
|
||||
val msg = MessageChain.Builder()
|
||||
.addRecord(response.url.proxy())
|
||||
.addRecord(response.url.proxy)
|
||||
.build()
|
||||
listener.sendGroupMessage(message.groupId, msg)
|
||||
}
|
||||
|
||||
@@ -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/")
|
||||
}
|
||||
val String.proxy: String get() = this.replace("https://", "https://proxy.rtast.cn/https/")
|
||||
Reference in New Issue
Block a user