feat: add qrcode message command

This commit is contained in:
2024-08-30 21:07:08 +08:00
parent ad8a7372db
commit 075a66458a
2 files changed
+27 -1

No files matched your search

@@ -13,6 +13,7 @@ import cn.rtast.fancybot.commands.HitokotoCommand
import cn.rtast.fancybot.commands.JrrpCommand
import cn.rtast.fancybot.commands.MusicCommand
import cn.rtast.fancybot.commands.MyPointCommand
import cn.rtast.fancybot.commands.QRCodeCommand
import cn.rtast.fancybot.commands.SignCommand
import cn.rtast.fancybot.entity.enums.WSType
import cn.rtast.fancybot.util.file.ConfigManager
@@ -39,7 +40,8 @@ val commands = listOf(
SignCommand(),
MyPointCommand(),
HitokotoCommand(),
FKXQSCommand()
FKXQSCommand(),
QRCodeCommand()
)
val configManager = ConfigManager()
@@ -0,0 +1,24 @@
/*
* 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
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(" ")
listener.sendGroupMessage(
message.groupId,
"[CQ:at,qq=${message.sender.userId}][CQ:image,file=https://api.rtast.cn/api/generate_qr?data=$content]"
)
}
}