Skip to content

Commit

Permalink
build: 0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Apr 25, 2023
1 parent 01ffbeb commit 58d0922
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "xyz.cssxsh.mirai"
version = "0.4.2"
version = "0.4.3"

mavenCentralPublish {
useCentralS01()
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/xyz/cssxsh/mirai/bing/MiraiNewBing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public object MiraiNewBing : KotlinPlugin(
JvmPluginDescription(
id = "xyz.cssxsh.mirai.plugin.new-bing",
name = "mirai-new-bing",
version = "0.4.2",
version = "0.4.3",
) {
author("cssxsh")
}
Expand Down
19 changes: 9 additions & 10 deletions src/main/kotlin/xyz/cssxsh/mirai/bing/MiraiNewBingListener.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@ internal object MiraiNewBingListener : SimpleListenerHost() {

@EventHandler(concurrency = ConcurrencyKind.CONCURRENT)
suspend fun MessageEvent.chat() {
val commander = toCommandSender()
if (commander.hasPermission(chat).not()) {
val last = System.currentTimeMillis() - remind.getOrPut(sender.id) { 0 }
if (last > 600_000) {
remind[sender.id] = System.currentTimeMillis()
logger.warning("${sender.render()} 缺少权限 ${chat.id}")
}
return
}

val content = message.contentToString()
val (test, style) = when {
content.startsWith(MiraiNewBingConfig.creative) -> {
Expand All @@ -143,6 +133,15 @@ internal object MiraiNewBingListener : SimpleListenerHost() {
}
else -> return
}
val commander = toCommandSender()
if (commander.hasPermission(chat).not()) {
val last = System.currentTimeMillis() - remind.getOrPut(sender.id) { 0 }
if (last > 600_000) {
remind[sender.id] = System.currentTimeMillis()
logger.warning("${sender.render()} 缺少权限 ${chat.id}")
}
return
}

launch {
commander.send(text = test, style = style)
Expand Down

0 comments on commit 58d0922

Please sign in to comment.