Fix /spinbottle command

This commit is contained in:
Laura Hausmann 2023-01-27 23:27:14 +01:00
parent 2668ab3450
commit c601aed595
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -137,8 +137,11 @@ async Task BotOnMessageReceived(ITelegramBotClient botClient, Message message) {
break;
case "spinbottle":
var people = query?.Split(" ").Where(p => !string.IsNullOrWhiteSpace(p)).ToList();
if (people == null || !people.Any())
people = new List<string> { "Syntax error. (Can't select from zero options)" };
if (people == null || !people.Any()) {
await botClient.SendTextMessageAsync(message.Chat.Id, "Syntax error. (Can't select from zero options)", replyToMessageId: message.MessageId);
break;
}
await botClient.SendTextMessageAsync(message.Chat.Id, RandomOption(people).Trim() + ", truth or dare?", replyToMessageId: message.MessageId);
break;
case "help":