Samarium150 / mirai-console-lolicon

基于LoliconAPI的mirai-console插件
GNU Affero General Public License v3.0
203 stars 17 forks source link

黑名单逻辑有误 #56

Closed typoverflow closed 3 years ago

typoverflow commented 3 years ago

Utils.kt的isPermitted函数中,判断黑名单的逻辑有误。原代码为

  fun isPermitted(subject: Contact?): Boolean {
      return when (PluginConfig.mode) {
...
          "blacklist" -> {
              when {
                  subject == null -> true
                  subject is User && !PluginData.userSet.contains(subject.id) -> true
                  subject is Group && !PluginData.groupSet.contains(subject.id) -> true
                  else -> true
              }
          }
          else -> true
      }
  }

其中的else分支应当返回false

Samarium150 commented 3 years ago

确实,when里面的else应该是false