chore: format code
This commit is contained in:
5 files changed
+35
-5
No files matched your search
@@ -26,6 +26,7 @@ import cn.rtast.fancybot.enums.ImageBedType
|
|||||||
import cn.rtast.fancybot.enums.ImageType
|
import cn.rtast.fancybot.enums.ImageType
|
||||||
import cn.rtast.fancybot.enums.WSType
|
import cn.rtast.fancybot.enums.WSType
|
||||||
import cn.rtast.fancybot.items.*
|
import cn.rtast.fancybot.items.*
|
||||||
|
import cn.rtast.fancybot.util.Logger
|
||||||
import cn.rtast.fancybot.util.file.BlackListManager
|
import cn.rtast.fancybot.util.file.BlackListManager
|
||||||
import cn.rtast.fancybot.util.file.ConfigManager
|
import cn.rtast.fancybot.util.file.ConfigManager
|
||||||
import cn.rtast.fancybot.util.file.NiuziBankManager
|
import cn.rtast.fancybot.util.file.NiuziBankManager
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ import cn.rtast.fancybot.commands.reply.ImageBedCommand
|
|||||||
import cn.rtast.fancybot.enums.WSType
|
import cn.rtast.fancybot.enums.WSType
|
||||||
import cn.rtast.fancybot.util.*
|
import cn.rtast.fancybot.util.*
|
||||||
import cn.rtast.fancybot.util.misc.convertToDate
|
import cn.rtast.fancybot.util.misc.convertToDate
|
||||||
import cn.rtast.fancybot.util.misc.initCommandAndItem
|
import cn.rtast.fancybot.util.misc.initBackgroundTasks
|
||||||
|
import cn.rtast.fancybot.util.misc.initCommand
|
||||||
import cn.rtast.fancybot.util.misc.initFilesDir
|
import cn.rtast.fancybot.util.misc.initFilesDir
|
||||||
|
import cn.rtast.fancybot.util.misc.initItems
|
||||||
import cn.rtast.fancybot.util.misc.initSetuIndex
|
import cn.rtast.fancybot.util.misc.initSetuIndex
|
||||||
import cn.rtast.rob.ROneBotFactory
|
import cn.rtast.rob.ROneBotFactory
|
||||||
import cn.rtast.rob.entity.*
|
import cn.rtast.rob.entity.*
|
||||||
@@ -193,6 +195,8 @@ suspend fun main() {
|
|||||||
}
|
}
|
||||||
initDatabase()
|
initDatabase()
|
||||||
initFilesDir()
|
initFilesDir()
|
||||||
initCommandAndItem(rob)
|
initCommand(rob)
|
||||||
initSetuIndex()
|
initSetuIndex()
|
||||||
|
initItems()
|
||||||
|
initBackgroundTasks(rob)
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2024 RTAkland
|
||||||
|
* Author: RTAkland
|
||||||
|
* Date: 2024/10/15
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package cn.rtast.fancybot.commands.misc
|
||||||
|
|
||||||
|
import cn.rtast.fancybot.annotations.CommandDescription
|
||||||
|
|
||||||
|
@CommandDescription("复读鸡")
|
||||||
|
object RepeatCommand {
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
* Date: 2024/10/7
|
* Date: 2024/10/7
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
package cn.rtast.fancybot.util
|
package cn.rtast.fancybot.util
|
||||||
|
|
||||||
@@ -15,4 +16,8 @@ object Logger {
|
|||||||
inline fun <reified T> getLogger(): Logger {
|
inline fun <reified T> getLogger(): Logger {
|
||||||
return LoggerFactory.getLogger(T::class.simpleName).also { it.atLevel(Level.INFO) }
|
return LoggerFactory.getLogger(T::class.simpleName).also { it.atLevel(Level.INFO) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getLogger(name: String): Logger {
|
||||||
|
return LoggerFactory.getLogger(name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,11 +24,9 @@ suspend fun OneBotListener.getUserName(groupId: Long, userId: Long): String {
|
|||||||
return info.card ?: info.nickname
|
return info.card ?: info.nickname
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initCommandAndItem(rob: ROneBotFactory) {
|
fun initCommand(rob: ROneBotFactory) {
|
||||||
val commandManager = rob.commandManager
|
val commandManager = rob.commandManager
|
||||||
commands.forEach { commandManager.register(it) }
|
commands.forEach { commandManager.register(it) }
|
||||||
items.forEach { itemManager.register(it) }
|
|
||||||
tasks.forEach { rob.scheduler.scheduleTask(it.value, 1000L, it.key) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initFilesDir() {
|
fun initFilesDir() {
|
||||||
@@ -43,4 +41,12 @@ fun initSetuIndex() {
|
|||||||
val fileContent = Http.get("$ASSETS_BASE_URL/files/pixiv_index_v3.json")
|
val fileContent = Http.get("$ASSETS_BASE_URL/files/pixiv_index_v3.json")
|
||||||
file.writeText(fileContent)
|
file.writeText(fileContent)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun initItems() {
|
||||||
|
items.forEach { itemManager.register(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun initBackgroundTasks(rob: ROneBotFactory) {
|
||||||
|
tasks.forEach { rob.scheduler.scheduleTask(it.value, 1000L, it.key) }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user