@@ -24,8 +24,10 @@ import io.github.samarium150.mirai.plugin.config.ReplyConfig
24
24
import io.github.samarium150.mirai.plugin.data.PluginData
25
25
import io.github.samarium150.mirai.plugin.data.RequestBody
26
26
import io.github.samarium150.mirai.plugin.util.CooldownUtil
27
- import io.github.samarium150.mirai.plugin.util.ThrottleUtil
28
27
import io.github.samarium150.mirai.plugin.util.GeneralUtil
28
+ import io.github.samarium150.mirai.plugin.util.ThrottleUtil
29
+ import kotlinx.coroutines.Dispatchers
30
+ import kotlinx.coroutines.withContext
29
31
import kotlinx.serialization.ExperimentalSerializationApi
30
32
import kotlinx.serialization.decodeFromString
31
33
import kotlinx.serialization.json.Json
@@ -105,6 +107,7 @@ object Lolicon : CompositeCommand(
105
107
val imageData = response.data[0 ]
106
108
if (! GeneralUtil .areTagsAllowed(imageData.tags)) {
107
109
sendMessage(ReplyConfig .filteredTag)
110
+ ThrottleUtil .unlock(subject)
108
111
return
109
112
}
110
113
val url = imageData.urls[PluginConfig .size]
@@ -133,8 +136,7 @@ object Lolicon : CompositeCommand(
133
136
logger.error(e)
134
137
sendMessage(ReplyConfig .networkError)
135
138
} finally {
136
- @Suppress(" BlockingMethodInNonBlockingContext" )
137
- stream?.close()
139
+ withContext(Dispatchers .IO ) { stream?.close() }
138
140
if (PluginConfig .verbose && imgInfoReceipt != null && recall > 0 && PluginConfig .recallImgInfo)
139
141
GeneralUtil .recall(GeneralUtil .RecallType .IMAGE_INFO , imgInfoReceipt, recall)
140
142
}
@@ -210,8 +212,7 @@ object Lolicon : CompositeCommand(
210
212
logger.error(e)
211
213
sendMessage(ReplyConfig .networkError)
212
214
} finally {
213
- @Suppress(" BlockingMethodInNonBlockingContext" )
214
- stream?.close()
215
+ withContext(Dispatchers .IO ) { stream?.close() }
215
216
}
216
217
}
217
218
val imgInfoReceipt =
0 commit comments