send message when queue is empty

This commit is contained in:
Oleg Sobolev 2024-03-26 10:09:26 +07:00
parent d6b2b54d13
commit 959f954d9d

View file

@ -68,15 +68,17 @@ impl TelegramBot {
}
Command::List => {
let tracks = player.lock().unwrap().list_tracks();
bot.send_message(
msg.chat.id,
tracks
let message: String;
if tracks.is_empty() {
message = String::from("The queue is empty.");
} else {
message = tracks
.iter()
.map(|t| t.path.to_str().unwrap())
.collect::<Vec<&str>>()
.join("\n"),
)
.await?;
.join("\n");
}
bot.send_message(msg.chat.id, message).await?;
}
};
Ok(())