aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Perry <avaglir@gmail.com>2019-03-08 23:10:56 -0500
committerNathan Perry <avaglir@gmail.com>2019-03-08 23:11:21 -0500
commita0aa6c6310b046d27c71cef23dcf6e6811cc11de (patch)
tree85dcb550a2899d81828a32a3db564e97b4718edd
parentb732c71e71305f726cf1b7f587b758fcb43f18f3 (diff)
handle empty case
-rw-r--r--src/game.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/game.rs b/src/game.rs
index ae7e76f..431776e 100644
--- a/src/game.rs
+++ b/src/game.rs
@@ -266,9 +266,13 @@ fn game(_ctx: &mut Context, msg: &Message, args: Args, min_status: GameStatus) -
games_in_common = games_in_common.intersection(&relevant_games).cloned().collect();
}
- let games_formatted = games_in_common.iter().sorted_by(|a, b| {
+ let mut games_formatted = games_in_common.iter().sorted_by(|a, b| {
a.to_lowercase().cmp(&b.to_lowercase())
}).join("\n");
+ if games_formatted.is_empty() {
+ games_formatted = "**LITERALLY NOTHING**".to_owned();
+ }
+
send(msg.channel_id, &games_formatted, msg.tts)
}