|
|
|
@ -91,11 +91,11 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|
|
|
|
};
|
|
|
|
|
let author = ctx.author();
|
|
|
|
|
let mut submitted_images = Vec::new();
|
|
|
|
|
for (i, submission) in submission_data.iter_mut().enumerate() {
|
|
|
|
|
for submission in submission_data.iter_mut() {
|
|
|
|
|
if is_matching_submission(&submission, author) {
|
|
|
|
|
existing_submitter = true;
|
|
|
|
|
let mut images: Vec<String> = submission["images"].as_array_mut().unwrap().clone().iter().map(|value| value.as_str().unwrap().to_owned()).collect();
|
|
|
|
|
for attachment in attachments.iter() {
|
|
|
|
|
for (i, attachment) in attachments.iter().enumerate() {
|
|
|
|
|
let extension;
|
|
|
|
|
if let Some(content_type) = &attachment.content_type {
|
|
|
|
|
if content_type == "image/png" {
|
|
|
|
@ -112,11 +112,12 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|
|
|
|
}
|
|
|
|
|
requires_rebuild = true;
|
|
|
|
|
let file_name = format!(
|
|
|
|
|
"{}-{}-{}-{}.{}",
|
|
|
|
|
"{}-{}-{}-{}{}.{}",
|
|
|
|
|
i + 1,
|
|
|
|
|
slugify(&author.name),
|
|
|
|
|
author.discriminator,
|
|
|
|
|
timestamp,
|
|
|
|
|
if i == 0 { "".to_owned() } else { format!("-{}", i + 1) },
|
|
|
|
|
extension
|
|
|
|
|
);
|
|
|
|
|
images.push(file_name.clone().into());
|
|
|
|
@ -138,7 +139,7 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|
|
|
|
format!("{}#{}", author.name, author.discriminator).into(),
|
|
|
|
|
);
|
|
|
|
|
let mut images: Vec<String> = Vec::new();
|
|
|
|
|
for attachment in attachments.iter() {
|
|
|
|
|
for (i, attachment) in attachments.iter().enumerate() {
|
|
|
|
|
let extension;
|
|
|
|
|
if let Some(content_type) = &attachment.content_type {
|
|
|
|
|
if content_type == "image/png" {
|
|
|
|
@ -155,11 +156,12 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|
|
|
|
}
|
|
|
|
|
requires_rebuild = true;
|
|
|
|
|
let file_name = format!(
|
|
|
|
|
"{}-{}-{}-{}.{}",
|
|
|
|
|
"{}-{}-{}-{}{}.{}",
|
|
|
|
|
submission_data.len() + 1,
|
|
|
|
|
slugify(&author.name),
|
|
|
|
|
author.discriminator,
|
|
|
|
|
timestamp,
|
|
|
|
|
if i == 0 { "".to_owned() } else { format!("-{}", i + 1) },
|
|
|
|
|
extension
|
|
|
|
|
);
|
|
|
|
|
images.push(file_name.clone().into());
|
|
|
|
|