Make embeds link to Tegaki Tuesday
This commit is contained in:
parent
8dde342d97
commit
c7ac46a427
1 changed files with 5 additions and 6 deletions
|
@ -89,10 +89,11 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|||
Context::Prefix(ctx) => &ctx.msg.attachments,
|
||||
};
|
||||
let author = ctx.author();
|
||||
let mut images = Vec::new();
|
||||
for (i, submission) in submission_data.iter_mut().enumerate() {
|
||||
if is_matching_submission(&submission, author) {
|
||||
existing_submitter = true;
|
||||
let mut images = submission["images"].as_array_mut().unwrap().clone();
|
||||
images = submission["images"].as_array_mut().unwrap().clone();
|
||||
for attachment in attachments.iter() {
|
||||
let extension;
|
||||
if let Some(content_type) = &attachment.content_type {
|
||||
|
@ -124,7 +125,7 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|||
image_file.write_all(&image)?;
|
||||
image_file.flush()?;
|
||||
}
|
||||
submission["images"] = images.into();
|
||||
submission["images"] = images.clone().into();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -200,9 +201,7 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|||
let invite = if data.contains_key("invite") {
|
||||
Some(data["invite"].as_str().unwrap())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
for attachment in attachments.iter() {
|
||||
None }; for image in images.iter() {
|
||||
for (other_guild_id, data) in guild_data.iter() {
|
||||
let here = other_guild_id.eq(&ctx.guild_id().unwrap().as_u64().to_string());
|
||||
if !repost_here && here {
|
||||
|
@ -245,7 +244,7 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|||
.name(username)
|
||||
.url(format!("https://discord.com/users/{}", author.id));
|
||||
e.set_author(embed_author);
|
||||
e.image(&attachment.url);
|
||||
e.image(format!("https://tegakituesday.com/{n}/{image}"));
|
||||
if let Some(accent_color) = accent_color {
|
||||
e.color(accent_color);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue