mirror of
https://github.com/jie65535/mirai-console-jnr-plugin.git
synced 2025-06-02 17:49:11 +08:00
fix: 权限判断
在发送人权限不低于bot时, 过滤掉禁言等特权动作
This commit is contained in:
parent
6094637f03
commit
b20a92cc9c
@ -31,11 +31,13 @@ object JNudgeReply : KotlinPlugin(
|
||||
Random.nextInt()
|
||||
globalEventChannel().subscribeAlways<NudgeEvent>(priority = JNRPluginConfig.priority) {
|
||||
if (target.id == bot.id && target.id != from.id && JNRPluginConfig.replyMessageList.isNotEmpty()) {
|
||||
val replyList = if(subject is Group){
|
||||
JNRPluginConfig.replyMessageList
|
||||
var replyList = JNRPluginConfig.replyMessageList
|
||||
if(subject !is Group){
|
||||
replyList = replyList.filter { !it.message.startsWith("#group") }.toMutableList()
|
||||
}else{
|
||||
// 非群聊时过滤部分特殊指令
|
||||
JNRPluginConfig.replyMessageList.filter { !it.message.startsWith("#group") }
|
||||
if((from as Member).permission.level >= (subject as Group).botPermission.level){
|
||||
replyList = replyList.filter { !it.message.startsWith("#group.mute") }.toMutableList()
|
||||
}
|
||||
}
|
||||
val totalWeight = replyList.sumOf { it.weight }
|
||||
var w = Random.nextInt(totalWeight)
|
||||
|
Loading…
Reference in New Issue
Block a user