Add typing status to submission command, closes #4

late-submissions
Elnu 3 years ago
parent 9295fb48f8
commit a92872bdd0

@ -1,6 +1,7 @@
use serenity::framework::standard::{macros::command, Args, CommandResult}; use serenity::framework::standard::{macros::command, Args, CommandResult};
use serenity::model::prelude::*; use serenity::model::prelude::*;
use serenity::prelude::*; use serenity::prelude::*;
use serenity::http::typing::Typing;
use std::env; use std::env;
use std::fs; use std::fs;
@ -186,6 +187,7 @@ async fn submit(ctx: &Context, msg: &Message) -> CommandResult {
.await?; .await?;
return Ok(()); return Ok(());
} }
let typing = Typing::start(ctx.http.clone(), *msg.channel_id.as_u64()).unwrap();
let challenge_number = get_challenge_number(); let challenge_number = get_challenge_number();
let submission_images_dir = get_submission_images_dir(); let submission_images_dir = get_submission_images_dir();
@ -295,6 +297,7 @@ async fn submit(ctx: &Context, msg: &Message) -> CommandResult {
} else if invalid_types { } else if invalid_types {
message.push_str("Sorry, your submission could not be uploaded; only **.png**, **.jpg**, and **.jpeg** files are permitted."); message.push_str("Sorry, your submission could not be uploaded; only **.png**, **.jpg**, and **.jpeg** files are permitted.");
} }
typing.stop();
msg.reply(&ctx.http, message).await?; msg.reply(&ctx.http, message).await?;
Ok(()) Ok(())
} }

Loading…
Cancel
Save