|
|
@ -20,7 +20,8 @@ use std::path::Path;
|
|
|
|
)]
|
|
|
|
)]
|
|
|
|
pub async fn challenge(ctx: Context<'_>) -> Result<(), Error> {
|
|
|
|
pub async fn challenge(ctx: Context<'_>) -> Result<(), Error> {
|
|
|
|
ctx.say(format!(
|
|
|
|
ctx.say(format!(
|
|
|
|
"Tegaki Tuesday #{n}: <https://tegakituesday.com/{n}>",
|
|
|
|
"Tegaki Tuesday #{n}: <https://{domain}/{n}>",
|
|
|
|
|
|
|
|
domain = get_domain(),
|
|
|
|
n = get_challenge_number()
|
|
|
|
n = get_challenge_number()
|
|
|
|
))
|
|
|
|
))
|
|
|
|
.await?;
|
|
|
|
.await?;
|
|
|
@ -178,7 +179,7 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|
|
|
set_submission_data(submission_data);
|
|
|
|
set_submission_data(submission_data);
|
|
|
|
let mut message = String::new();
|
|
|
|
let mut message = String::new();
|
|
|
|
if requires_rebuild {
|
|
|
|
if requires_rebuild {
|
|
|
|
let thank_you = &format!("Thank you for submitting! You can view your submission at <https://tegakituesday.com/{}>", challenge_number);
|
|
|
|
let thank_you = &format!("Thank you for submitting! You can view your submission at <https://{domain}/{}>", challenge_number, domain = get_domain());
|
|
|
|
let mut repost_here = true;
|
|
|
|
let mut repost_here = true;
|
|
|
|
match ctx {
|
|
|
|
match ctx {
|
|
|
|
Context::Application(_) => message.push_str(thank_you),
|
|
|
|
Context::Application(_) => message.push_str(thank_you),
|
|
|
@ -230,8 +231,9 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|
|
|
channel.send_message(&ctx.serenity_context().http, |m| {
|
|
|
|
channel.send_message(&ctx.serenity_context().http, |m| {
|
|
|
|
m.embed(|e| {
|
|
|
|
m.embed(|e| {
|
|
|
|
let username = format!("{}#{}", author.name, author.discriminator);
|
|
|
|
let username = format!("{}#{}", author.name, author.discriminator);
|
|
|
|
|
|
|
|
let domain = get_domain();
|
|
|
|
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://{domain}/{n})!");
|
|
|
|
if !here {
|
|
|
|
if !here {
|
|
|
|
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)
|
|
|
@ -246,7 +248,7 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
|
|
|
|
.name(username)
|
|
|
|
.name(username)
|
|
|
|
.url(format!("https://discord.com/users/{}", author.id));
|
|
|
|
.url(format!("https://discord.com/users/{}", author.id));
|
|
|
|
e.set_author(embed_author);
|
|
|
|
e.set_author(embed_author);
|
|
|
|
e.image(format!("https://tegakituesday.com/{n}/{image}#{timestamp}"));
|
|
|
|
e.image(format!("https://{domain}/{n}/{image}#{timestamp}"));
|
|
|
|
if let Some(accent_color) = accent_color {
|
|
|
|
if let Some(accent_color) = accent_color {
|
|
|
|
e.color(accent_color);
|
|
|
|
e.color(accent_color);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -300,10 +302,11 @@ pub async fn images(ctx: Context<'_>) -> Result<(), Error> {
|
|
|
|
));
|
|
|
|
));
|
|
|
|
for (i, image) in images.iter().enumerate() {
|
|
|
|
for (i, image) in images.iter().enumerate() {
|
|
|
|
message.push_str(&format!(
|
|
|
|
message.push_str(&format!(
|
|
|
|
"({})<https://tegakituesday.com/{}/{}>\n",
|
|
|
|
"({})<https://{domain}/{}/{}>\n",
|
|
|
|
to_fullwidth(&(i + 1).to_string()),
|
|
|
|
to_fullwidth(&(i + 1).to_string()),
|
|
|
|
challenge_number,
|
|
|
|
challenge_number,
|
|
|
|
image
|
|
|
|
image,
|
|
|
|
|
|
|
|
domain = get_domain()
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ctx.say(message).await?;
|
|
|
|
ctx.say(message).await?;
|
|
|
|