koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.53k stars 246 forks source link

Bug: 指令的权限判断应当优先于指令解析的反馈 #1414

Open Hieuzest opened 5 months ago

Hieuzest commented 5 months ago

Describe the bug

例如有指令

ctx.command('foo', { authority: 3 }).option('ver', '-v <ver:number>')

当权限不足时,foo权限不足,而foo -v abcd则会报 选项ver输入无效

是否应该将部分逻辑移至on('attach') ? 或者延后parse reject的时机

ref: koishijs/koishi-plugin-switch#3

Steps to reproduce

/

Expected behavior

二者均应报权限不足

Screenshots

No response

Versions

Additional context

No response

shigma commented 5 months ago

你说的有道理,但是选项本身也是需要判断权限的。可能需要把权限的判断拆分到两个时机来做了……?