generated from project-mirai/mirai-console-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
67 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
arona-core/src/main/kotlin/net/diyigemt/arona/extension/TempMessageInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package net.diyigemt.arona.extension | ||
|
||
import net.diyigemt.arona.config.AronaConfig | ||
import net.diyigemt.arona.service.AronaGroupService | ||
import net.mamoe.mirai.console.command.CommandManager | ||
import net.mamoe.mirai.console.command.CommandSender | ||
import net.mamoe.mirai.console.command.UserCommandSender | ||
import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors | ||
import net.mamoe.mirai.console.util.ConsoleExperimentalApi | ||
import net.mamoe.mirai.message.data.Message | ||
|
||
@OptIn(ExperimentalCommandDescriptors::class, ConsoleExperimentalApi::class) | ||
object TempMessageInterceptor: CommandInterceptor { | ||
override val level: Int = 1 | ||
|
||
override fun interceptBeforeCall(message: Message, caller: CommandSender): String? { | ||
val unreliableCommandName = extraCommandName(message) | ||
val matchCommand = CommandManager.matchCommand(unreliableCommandName) | ||
if (matchCommand !is AronaGroupService && caller is UserCommandSender) { | ||
val callerId = caller.user.id | ||
if (AronaConfig.managerGroup.contains(callerId)) { | ||
return null | ||
} | ||
return when(AronaConfig.tempMessageIgnoreType) { | ||
TempMessageIgnoreType.NONE -> { | ||
null | ||
} | ||
TempMessageIgnoreType.ONLY_SERVICE_GROUP -> { | ||
if (caller.bot.groups.any { group -> group.contains(callerId) }) { | ||
return null | ||
} | ||
"忽略非服务群友私聊" | ||
} | ||
TempMessageIgnoreType.ALL -> { | ||
"忽略所有群聊" | ||
} | ||
} | ||
} | ||
return null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
id: "net.diyigemt.arona" | ||
version: "1.0.14" | ||
version: "1.0.14+20230310" | ||
name: "ba-activity-pusher" | ||
author: "diyigemt" | ||
info: "BA日服/国际服活动推送插件" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters