Adds choose command
This commit is contained in:
parent
10fe9e3ada
commit
ea59fab28a
1 changed files with 24 additions and 0 deletions
24
Geekbot.net/Modules/Choose.cs
Normal file
24
Geekbot.net/Modules/Choose.cs
Normal file
|
@ -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]}**");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue