Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Feature: 允许指令重载 #30

Open
bsdayo opened this issue Feb 21, 2023 · 0 comments
Open

Feature: 允许指令重载 #30

bsdayo opened this issue Feb 21, 2023 · 0 comments
Labels
area-fx Flandre.Framework 相关 feature 特性建议

Comments

@bsdayo
Copy link
Member

bsdayo commented Feb 21, 2023

Describe the problem related to the feature request

允许指令重载可以提高指令定义的灵活度

Describe the solution you'd like

同一个指令,接受数种不同的参数列表,并自动判断使用不同的处理函数。
定义时通过指定同一条指令实现:

[Command("cmd")]
public MessageContent OnOverload1(CommandContext ctx, bool arg1) { /* ... */ }

// 重载指令
[Command("cmd")]
public MessageContent OnOverload2(CommandContext ctx, int arg1, int arg2) { /* ... */ }

如果没有符合提供参数的重载,将产生一条错误提供给用户。

Describe alternatives you've considered

No response

Additional context

No response

@bsdayo bsdayo added feature 特性建议 area-fx Flandre.Framework 相关 labels Feb 21, 2023
@bsdayo bsdayo added this to Flandre Feb 21, 2023
@github-project-automation github-project-automation bot moved this to Todo in Flandre Feb 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-fx Flandre.Framework 相关 feature 特性建议
Projects
Status: Todo
Development

No branches or pull requests

1 participant