1 parent 3ae31ab commit f0fa385Copy full SHA for f0fa385
1 file changed
src/commands/fbdl.ts
@@ -24,6 +24,10 @@ const fileExists = async (filePath: string) => {
24
}
25
};
26
27
+function md5FromUrl(url: string) {
28
+ return crypto.createHash("md5").update(url).digest("hex");
29
+}
30
+
31
export default async function (msg: Message) {
32
const query = msg.body.replace(/^fbdl\b\s*/i, "").trim();
33
if (query.length === 0) {
@@ -51,7 +55,7 @@ export default async function (msg: Message) {
51
55
52
56
const tempDir = "./.temp";
53
57
fs.mkdirSync(tempDir, { recursive: true });
54
- const tempPath = `${tempDir}/${crypto.randomUUID()}.mp4`;
58
+ const tempPath = `${tempDir}/${md5FromUrl(result.url)}.mp4`;
59
60
if (await fileExists(tempPath)) {
61
const media = MessageMedia.fromFilePath(tempPath);
0 commit comments