Add /spinbottle command
This commit is contained in:
parent
627eaac647
commit
2668ab3450
|
@ -18,6 +18,7 @@ await bot.SetMyCommandsAsync(new[] {
|
|||
new BotCommand { Command = "yesno", Description = "Answes binary questions" },
|
||||
new BotCommand { Command = "makedecision", Description = "Makes a decision. Expects a list of comma separated options." },
|
||||
new BotCommand { Command = "choose", Description = "Chooses an item. Expects a list of comma separated options." },
|
||||
new BotCommand { Command = "spinbottle", Description = "Spins a bottle (for truth or dare). Expects a list of users participating separated by a space." },
|
||||
new BotCommand { Command = "help", Description = "Lists all commands" },
|
||||
});
|
||||
|
||||
|
@ -27,6 +28,7 @@ var iBotCommands = new List<string> {
|
|||
"yesno",
|
||||
"makedecision",
|
||||
"choose",
|
||||
"spinbottle",
|
||||
"help",
|
||||
"start"
|
||||
};
|
||||
|
@ -133,6 +135,12 @@ async Task BotOnMessageReceived(ITelegramBotClient botClient, Message message) {
|
|||
options = new List<string> { "Syntax error. (Can't select from zero options)" };
|
||||
await botClient.SendTextMessageAsync(message.Chat.Id, RandomOption(options).Trim(), replyToMessageId: message.MessageId);
|
||||
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)" };
|
||||
await botClient.SendTextMessageAsync(message.Chat.Id, RandomOption(people).Trim() + ", truth or dare?", replyToMessageId: message.MessageId);
|
||||
break;
|
||||
case "help":
|
||||
case "start":
|
||||
await botClient.SendTextMessageAsync(message.Chat.Id, $"""
|
||||
|
|
Loading…
Reference in a new issue