Skip to content

Commit

Permalink
fix: censor
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed May 29, 2022
1 parent 5bb1147 commit e7e25a6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ internal val logger get() = MiraiContentCensorPlugin.logger

internal val config get() = ContentCensorConfig

internal suspend fun censor(message: MessageChain, config: HandleConfig = ContentCensorConfig): List<CensorResult> {
public suspend fun censor(message: MessageChain, config: HandleConfig = ContentCensorConfig): List<CensorResult> {
val results = ArrayList<CensorResult>()
// Text Censor
if (message.content.isNotBlank() && config.plain) {
if (config.plain && message.anyIsInstance<PlainText>()) {
results.add(MiraiContentCensor.text(plain = message.content))
}
// Image Censor
Expand All @@ -44,7 +44,7 @@ internal suspend fun censor(message: MessageChain, config: HandleConfig = Conten
}
// Forward
for (node in message.firstIsInstanceOrNull<ForwardMessage>()?.nodeList.orEmpty()) {
results.addAll(censor(message = node.messageChain))
results.addAll(censor(message = node.messageChain, config = config))
}
return results
}
Expand Down

0 comments on commit e7e25a6

Please sign in to comment.