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

xyz.cssxsh.mirai.plugin.command.ArknightsFaceCommand.kt Maven / Gradle / Ivy

There is a newer version: 2.3.1
Show newest version
package xyz.cssxsh.mirai.plugin.command

import net.mamoe.mirai.console.command.*
import net.mamoe.mirai.message.data.*
import net.mamoe.mirai.message.*
import net.mamoe.mirai.utils.*
import xyz.cssxsh.arknights.market.*
import xyz.cssxsh.mirai.plugin.*

object ArknightsFaceCommand : CompositeCommand(
    owner = ArknightsHelperPlugin,
    "arkface", "方舟表情",
    description = "明日方舟助手表情指令"
), ArknightsHelperCommand {

    @SubCommand("random", "随机")
    @Description("表情随机")
    suspend fun CommandSenderOnMessage<*>.random(id: Int = 0) = sendMessage {
        (ArknightsFaceData.faces[id] ?: ArknightsFaceData.faces.values.random()).random().also {
            logger.info {
                "${it.id} ${it.title} ${it.content} ${it.key} ${it.md5}"
            }
        }.impl()
    }

    @SubCommand("list", "列表")
    @Description("表情列表")
    suspend fun CommandSenderOnMessage<*>.list() = sendMessage {
        ArknightsFaceData.faces.toMessage()
    }

    @OptIn(MiraiExperimentalApi::class)
    @SubCommand("detail", "详情")
    @Description("表情详情")
    suspend fun CommandSenderOnMessage<*>.detail() = sendMessage {
        val face = fromEvent.nextMessage { message.anyIsInstance() }.firstIsInstance()
        // logger.info { "KEY: ${face.hash}" }
        ArknightsFaceData.faces.getValue(face.id).first { it.md5 == face.md5 }.toMessage()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy