Fix crosspost links

late-submissions
Elnu 2 years ago
parent 7481c7830c
commit 3c26122a0b

@ -200,9 +200,14 @@ pub async fn submit(
}
leaderboard(&ctx).await?;
rebuild_site();
let guild = ctx.guild().unwrap();
let data = guild_data[&guild.id.to_string()].as_object().unwrap();
let invite = if data.contains_key("invite") {
Some(data["invite"].as_str().unwrap())
} else { None };
for attachment in attachments.iter() {
for (guild, data) in guild_data.iter() {
let here = guild.eq(&ctx.guild_id().unwrap().as_u64().to_string());
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 {
continue;
}
@ -217,9 +222,6 @@ pub async fn submit(
.parse::<u64>()
.unwrap(),
);
let invite = if data.contains_key("invite") {
Some(data["invite"].as_str().unwrap())
} else { None };
let accent_color = ctx
.discord()
.http
@ -233,7 +235,6 @@ pub async fn submit(
let n = get_challenge_number();
let mut description = format!("New submission to [Tegaki Tuesday #{n}](https://tegakituesday.com/{n})!");
if !here {
let guild = ctx.guild().unwrap();
description.push_str(&if let Some(invite) = invite {
format!("\nCrossposted from [{}](https://discord.gg/{invite})", guild.name)
} else {

Loading…
Cancel
Save