You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
qqbot/src/test/kotlin/com/pqh/qqbot/AppTest.kt

42 lines
1.1 KiB

package com.pqh.qqbot
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import net.mamoe.mirai.Bot
import net.mamoe.mirai.utils.BotConfiguration
import org.junit.jupiter.api.Test
class AppTest {
@Test
fun testRegex(){
val s="http://gchat.qpic.cn/gchatpic_new/1029559041/981632964-2949860370-58391EFD3CADE5292A9C9EF98AAFA0A4/0?term=2"
val result= Regex("\\d+-\\d+-[0-9A-Z]+").find(s)
println(result?.value)
}
@Test
fun testFor(){
for((index,value) in listOf("a","b").withIndex()){
println("${index}=${value}")
}
}
}
suspend fun main(arg: Array<String>) {
println("参数长度:${arg.size}")
if (arg.size == 2) {
println("请输入账号")
val id = arg[0].toLong()
println("请输入密码")
val pwd = arg[1]
println("账号:${id},密码:${pwd}")
val config = BotConfiguration.Default
config.fileBasedDeviceInfo("qqbot.json")
GlobalScope.launch {
Bot(id, pwd, config).login()
}.join()
}
}