mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Fix test
This commit is contained in:
parent
707e6a9da7
commit
fc6459af53
@ -12,6 +12,7 @@
|
|||||||
package net.mamoe.mirai.console.command
|
package net.mamoe.mirai.console.command
|
||||||
|
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import net.mamoe.mirai.Bot
|
||||||
import net.mamoe.mirai.console.plugins.PluginBase
|
import net.mamoe.mirai.console.plugins.PluginBase
|
||||||
import net.mamoe.mirai.message.data.*
|
import net.mamoe.mirai.message.data.*
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
@ -30,9 +31,9 @@ internal object TestCommand : PluginCommand(
|
|||||||
param<String>()
|
param<String>()
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
override suspend fun onCommand(sender: CommandSender, args: CommandArgs): Boolean {
|
override suspend fun CommandSender.onCommand(args: CommandArgs): Boolean {
|
||||||
val s = args.getReified<String>()
|
val s = args.getReified<String>()
|
||||||
sender.sendMessage(s)
|
sendMessage(s)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,9 +63,9 @@ internal class TestCommands {
|
|||||||
param<String>()
|
param<String>()
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
override suspend fun onCommand(sender: CommandSender, args: CommandArgs): Boolean {
|
override suspend fun CommandSender.onCommand(args: CommandArgs): Boolean {
|
||||||
val s = args.getReified<String>()
|
val s = args.getReified<String>()
|
||||||
sender.sendMessage(s)
|
sendMessage(s)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}.register()
|
}.register()
|
||||||
@ -87,11 +88,10 @@ internal class TestCommands {
|
|||||||
internal inline fun withSender(block: CommandSender.() -> Unit): MessageChain {
|
internal inline fun withSender(block: CommandSender.() -> Unit): MessageChain {
|
||||||
val result = MessageChainBuilder()
|
val result = MessageChainBuilder()
|
||||||
val sender: CommandSender = object : CommandSender {
|
val sender: CommandSender = object : CommandSender {
|
||||||
override suspend fun sendMessage(message: Message) {
|
override val bot: Bot?
|
||||||
result.add(message)
|
get() = null
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun sendMessage(message: String) {
|
override suspend fun sendMessage(message: Message) {
|
||||||
result.add(message)
|
result.add(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user