Skip to content

Commit

Permalink
Update messageCreate.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic-R authored Nov 16, 2023
1 parent c15aa71 commit a67e2e8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions event/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,23 @@ module.exports = {
let uuid = crypto.randomUUID();
const response = await fetch(image.url);
const buffer = await response.arrayBuffer();
let filetype = image.url.match(/\.([^/?#]+)(?=[?#]|$)/)[1];;
const blockBlobClient = containerClient.getBlockBlobClient(
`${user.id}/${uuid}${image.url.substring(
image.url.lastIndexOf(".")
)}`
`${user.id}/${uuid}.${image.url.substring(filetype)}`
);
await blockBlobClient.uploadData(buffer, buffer.byteLength);
embeds.push({
url: "https://bte-germany.de",
image: {
url: `${process.env.CDN_URL}/${
process.env.CONTAINER_NAME
}/${user.id}/${uuid}${image.url.substring(
image.url.lastIndexOf(".")
)}`,
}/${user.id}/${uuid}.${image.url.substring(filetype)}`,
},
});
images.push(
`${process.env.CDN_URL}/${process.env.CONTAINER_NAME}/${
user.id
}/${uuid}${image.url.substring(image.url.lastIndexOf("."))}`
}/${uuid}.${image.url.substring(filetype)}`
);
}
await prisma.build.update({
Expand Down

0 comments on commit a67e2e8

Please sign in to comment.