C
C#13mo ago
Nelson

Discord bot command that sends local images

Hello! Does anyone know how to make a discord bot command that is able to send locally stored images. I've seen the method 'SendFileAsync' being used, but it seems like it is unavailable to me in my VS2022. Is it only available in a specific package or? Any help appreciated!
7 Replies
Jimmacle
Jimmacle13mo ago
$details
MODiX
MODiX13mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Jimmacle
Jimmacle13mo ago
what discord library are you using?
mindhardt
mindhardt13mo ago
If it is somewhat similar to disqord then you need to create an Attachment object from stream (in your case filestream) and filename, then add it to a message and send it
jcotton42
jcotton4213mo ago
the only correct answer to this question is "Remora" andyWhen
Nelson
NelsonOP13mo ago
DSharpPlus, if I'm understanding you right
mindhardt
mindhardt13mo ago
D#+ has DiscordMessageBuilder.WithFile(string, Stream) which does exactly what I said, you need to open a file stream, then create a message with file and then send it
Want results from more Discord servers?
Add your server