userinfo: rewrap in try
This commit is contained in:
parent
0e2ed94245
commit
2cf8260a9c
1 changed files with 29 additions and 29 deletions
|
|
@ -575,39 +575,39 @@ userinfo.callback = async function (msg, line) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!member && id !== (msg.author?.id ?? msg.user?.id)) {
|
if (!member && id !== (msg.author?.id ?? msg.user?.id)) {
|
||||||
//try {
|
try {
|
||||||
const clip = {
|
const clip = {
|
||||||
is_clip: true,
|
is_clip: true,
|
||||||
clip_created_at: new Date().toISOString(),
|
clip_created_at: new Date().toISOString(),
|
||||||
clip_participant_ids: [id],
|
clip_participant_ids: [id],
|
||||||
application: hf.bot.application?.id,
|
application_id: hf.bot.application?.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
const video = await readFile(require.resolve("#root/data/clip.mp4"));
|
const video = await readFile(require.resolve("#root/data/clip.mp4"));
|
||||||
|
|
||||||
const {upload_url, upload_filename} = await hf.bot.requestHandler
|
const {upload_url, upload_filename} = await hf.bot.requestHandler
|
||||||
.request("POST", APIEndpoints.MESSAGE_CREATE_ATTACHMENT_UPLOAD(msg.channel.id), true, {
|
.request("POST", APIEndpoints.MESSAGE_CREATE_ATTACHMENT_UPLOAD(msg.channel.id), true, {
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
file_size: video.length,
|
file_size: video.length,
|
||||||
filename: "clip.mp4",
|
filename: "clip.mp4",
|
||||||
...clip,
|
...clip,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
.then((res) => res.attachments[0]);
|
.then((res) => res.attachments[0]);
|
||||||
|
|
||||||
await fetch(upload_url, {method: "PUT", body: video});
|
await fetch(upload_url, {method: "PUT", body: video});
|
||||||
|
|
||||||
attachments.push({
|
attachments.push({
|
||||||
filename: "clip.mp4",
|
filename: "clip.mp4",
|
||||||
uploaded_filename: upload_filename,
|
uploaded_filename: upload_filename,
|
||||||
is_thumbnail: true,
|
is_thumbnail: true,
|
||||||
...clip,
|
...clip,
|
||||||
});
|
});
|
||||||
//} catch {
|
} catch {
|
||||||
// noop
|
// noop
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue