Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] 希望添加更为灵活的filter.permission_type使用方式,使用户能自定义权限类型 #477

Merged
merged 11 commits into from
Feb 16, 2025

Conversation

AraragiEro
Copy link
Contributor

@AraragiEro AraragiEro commented Feb 11, 2025

[Feature] 希望添加更为灵活的filter.permission_type使用方式,使用户能自定义权限类型

Motivation

这样可以更方便的设计如会员系统,功能次数限制等功能。

Modifications

只是提供一个思路,多加一个函数不是很cool,但是改变原函数的参数也不是很cool,在继续研究之前还没有更好的想法。
image
image
image

@Soulter
Copy link
Owner

Soulter commented Feb 12, 2025

你好,感谢提供相关代码实现自定义的filter。我觉得完全可以按照你的思路,提供一个自定义的filter接口(custom_filter),而不一定写明是permission_type。

@AraragiEro
Copy link
Contributor Author

你好,感谢提供相关代码实现自定义的filter。我觉得完全可以按照你的思路,提供一个自定义的filter接口(custom_filter),而不一定写明是permission_type。

了解,我完善下看看。

@AraragiEro
Copy link
Contributor Author

AraragiEro commented Feb 14, 2025

增强了一下功能,现在可以添加在任何command解释器、command_group解释器以及子指令的command解释器上。
不过还和项目本身的风格不是很搭,无权限会返回错误而不是静默。还得改改。

更新:
现在无权限的裸指令保持静默,无权限的指令组返回可以通过customfilter的指令树。
考虑加与和或运算。

更新:
添加了与和或运算。直接使用&和I将多个Filter连接。
c9e4e88720dbcf272eec932eb91c1b15
aaae0a757dbcf1654ece7f8a906871e8
image
image

and when you use a command group and dont have custom filter access, the return group tree wont contain the command that you dont have permisson.
@AraragiEro AraragiEro force-pushed the master branch 3 times, most recently from b86e9c3 to 527725d Compare February 16, 2025 02:55
@Soulter Soulter merged commit 731334b into Soulter:master Feb 16, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants