All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xyz.cssxsh.mirai.admin.data.AdminTimerData.kt Maven / Gradle / Ivy

The newest version!
package xyz.cssxsh.mirai.admin.data

import kotlinx.serialization.modules.*
import net.mamoe.mirai.console.data.*
import net.mamoe.mirai.console.plugin.jvm.*
import net.mamoe.mirai.console.util.*
import xyz.cssxsh.mirai.admin.cron.*
import java.io.*
import java.time.*

@PublishedApi
internal object AdminTimerData : AutoSavePluginData("AdminTimerData") {

    override val serializersModule: SerializersModule = SerializersModule {
        contextual(DataCron)
        contextual(DurationSerializer)
    }

    var folder: File = File("./message")
        private set

    val last: MutableMap by value()

    val clear: MutableMap by value()

    val moments: MutableMap by value()

    val mute: MutableMap by value()

    val status: MutableMap by value()

    val message: MutableMap> by value { this[12345] = emptyList() }

    @ConsoleExperimentalApi
    override fun onInit(owner: PluginDataHolder, storage: PluginDataStorage) {
        if (owner is AbstractJvmPlugin) {
            folder = owner.dataFolder
        }
        super.onInit(owner, storage)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy