From ea59fab28aeb4b35220bfccc44665e0b1eb5dd05 Mon Sep 17 00:00:00 2001 From: dboerlage Date: Mon, 15 May 2017 20:43:50 +0200 Subject: [PATCH] Adds choose command --- Geekbot.net/Modules/Choose.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Geekbot.net/Modules/Choose.cs diff --git a/Geekbot.net/Modules/Choose.cs b/Geekbot.net/Modules/Choose.cs new file mode 100644 index 0000000..b7114a4 --- /dev/null +++ b/Geekbot.net/Modules/Choose.cs @@ -0,0 +1,24 @@ +using System; +using System.Threading.Tasks; +using Discord.Commands; +using Geekbot.net.Lib.IClients; + +namespace Geekbot.net.Modules +{ + public class Choose : ModuleBase + { + private readonly IRandomClient rnd; + public Choose(IRandomClient randomClient) + { + rnd = randomClient; + } + + [Command("choose", RunMode = RunMode.Async), Summary("Let the bot make a choice for you.")] + public async Task Command([Remainder, Summary("The choices, sepperated by a ;")] string choices) + { + var choicesArray = choices.Split(';'); + var choice = rnd.Client.Next(choicesArray.Length); + ReplyAsync($"I choose **{choicesArray[choice]}**"); + } + } +} \ No newline at end of file