2024-08-30 21:07:08 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2024 RTAkland
|
|
|
|
|
* Author: RTAkland
|
|
|
|
|
* Date: 2024/8/30
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package cn.rtast.fancybot.commands
|
|
|
|
|
|
|
|
|
|
import cn.rtast.rob.entity.GroupMessage
|
|
|
|
|
import cn.rtast.rob.util.BaseCommand
|
2024-08-31 22:37:12 +08:00
|
|
|
import cn.rtast.rob.util.message.MessageChain
|
2024-08-30 21:07:08 +08:00
|
|
|
import cn.rtast.rob.util.ob.OBMessage
|
|
|
|
|
|
|
|
|
|
class QRCodeCommand : BaseCommand() {
|
|
|
|
|
override val commandNames = listOf("/qrcode", "/qr", "/二维码")
|
|
|
|
|
|
|
|
|
|
override suspend fun executeGroup(listener: OBMessage, message: GroupMessage, args: List<String>) {
|
|
|
|
|
val content = args.joinToString(" ")
|
2024-08-31 22:37:12 +08:00
|
|
|
val msg = MessageChain.Builder()
|
|
|
|
|
.addAt(message.sender.userId)
|
|
|
|
|
.addImage("https://api.rtast.cn/api/generate_qr?data=$content")
|
|
|
|
|
.build()
|
|
|
|
|
listener.sendGroupMessage(message.groupId, msg)
|
2024-08-30 21:07:08 +08:00
|
|
|
}
|
|
|
|
|
}
|