-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
待 Context Parameters 稳定后,原本
command("order") {
val id = parameter<Int>("id")
val note = greedyStringParameter("note")
onExecute {
respond {
text("Order #${id.value} created\nnote:${note.value}")
}
}
}这样的写法可以简化为
command("order") {
val id by parameter<Int>("id")
val note by greedyStringParameter("note")
onExecute {
respond {
text("Order #$id created\nnote:$note")
}
}
}saltify/saltify-core/src/commonMain/kotlin/org/ntqqrev/saltify/dsl/SaltifyCommandContext.kt
Line 165 in a7cd541
| public class SaltifyCommandParamDef<T : Any>( |
这里新增一个 SaltifyCommandExecutionContext 约束的 getValue 就能实现,或者在委托内部持有 SaltifyCommandParamDef
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels