add xnm command

This commit is contained in:
2025-01-15 14:06:02 +08:00
parent 4be2791c92
commit a6b8698a68
4 files changed
+33 -3

No files matched your search

+1 -1
View File
@@ -112,5 +112,5 @@ val commands = listOf(
TodayEatCommand(), TodayDrinkCommand(), MCLoginCommand(), RCONCommand(), TodayEatCommand(), TodayDrinkCommand(), MCLoginCommand(), RCONCommand(),
GravatarCommand(), PastebinCommand(), ShuffleEchoCommand(), TodayDontEatCommand(), GravatarCommand(), PastebinCommand(), ShuffleEchoCommand(), TodayDontEatCommand(),
TodayDontDrinkCommand(), MCBotCommand(), HTTPCatCommand(), HTTPDogCommand(), TodayDontDrinkCommand(), MCBotCommand(), HTTPCatCommand(), HTTPDogCommand(),
AITTSCommand(), NWWNCommand(), TJBGXLCommand() AITTSCommand(), NWWNCommand(), TJBGXLCommand(), XNMCommand()
) )
@@ -32,14 +32,16 @@ import cn.rtast.rob.entity.custom.MemberLeaveEvent
import cn.rtast.rob.entity.lagrange.FileEvent import cn.rtast.rob.entity.lagrange.FileEvent
import cn.rtast.rob.entity.lagrange.PokeEvent import cn.rtast.rob.entity.lagrange.PokeEvent
import cn.rtast.rob.enums.ArrayMessageType import cn.rtast.rob.enums.ArrayMessageType
import cn.rtast.rob.enums.QQFace
import cn.rtast.rob.onebot.MessageChain import cn.rtast.rob.onebot.MessageChain
import cn.rtast.rob.onebot.OneBotAction import cn.rtast.rob.onebot.OneBotAction
import cn.rtast.rob.onebot.OneBotListener import cn.rtast.rob.onebot.OneBotListener
import cn.rtast.rob.segment.NewLine import cn.rtast.rob.segment.NewLine
import cn.rtast.rob.segment.Text import cn.rtast.rob.segment.Text
import com.madgag.gif.fmsware.GifDecoder import com.madgag.gif.fmsware.GifDecoder
import kotlinx.coroutines.* import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import java.io.File import java.io.File
import java.net.URI import java.net.URI
@@ -43,6 +43,7 @@ class NWWNCommand : BaseCommand() {
} }
} }
@CommandDescription("太几把搞笑了")
class TJBGXLCommand: BaseCommand() { class TJBGXLCommand: BaseCommand() {
override val commandNames = listOf("太几把搞笑了", "tjbgxl", "jb") override val commandNames = listOf("太几把搞笑了", "tjbgxl", "jb")
@@ -65,4 +66,31 @@ class TJBGXLCommand: BaseCommand() {
message.reply("生成失败: ${e.message}") message.reply("生成失败: ${e.message}")
} }
} }
}
@CommandDescription("香奈美语句生成")
class XNMCommand: BaseCommand() {
override val commandNames = listOf("xnm", "香奈美")
private val font = Font("SimSun", Font.BOLD, 55)
private val originImage = Resources.loadFromResourcesAsBytes("misc/xnm.png")
override suspend fun executeGroup(message: GroupMessage, args: List<String>) {
try {
val keyword = args.first()
val keyword2 = args.last()
val img = ImageIO.read(originImage!!.inputStream())
val g2d = img.createGraphics()
g2d.color = Color.BLACK
g2d.font = font
g2d.drawCenteredText(keyword, 510, 55)
g2d.drawCenteredText(keyword2, 510, 140)
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: 366 KiB