diff --git a/src/main/kotlin/cn/rtast/fancybot/Const.kt b/src/main/kotlin/cn/rtast/fancybot/Const.kt index 7f2b1a5..fbc558c 100644 --- a/src/main/kotlin/cn/rtast/fancybot/Const.kt +++ b/src/main/kotlin/cn/rtast/fancybot/Const.kt @@ -8,18 +8,10 @@ package cn.rtast.fancybot -import cn.rtast.fancybot.commands.AboutCommand -import cn.rtast.fancybot.commands.EchoCommand -import cn.rtast.fancybot.commands.HelpCommand -import cn.rtast.fancybot.commands.ShuffleEchoCommand -import cn.rtast.fancybot.commands.StatusCommand -import cn.rtast.fancybot.commands.SupportMeCommand +import cn.rtast.fancybot.commands.* import cn.rtast.fancybot.commands.lookup.* import cn.rtast.fancybot.commands.misc.* -import cn.rtast.fancybot.commands.misc.JrrpCommand -import cn.rtast.fancybot.commands.misc.ShortLinkCommand import cn.rtast.fancybot.commands.niuzi.* -import cn.rtast.fancybot.commands.niuzi.NiuziRedeemCommand import cn.rtast.fancybot.commands.parse.AsciiArtCommand import cn.rtast.fancybot.commands.parse.ReverseGIFCommand import cn.rtast.fancybot.entity.Config @@ -27,11 +19,7 @@ import cn.rtast.fancybot.enums.ImageBedType import cn.rtast.fancybot.enums.ImageType import cn.rtast.fancybot.enums.WSType import cn.rtast.fancybot.items.* -import cn.rtast.fancybot.util.file.BlackListManager -import cn.rtast.fancybot.util.file.ConfigManager -import cn.rtast.fancybot.util.file.NiuziBankManager -import cn.rtast.fancybot.util.file.NiuziManager -import cn.rtast.fancybot.util.file.RCONManager +import cn.rtast.fancybot.util.file.* import cn.rtast.fancybot.util.item.ItemManager import com.google.gson.Gson import com.google.gson.GsonBuilder @@ -124,5 +112,5 @@ val commands = listOf( TodayEatCommand(), TodayDrinkCommand(), MCLoginCommand(), RCONCommand(), GravatarCommand(), PastebinCommand(), ShuffleEchoCommand(), TodayDontEatCommand(), TodayDontDrinkCommand(), MCBotCommand(), HTTPCatCommand(), HTTPDogCommand(), - AITTSCommand() -) + AITTSCommand(), NWWNCommand() +) \ No newline at end of file diff --git a/src/main/kotlin/cn/rtast/fancybot/commands/misc/NWWNCommand.kt b/src/main/kotlin/cn/rtast/fancybot/commands/misc/NWWNCommand.kt new file mode 100644 index 0000000..e3ff7c2 --- /dev/null +++ b/src/main/kotlin/cn/rtast/fancybot/commands/misc/NWWNCommand.kt @@ -0,0 +1,41 @@ +/* + * Copyright © 2025 RTAkland + * Author: RTAkland + * Date: 2025/1/15 + */ + + +package cn.rtast.fancybot.commands.misc + +import cn.rtast.fancybot.util.misc.Resources +import cn.rtast.fancybot.util.misc.toByteArray +import cn.rtast.fancybot.util.str.encodeToBase64 +import cn.rtast.rob.entity.GroupMessage +import cn.rtast.rob.segment.Image +import cn.rtast.rob.util.BaseCommand +import java.awt.Color +import java.awt.Font +import javax.imageio.ImageIO + +class NWWNCommand : BaseCommand() { + override val commandNames = listOf("nwwn", "那我问你") + private val originNWWNImage = Resources.loadFromResources("misc/nwwn.png") + private val img = ImageIO.read(originNWWNImage) + private val font = Font("Serif", Font.ITALIC, 55) + + override suspend fun executeGroup(message: GroupMessage, args: List) { + try { + val keyword = args.first() + val g2d = img.createGraphics() + g2d.color = Color.BLACK + g2d.font = font + g2d.drawString(keyword, 290, 70) + g2d.dispose() + val imgBase64 = img.toByteArray().encodeToBase64() + val msg = Image(imgBase64, true) + message.reply(msg) + } catch (e: Exception) { + message.reply("生成失败: ${e.message}") + } + } +} \ No newline at end of file diff --git a/src/main/resources/misc/nwwn.png b/src/main/resources/misc/nwwn.png new file mode 100644 index 0000000..0a8aa8b Binary files /dev/null and b/src/main/resources/misc/nwwn.png differ