feat: add nwwn command

This commit is contained in:
2025-01-15 00:23:31 +08:00
parent 8107117e5f
commit 64f256fb25
3 files changed
+45 -16

No files matched your search

+3 -15
View File
@@ -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()
)
@@ -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<String>) {
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}")
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB