Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Resume images in threads #449

Merged
merged 3 commits into from
Mar 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/events/messageCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,16 @@ const convertResumePdfsIntoImages = async (
return await message.channel.send('Resume must be 1 page.');
}

const fileMatch = pdfLink.match('[^/]*$') || ['Resume'];
const fileName = fileMatch[0];
// Convert the resume pdf into image
const imgResponse = await convertPdfToPic('tmp/resume.pdf', 'resume', width * 2, height * 2);
// Send the image back to the channel
const preview_message = await message.channel.send({
// Send the image back to the channel as a thread
const thread = await message.startThread({
name: `${fileName}`,
autoArchiveDuration: 60,
});
const preview_message = await thread.send({
files: imgResponse.map((img) => img.path),
});
// Inserting the pdf and preview message IDs into the DB
Expand Down