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
$details
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)
what discord library are you using?
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
the only correct answer to this question is "Remora"
DSharpPlus, if I'm understanding you right
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