diff --git a/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt b/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt index d811df5..10deb49 100644 --- a/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt +++ b/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt @@ -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() diff --git a/src/main/kotlin/cn/rtast/fancybot/commands/QRCodeCommand.kt b/src/main/kotlin/cn/rtast/fancybot/commands/QRCodeCommand.kt new file mode 100644 index 0000000..db4ae77 --- /dev/null +++ b/src/main/kotlin/cn/rtast/fancybot/commands/QRCodeCommand.kt @@ -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) { + 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]" + ) + } +} \ No newline at end of file