From 2c88080acab05f8be4b33e3e24801944369bc932 Mon Sep 17 00:00:00 2001 From: Samarium <28302241+Samarium150@users.noreply.github.com> Date: Thu, 13 Oct 2022 12:39:37 -0600 Subject: [PATCH] fix: correct verbose setting in forward mode (#84) closes #83 --- Module.md | 33 -------------------------- build.gradle.kts | 2 +- src/main/kotlin/MiraiConsoleLolicon.kt | 2 +- src/main/kotlin/command/Lolicon.kt | 8 ++++++- src/main/kotlin/util/GeneralUtil.kt | 3 ++- 5 files changed, 11 insertions(+), 37 deletions(-) delete mode 100644 Module.md diff --git a/Module.md b/Module.md deleted file mode 100644 index e6c2260..0000000 --- a/Module.md +++ /dev/null @@ -1,33 +0,0 @@ -# Module mirai-console-lolicon - -受 [ACGPro](https://github.com/ShrBox/ACGPro) 启发而写 - -Social preview的图片来自 [AliceSoft](https://www.alicesoft.com) 制作的游戏 [ドーナドーナ いっしょにわるいことをしよう](https://www.alicesoft.com/dohnadohna) - -在群内随机发送来自 [Lolicon API v2](https://api.lolicon.app/#/setu) 的图片(默认30s自动撤回+60s冷却),支持标签检索和JSON高级检索 - -适配最新稳定版 [mirai-console](https://github.com/mamoe/mirai-console) - -使用文档已经移到了 [wiki](https://github.com/Samarium150/mirai-console-lolicon/wiki) 页面 - -本页面为Kotlin源文件的注释文档 - -# Package io.github.samarium150.mirai.plugin - -插件主包 - -# Package io.github.samarium150.mirai.plugin.command - -命令包 - -# Package io.github.samarium150.mirai.plugin.config - -配置包 - -# Package io.github.samarium150.mirai.plugin.data - -数据包 - -# Package io.github.samarium150.mirai.plugin.util - -工具包 diff --git a/build.gradle.kts b/build.gradle.kts index f5ca3db..f3d246a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { } group = "io.github.samarium150" -version = "6.0.4" +version = "6.0.5" repositories { mavenCentral() diff --git a/src/main/kotlin/MiraiConsoleLolicon.kt b/src/main/kotlin/MiraiConsoleLolicon.kt index a76080a..e417a08 100644 --- a/src/main/kotlin/MiraiConsoleLolicon.kt +++ b/src/main/kotlin/MiraiConsoleLolicon.kt @@ -35,7 +35,7 @@ import java.net.Proxy object MiraiConsoleLolicon : KotlinPlugin( JvmPluginDescription( id = "io.github.samarium150.mirai.plugin.mirai-console-lolicon", - version = "6.0.4", + version = "6.0.5", name = "Lolicon" ) { author("Samarium150") diff --git a/src/main/kotlin/command/Lolicon.kt b/src/main/kotlin/command/Lolicon.kt index d3f1aca..d2aa853 100644 --- a/src/main/kotlin/command/Lolicon.kt +++ b/src/main/kotlin/command/Lolicon.kt @@ -117,7 +117,13 @@ object Lolicon : CompositeCommand( return@withLock } val image = (subject as Contact).uploadImage(stream) - val imgReceipt = sendMessage(buildMessage(subject as Contact, imageData.toReadable(url), image)) + val imgReceipt = sendMessage( + buildMessage( + subject as Contact, + if (PluginConfig.verbose) imageData.toReadable(url) else "", + image + ) + ) if (notificationReceipt != null) recall(RecallType.NOTIFICATION, notificationReceipt, 0) if (imgReceipt == null) diff --git a/src/main/kotlin/util/GeneralUtil.kt b/src/main/kotlin/util/GeneralUtil.kt index 950ba62..5bebbc0 100644 --- a/src/main/kotlin/util/GeneralUtil.kt +++ b/src/main/kotlin/util/GeneralUtil.kt @@ -137,7 +137,8 @@ internal fun buildMessage(contact: Contact, imageInfo: String, image: Image): Si PluginConfig.Type.Simple -> image PluginConfig.Type.Flash -> FlashImage(image) PluginConfig.Type.Forward -> buildForwardMessage(contact, CustomDisplayStrategy) { - add(contact.bot, PlainText(imageInfo)) + if (imageInfo.isNotEmpty()) + add(contact.bot, PlainText(imageInfo)) add(contact.bot, image) } }