K
Kord3mo ago
iReqen

Adding a file to a message using getResourceAsStream

val imageStream = javaClass.getResourceAsStream("/images/headerLink.png")
?: throw IllegalArgumentException("Image not found: /images/headerLink.png")
val imageStream = javaClass.getResourceAsStream("/images/headerLink.png")
?: throw IllegalArgumentException("Image not found: /images/headerLink.png")
Is there an easy way to load an image like this and use it with the addFile function?
Solution:
You can use ChannelProvider { imageStream.toByteReadChannel() }
Jump to solution
3 Replies
iReqen
iReqenOP3mo ago
mightve found the solution lemme check
Solution
SchlaubiBus
SchlaubiBus3mo ago
You can use ChannelProvider { imageStream.toByteReadChannel() }
iReqen
iReqenOP3mo ago
Thank you!

Did you find this page helpful?