BotConfiguration
Bot 配置. 用于 BotFactory.newBot
Kotlin 使用方法:
val bot = BotFactory.newBot(...) {
// 在这里配置 Bot
bogLoggerSupplier = { bot -> ... }
fileBasedDeviceInfo()
inheritCoroutineContext() // 使用 `coroutineScope` 的 Job 作为父 Job
}
Content copied to clipboard
Java 使用方法:
Bot bot = BotFactory.newBot(..., new BotConfiguration() {{
setBogLoggerSupplier((Bot bot) -> { ... })
fileBasedDeviceInfo()
...
}})
Content copied to clipboard
Constructors
BotConfiguration
Link copied to clipboard
Types
ConfigurationDsl
Link copied to clipboard
标注一个配置 DSL 函数
ContactListCache
Link copied to clipboard
联系人信息缓存配置
HeartbeatStrategy
Link copied to clipboard
心跳策略.
MiraiProtocol
Link copied to clipboard
Functions
autoReconnectOnForceOffline
Link copied to clipboard
设置 autoReconnectOnForceOffline 为 true
, 即在被挤下线时自动重连.
contactListCache
Link copied to clipboard
inline fun contactListCache(action: BotConfiguration.ContactListCache.() -> Unit)
Content copied to clipboard
copy
Link copied to clipboard
disableContactCache
Link copied to clipboard
禁用好友列表和群成员列表的缓存.
enableContactCache
Link copied to clipboard
启用好友列表和群成员列表的缓存.
fileBasedDeviceInfo
Link copied to clipboard
使用文件存储设备信息.
inheritCoroutineContext
Link copied to clipboard
使用当前协程的 coroutineContext 作为 parentCoroutineContext.
loadDeviceInfoJson
Link copied to clipboard
使用特定由 DeviceInfo 序列化产生的 JSON 的设备信息
noNetworkLog
Link copied to clipboard
不显示网络日志. 不推荐.
randomDeviceInfo
Link copied to clipboard
使用随机设备信息.
redirectBotLogToDirectory
Link copied to clipboard
fun redirectBotLogToDirectory(dir: <ERROR CLASS> = File("logs"), retain: Long = 1.weeksToMillis, identity: (bot: Bot) -> String = { "Bot ${it.id}" })
Content copied to clipboard
重定向 Bot 日志 到指定目录. 若目录不存在将会自动创建 (File.mkdirs)
redirectBotLogToFile
Link copied to clipboard
fun redirectBotLogToFile(file: <ERROR CLASS> = File("mirai.log"), identity: (bot: Bot) -> String = { "Bot ${it.id}" })
Content copied to clipboard
重定向 Bot 日志 到指定文件. 日志将会逐行追加到此文件. 若文件不存在将会自动创建 (File.createNewFile)
redirectNetworkLogToDirectory
Link copied to clipboard
fun redirectNetworkLogToDirectory(dir: <ERROR CLASS> = File("logs"), retain: Long = 1.weeksToMillis, identity: (bot: Bot) -> String = { "Net ${it.id}" })
Content copied to clipboard
重定向 网络日志 到指定目录. 若目录不存在将会自动创建 (File.mkdirs) 默认目录路径为 "$workingDir/logs/".
redirectNetworkLogToFile
Link copied to clipboard
fun redirectNetworkLogToFile(file: <ERROR CLASS> = File("mirai.log"), identity: (bot: Bot) -> String = { "Net ${it.id}" })
Content copied to clipboard
重定向 网络日志 到指定文件. 默认文件路径为 "$workingDir/mirai.log". 日志将会逐行追加到此文件. 若文件不存在将会自动创建 (File.createNewFile)
Properties
autoReconnectOnForceOffline
Link copied to clipboard
在被挤下线时 (BotOfflineEvent.Force) 自动重连. 默认为 false
.
botLoggerSupplier
Link copied to clipboard
cacheDir
Link copied to clipboard
contactListCache
Link copied to clipboard
联系人信息缓存配置. 将会保存在 cacheDir 中 contacts
目录
convertLineSeparator
Link copied to clipboard
deviceInfo
Link copied to clipboard
firstReconnectDelayMillis
Link copied to clipboard
heartbeatPeriodMillis
Link copied to clipboard
heartbeatStrategy
Link copied to clipboard
heartbeatTimeoutMillis
Link copied to clipboard
highwayUploadCoroutineCount
Link copied to clipboard
isShowingVerboseEventLog
Link copied to clipboard
json
Link copied to clipboard
loginCacheEnabled
Link copied to clipboard
loginSolver
Link copied to clipboard
networkLoggerSupplier
Link copied to clipboard
parentCoroutineContext
Link copied to clipboard
父 CoroutineContext. Bot 创建后会使用 SupervisorJob 覆盖其 Job, 但会将这个 Job 作为父 Job
protocol
Link copied to clipboard
reconnectionRetryTimes
Link copied to clipboard
reconnectPeriodMillis
Link copied to clipboard
statHeartbeatPeriodMillis
Link copied to clipboard
workingDir
Link copied to clipboard