toBotVerifyInfo
将一个 Resource 转为 BotVerifyInfo.
将一个 URL 转为 BotVerifyInfo.
将一个 Path 转为 BotVerifyInfo.
fun InputStream.toBotVerifyInfo(decoder: BotVerifyInfoDecoder, infoName: String): ByteArrayBotVerifyInfo(source)
将一个 InputStream 转为 BotVerifyInfo.
Parameters
infoName
给 bot verify info 提供一个名称。
fun <C : Any> URL.toBotVerifyInfo(factory: BotVerifyInfoDecoderFactory<C, *>, configurator: C.() -> Unit = {}): BotVerifyInfo(source)
将一个 URL 转为 BotVerifyInfo.
e.g.
// 解析json配置
url: URL = ...
url.toBotVerifyInfo(StandardBotVerifyInfoDecoderFactory.Json) {
isLenient = true
ignoreUnknownKeys = true
}
Content copied to clipboard
fun <C : Any> Path.toBotVerifyInfo(factory: BotVerifyInfoDecoderFactory<C, *>, configurator: C.() -> Unit = {}): BotVerifyInfo(source)
将一个 Path 转为 BotVerifyInfo. e.g.
// 解析json配置
path: Path = ...
path.toBotVerifyInfo(StandardBotVerifyInfoDecoderFactory.Json) {
isLenient = true
ignoreUnknownKeys = true
}
Content copied to clipboard
fun <C : Any> InputStream.toBotVerifyInfo(factory: BotVerifyInfoDecoderFactory<C, *>, infoName: String, configurator: C.() -> Unit = {}): BotVerifyInfo(source)
将一个 InputStream 转为 BotVerifyInfo. e.g.
// 解析json配置
input: InputStream = ...
val infoName: String = "myBot.json"
input.toBotVerifyInfo(StandardBotVerifyInfoDecoderFactory.Json, infoName) {
isLenient = true
ignoreUnknownKeys = true
}
Content copied to clipboard