fn dm_with_message(reminder: Reminder) -> Result<(), String> {
    let userid = UserId::from_str(&reminder.user_id).map_err(|e| format!("Failed to get user id: {}", e))?;

    let user = userid
        .get()
        .map_err(|e| format!("Failed to get user: {}", e))?;

    let mut response = match reminder.message {
        None => "Hello! You asked me to remind you of something at this time,\
         but you didn't specify what!".to_owned(),
        Some(m) => format!("Hello! You asked me to remind you of the following:\n{}", m)
    };

    response.push_str(&format!("\nYou can find the place you issued the command\
                              by searching for `{}`", reminder.bookmark));

    if let Some(server_id) = reminder.server_id {
        let servername = u64::from_str(&server_id)
            .and_then(|u| Ok(GuildId::from(u)))
            .map_err(|e| format!("Failed to get user id: {}", e))?;

        response.push_str(&format!(" in {}", servername));
    }

    user.direct_message(|m| m.content(&response))
        .map_err(|why| format!("Failed to DM user: {}", why))?;

    Ok(())
}
/// Parses a user_id and sends a reminder to the user.
Parses a user_id and sends a reminder to the user.
Parses a user_id and sends a reminder to the user .
fn dm_with_message(reminder: Reminder) -> Result<(), String> {
    let userid = UserId::from_str(&reminder.user_id).map_err(|e| format!("Failed to get user id: {}", e))?;
    let user = userid
        .get()
        .map_err(|e| format!("Failed to get user: {}", e))?;
    let mut response = match reminder.message {
        None => "Hello! You asked me to remind you of something at this time,\
         but you didn't specify what!".to_owned(),
        Some(m) => format!("Hello! You asked me to remind you of the following:\n{}", m)
    };
    response.push_str(&format!("\nYou can find the place you issued the command\
                              by searching for `{}`", reminder.bookmark));
    if let Some(server_id) = reminder.server_id {
        let servername = u64::from_str(&server_id)
            .and_then(|u| Ok(GuildId::from(u)))
            .map_err(|e| format!("Failed to get user id: {}", e))?;
        response.push_str(&format!(" in {}", servername));
    }
    user.direct_message(|m| m.content(&response))
        .map_err(|why| format!("Failed to DM user: {}", why))?;
    Ok(())
}
fn dm_with_message ( reminder : Reminder ) -> Result < ( ) , String > { let userid = UserId :: from_str ( & reminder . user_id ) . map_err ( | e | format ! ( " " e ) ) ? ; let user = userid . get ( ) . map_err ( | e | format ! ( " " e ) ) ? ; let mut response = match reminder . message { None => " \
 " . to_owned ( ) , Some ( m ) => format ! ( " \n " m ) } ; response . push_str ( & format ! ( " \n \
 " reminder bookmark ) ) ; if let Some ( server_id ) = reminder . server_id { let servername = u64 :: from_str ( & server_id ) . and_then ( | u | Ok ( GuildId :: from ( u ) ) ) . map_err ( | e | format ! ( " " e ) ) ? ; response . push_str ( & format ! ( " " servername ) ) ; } user . direct_message ( | m | m . content ( & response ) ) . map_err ( | why | format ! ( " " why ) ) ? ; Ok ( ( ) ) }
Parses a user_id and sends a reminder to the user.
Parses a user_id and sends a reminder to the user .
reminder
Reminder