Send mp4 file

I have a mp4 in my directory that I want to send it but it's sending the video like this. how can I fix this
message.channel.send({files : [mp4finalPath]});
message.channel.send({files : [mp4finalPath]});
No description
10 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Syjalo
Syjalo9mo ago
Your file is empty
theopenroad
theopenroadOP9mo ago
No description
theopenroad
theopenroadOP9mo ago
It's not anymore
Adidi
Adidi9mo ago
@Tor you need to convert that to a link if to does not work upload to youtube or medal
theopenroad
theopenroadOP9mo ago
Someone tell me you must attach it how can I do that ?
Adidi
Adidi9mo ago
i think you need to switch the files in the reply to attachments
Aryxst
Aryxst9mo ago
You want to read the file with fs and get the buffer from it Sorry if i didnt answer previously, here's a snippet that does the job:
import { AttachmentBuilder } from "discord.js"
import fs from "fs"

// ... other code

const myvideo = fs.readFileSync('/path/to/my/video.mp4');
message.channel.send({ content: "Here's the video:", files: [new AttachmentBuilder(myvideo, { name: 'video.mp4' })] });

// ...
import { AttachmentBuilder } from "discord.js"
import fs from "fs"

// ... other code

const myvideo = fs.readFileSync('/path/to/my/video.mp4');
message.channel.send({ content: "Here's the video:", files: [new AttachmentBuilder(myvideo, { name: 'video.mp4' })] });

// ...
@Tor
theopenroad
theopenroadOP9mo ago
Thanks G Thank you Your methods were working
vulpz
vulpz9mo ago
This worked yesterday but now it throws UND_ERR_ABORTED. Any chance it's related to the API issues today? ok guess I'll wait till tomorrow to check it, thnx
Want results from more Discord servers?
Add your server