send message when queue is empty
This commit is contained in:
parent
d6b2b54d13
commit
959f954d9d
1 changed files with 8 additions and 6 deletions
|
|
@ -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(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue