From 1cbb7d41362ad08b07b198a6bd1e8410bef1d47d Mon Sep 17 00:00:00 2001 From: tec <tec@ucc.gu.uwa.edu.au> Date: Fri, 27 Mar 2020 13:02:41 +0800 Subject: [PATCH] Improve account link messages --- src/user_management.rs | 28 ++++++++++++++++------------ src/voting.rs | 27 ++++++++++++++++++--------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/user_management.rs b/src/user_management.rs index 9d35a63..2bf3d2e 100644 --- a/src/user_management.rs +++ b/src/user_management.rs @@ -22,7 +22,9 @@ pub fn new_member(ctx: &Context, mut new_member: Member) { message.push_line("You should also know that we follow the Freenode Channel Guidelines: https://freenode.net/changuide, and try to avoid defamatory content."); message.push_line("Make sure to check out "); message.mention(&CONFIG.readme_channel); - message.push_line(" to get yourself some roles for directed pings 😊"); + message.push_line(" to get yourself some roles for directed pings 😊, and "); + message.push_mono(format!("{}register username", CONFIG.command_prefix)); + message.push_line(" to link to your UCC account."); send_message!(CONFIG.welcome_channel, &ctx, message.build()); let mut message = MessageBuilder::new(); @@ -100,15 +102,14 @@ impl Commands { ); return; } - match msg.channel_id.say( + send_message!( + msg.channel_id, &ctx.http, - format!("Ok {}, I've sent an email to you :)", account_name), - ) { - Ok(new_msg) => { - e!("Failed to delete message: {:?}", new_msg.delete(&ctx)); - } - Err(why) => error!("Error sending message: {:?}", why), - } + format!( + "Ok {}, see the email I've just sent you to complete the link", + account_name + ) + ); e!("Error deleting register message: {:?}", msg.delete(ctx)); @@ -128,7 +129,7 @@ impl Commands { .stdin(message.stdout.unwrap()) .output() { - Ok(_) => {} + Ok(_) => info!("Email sent to {}", account_name), Err(why) => error!("Unable to send message with mutt {:?}", why), }; } @@ -156,10 +157,13 @@ impl Commands { m }) ); - send_delete_message!( + let mut verification_message = MessageBuilder::new(); + verification_message.push(format!("Verification was sucessful {}. To proide a friendly introduction to yourself consider doing ", &full_member.username)); + verification_message.push_mono(format!("{}set bio <info>", CONFIG.command_prefix)); + send_message!( msg.channel_id, ctx.http.clone(), - "Verification sucessful" + verification_message.build() ); }) ); diff --git a/src/voting.rs b/src/voting.rs index d1b407d..bbb5c7d 100644 --- a/src/voting.rs +++ b/src/voting.rs @@ -17,12 +17,18 @@ impl Commands { create_motion(&ctx, &msg, motion); return; } - send_message!(msg.channel_id, &ctx.http, - "If there's something you want to motion, put it after the !move keyword"); + send_message!( + msg.channel_id, + &ctx.http, + "If there's something you want to motion, put it after the !move keyword" + ); } pub fn motion(ctx: Context, msg: Message, _content: &str) { - send_message!(msg.channel_id, &ctx.http, - "I hope you're not having a motion. You may have wanted to !move something instead."); + send_message!( + msg.channel_id, + &ctx.http, + "I hope you're not having a motion. You may have wanted to !move something instead." + ); } pub fn poll(ctx: Context, msg: Message, content: &str) { let topic = content; @@ -30,8 +36,11 @@ impl Commands { create_poll(&ctx, &msg, topic); return; } - send_message!(msg.channel_id, &ctx.http, - "If there's something you want to motion, put it after the !move keyword"); + send_message!( + msg.channel_id, + &ctx.http, + "If there's something you want to motion, put it after the !move keyword" + ); } pub fn cowsay(ctx: Context, msg: Message, content: &str) { let output = if !content.trim().is_empty() { @@ -240,9 +249,9 @@ fn update_motion( ); let update_status = |e: &mut serenity::builder::CreateEmbed, - status: &str, - last_status_full: String, - topic: &str| { + status: &str, + last_status_full: String, + topic: &str| { let last_status = last_status_full.lines().next().expect("No previous status"); if last_status == status { e.field("Status", last_status_full, true); -- GitLab