geekbot/Geekbot.net/Commands/Choose.cs

25 lines
710 B
C#
Raw Normal View History

using System;
using System.Threading.Tasks;
using Discord.Commands;
namespace Geekbot.net.Commands
{
public class Choose : ModuleBase
{
private readonly Random rnd;
2017-09-15 22:56:03 +02:00
public Choose(Random RandomClient)
{
rnd = RandomClient;
}
2017-09-15 22:56:03 +02:00
[Command("choose", RunMode = RunMode.Async)]
[Summary("Seperate options with a semicolon.")]
public async Task Command([Remainder] [Summary("option1;option2")] string choices)
{
var choicesArray = choices.Split(';');
var choice = rnd.Next(choicesArray.Length);
await ReplyAsync($"I choose **{choicesArray[choice]}**");
}
}
2017-05-15 20:43:50 +02:00
}