Fix crosspost links
This commit is contained in:
parent
7481c7830c
commit
3c26122a0b
1 changed files with 7 additions and 6 deletions
|
@ -200,9 +200,14 @@ pub async fn submit(
|
||||||
}
|
}
|
||||||
leaderboard(&ctx).await?;
|
leaderboard(&ctx).await?;
|
||||||
rebuild_site();
|
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 attachment in attachments.iter() {
|
||||||
for (guild, data) in guild_data.iter() {
|
for (other_guild_id, data) in guild_data.iter() {
|
||||||
let here = guild.eq(&ctx.guild_id().unwrap().as_u64().to_string());
|
let here = other_guild_id.eq(&ctx.guild_id().unwrap().as_u64().to_string());
|
||||||
if !repost_here && here {
|
if !repost_here && here {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -217,9 +222,6 @@ pub async fn submit(
|
||||||
.parse::<u64>()
|
.parse::<u64>()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
let invite = if data.contains_key("invite") {
|
|
||||||
Some(data["invite"].as_str().unwrap())
|
|
||||||
} else { None };
|
|
||||||
let accent_color = ctx
|
let accent_color = ctx
|
||||||
.discord()
|
.discord()
|
||||||
.http
|
.http
|
||||||
|
@ -233,7 +235,6 @@ pub async fn submit(
|
||||||
let n = get_challenge_number();
|
let n = get_challenge_number();
|
||||||
let mut description = format!("New submission to [Tegaki Tuesday #{n}](https://tegakituesday.com/{n})!");
|
let mut description = format!("New submission to [Tegaki Tuesday #{n}](https://tegakituesday.com/{n})!");
|
||||||
if !here {
|
if !here {
|
||||||
let guild = ctx.guild().unwrap();
|
|
||||||
description.push_str(&if let Some(invite) = invite {
|
description.push_str(&if let Some(invite) = invite {
|
||||||
format!("\nCrossposted from [{}](https://discord.gg/{invite})", guild.name)
|
format!("\nCrossposted from [{}](https://discord.gg/{invite})", guild.name)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue