feat: add jue command

This commit is contained in:
2024-09-21 16:03:28 +08:00
parent 60b41ead3b
commit 6d4cdff0a8
6 files changed
+129 -21

No files matched your search

@@ -0,0 +1,26 @@
/*
* Copyright © 2024 RTAkland
* Author: RTAkland
* Date: 2024/9/21
*/
package cn.rtast.fancybot.util
import com.madgag.gif.fmsware.AnimatedGifEncoder
import com.madgag.gif.fmsware.GifDecoder
import java.awt.image.BufferedImage
import java.io.ByteArrayOutputStream
fun GifDecoder.makeGif(frames: List<BufferedImage>): ByteArray {
val byteArrayOutputStream = ByteArrayOutputStream()
val encoder = AnimatedGifEncoder()
encoder.start(byteArrayOutputStream)
encoder.setRepeat(0)
for (i in frames.indices) {
encoder.setDelay(this.getDelay(this.frameCount - i - 1))
encoder.addFrame(frames[i])
}
encoder.finish()
return byteArrayOutputStream.toByteArray()
}