Fix PetPet & CorruptMp4s

This commit is contained in:
Vendicated 2023-01-09 23:18:49 +01:00
parent 23a461c36d
commit a772aa62f5
No known key found for this signature in database
GPG Key ID: A1DC0CFB5615D905
3 changed files with 4 additions and 3 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto eol=lf

View File

@ -99,7 +99,7 @@ export default definePlugin({
const newName = video.name.replace(/\.mp4$/i, ".corrupt.mp4");
const promptToUpload = findByCode("UPLOAD_FILE_LIMIT_ERROR");
const file = new File([buf], newName, { type: "video/mp4" });
setImmediate(() => promptToUpload([file], ctx.channel, DRAFT_TYPE));
setTimeout(() => promptToUpload([file], ctx.channel, DRAFT_TYPE), 10);
}
}]
});

View File

@ -175,8 +175,8 @@ export default definePlugin({
gif.finish();
const file = new File([gif.bytesView()], "petpet.gif", { type: "image/gif" });
// Immediately after the command finishes, Discord clears all input, including pending attachments.
// Thus, setImmediate is needed to make this execute after Discord cleared the input
setImmediate(() => promptToUpload([file], cmdCtx.channel, DRAFT_TYPE));
// Thus, setTimeout is needed to make this execute after Discord cleared the input
setTimeout(() => promptToUpload([file], cmdCtx.channel, DRAFT_TYPE), 10);
},
},
]