guimc233/lgz-bot

View on GitHub
src/main/kotlin/ltd/guimc/lgzbot/listener/mute/AutoQuit.kt

Summary

Maintainability
A
0 mins
Test Coverage
package ltd.guimc.lgzbot.listener.mute

import net.mamoe.mirai.event.EventHandler
import net.mamoe.mirai.event.ListenerHost
import net.mamoe.mirai.event.events.BotMuteEvent

object AutoQuit : ListenerHost {
    private const val autoQuitTime = 60 * 60 // 1 Hour

    @EventHandler
    suspend fun BotMuteEvent.onEvent() {
        if (this.durationSeconds >= autoQuitTime) {
            this.operator.sendMessage("[AutoQuit] 触发自动退群")
            this.group.quit()
        }
    }
}