Skip to content

Commit

Permalink
Update Lolicon.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
cikiPAD authored Dec 6, 2023
1 parent bfc126b commit 366a2c4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/kotlin/command/Lolicon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ object Lolicon : CompositeCommand(
for (imageData in response.data) {
when {
imageData.urls.size > 1 -> {
imageMsgBuilder.add(contact.bot, PlainText(imageData.toReadable(imageData.urls)))
if(PluginConfig.verbose) {
imageMsgBuilder.add(contact.bot, PlainText(imageData.toReadable(imageData.urls)))
}
for (url in imageData.urls.values) {
runCatching {
val stream = getImageInputStream(url)
Expand All @@ -367,12 +369,16 @@ object Lolicon : CompositeCommand(
runCatching {
val stream = getImageInputStream(imageData.urls.values.first())
val image = contact.uploadImage(stream)
imageMsgBuilder.add(contact.bot, PlainText(imageData.toReadable(imageData.urls)))
if(PluginConfig.verbose) {
imageMsgBuilder.add(contact.bot, PlainText(imageData.toReadable(imageData.urls)))
}
imageMsgBuilder.add(contact.bot, image)
stream
}.onFailure {
logger.error(it)
imageMsgBuilder.add(contact.bot, PlainText(imageData.toReadable(imageData.urls)))
if(PluginConfig.verbose) {
imageMsgBuilder.add(contact.bot, PlainText(imageData.toReadable(imageData.urls)))
}
imageMsgBuilder.add(contact.bot, PlainText(ReplyConfig.networkError))
}.onSuccess {
runInterruptible(Dispatchers.IO) {
Expand Down

0 comments on commit 366a2c4

Please sign in to comment.