koishijs / koishi

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

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

Open Hieuzest opened 4 months ago

Hieuzest commented 4 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 4 months ago

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