B:BD[
2.392] → [
2.392:1106]
pub fn dog(ctx: &mut Context, msg: &Message, _args: Args) -> CommandResult {
let page = fetch_dog_page();
if let Err(e) = page {
let _ = msg.reply(
&ctx,
format!(
"Doggo express: your doggo was not able to come because: {}",
e
),
);
return Ok(());
}
let url = fetch_url_in_dog_page(page?);
if url.is_none() {
let _ = msg.reply(
&ctx,
format!("Doggo express: your doggo got lost :pensive:"),
);
return Ok(());
}
let url = url.unwrap();
let _ = msg
.channel_id
.send_files(&ctx, vec![url.as_str()], |m| m.content(&msg.author));
pub fn dog(ctx: &mut Context, msg: &Message, args: Args) -> CommandResult {
let url = if args.len() != 0 {
fetch_dog_breed_url(args.raw().collect::<Vec<&str>>())
} else {
fetch_random_dog_url()
};
match url {
Ok(url) => msg
.channel_id
.send_files(&ctx, vec![url.as_str()], |m| m.content(&msg.author)),
Err(annoncement) => msg.reply(&ctx, format!("Doggo express: {}", annoncement)),
};