mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Fix command receiverParameter, #215
This commit is contained in:
parent
bace377d1e
commit
3b14d70cc5
@ -256,6 +256,15 @@ internal class CommandReflector(
|
||||
if (instanceParameter != null) {
|
||||
args[instanceParameter] = command
|
||||
}
|
||||
|
||||
val receiverParameter = function.extensionReceiverParameter
|
||||
if (receiverParameter != null) {
|
||||
check(receiverParameter.type.classifierAsKClass().isInstance(call.caller)) {
|
||||
"Bad command call resolved. " +
|
||||
"Function expects receiver parameter ${receiverParameter.type} whereas actual is ${call.caller::class}."
|
||||
}
|
||||
args[receiverParameter] = call.caller
|
||||
}
|
||||
function.callSuspendBy(args)
|
||||
}
|
||||
}.toList()
|
||||
|
Loading…
Reference in New Issue
Block a user