K
Kord•2mo ago
TBaguette

How to add a file to a message as an attachment?

Pretty please. I've tried to use something similar to file.inputStream() but to no avail, and I can't find how to do this anywhere. I have a File (and its path as a String) and I wanna attach it in a createMessage. That's it. 🙂 Edit : forgot to mention but I use Kotlin, not Groovy
1 Reply
SchlaubiBus
SchlaubiBus•2mo ago
I assume with Groovy you mean tha Gradle DSL, since Kord itself has nothing to do with groovy, but that doesn't actually matter You can add an attachment using MessageBuilder.addFile There is an extension you can use, which takes a Path If you do not have a file you can use a ChannelProvider)
Path (Java SE 23 & JDK 23)
declaration: module: java.base, package: java.nio.file, interface: Path
Want results from more Discord servers?
Add your server