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 1 commit
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
11 changes: 9 additions & 2 deletions src/events/messageCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,17 @@ 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 botMessage = await message.channel.send('Converting Resume...');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if the thread could be created from the message containing the PDF file, instead of from this newly sent message.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this as well.

const thread = await botMessage.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