2017-04-13 00:03:03 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Discord.Commands;
|
2017-10-12 16:34:10 +02:00
|
|
|
|
using Geekbot.net.Lib;
|
2017-04-13 00:03:03 +02:00
|
|
|
|
|
2017-10-02 21:57:48 +02:00
|
|
|
|
namespace Geekbot.net.Commands
|
2017-04-13 00:03:03 +02:00
|
|
|
|
{
|
|
|
|
|
public class EightBall : ModuleBase
|
|
|
|
|
{
|
2017-10-26 00:55:04 +02:00
|
|
|
|
private readonly IErrorHandler _errorHandler;
|
2017-09-15 22:56:03 +02:00
|
|
|
|
|
2018-02-14 23:01:28 +01:00
|
|
|
|
public EightBall(IErrorHandler errorHandler)
|
2017-04-25 17:27:11 +02:00
|
|
|
|
{
|
2017-10-26 00:55:04 +02:00
|
|
|
|
_errorHandler = errorHandler;
|
2017-04-25 17:27:11 +02:00
|
|
|
|
}
|
2017-09-15 22:56:03 +02:00
|
|
|
|
|
|
|
|
|
[Command("8ball", RunMode = RunMode.Async)]
|
2017-10-12 16:34:10 +02:00
|
|
|
|
[Remarks(CommandCategories.Randomness)]
|
2017-09-15 22:56:03 +02:00
|
|
|
|
[Summary("Ask 8Ball a Question.")]
|
|
|
|
|
public async Task Ball([Remainder] [Summary("Question")] string echo)
|
2017-04-13 00:03:03 +02:00
|
|
|
|
{
|
2017-10-26 00:55:04 +02:00
|
|
|
|
try
|
2017-09-15 22:56:03 +02:00
|
|
|
|
{
|
2017-10-26 00:55:04 +02:00
|
|
|
|
var replies = new List<string>
|
|
|
|
|
{
|
|
|
|
|
"It is certain",
|
|
|
|
|
"It is decidedly so",
|
|
|
|
|
"Without a doubt",
|
|
|
|
|
"Yes, definitely",
|
|
|
|
|
"You may rely on it",
|
|
|
|
|
"As I see it, yes",
|
|
|
|
|
"Most likely",
|
|
|
|
|
"Outlook good",
|
|
|
|
|
"Yes",
|
|
|
|
|
"Signs point to yes",
|
|
|
|
|
"Reply hazy try again",
|
|
|
|
|
"Ask again later",
|
|
|
|
|
"Better not tell you now",
|
|
|
|
|
"Cannot predict now",
|
|
|
|
|
"Concentrate and ask again",
|
|
|
|
|
"Don't count on it",
|
|
|
|
|
"My reply is no",
|
|
|
|
|
"My sources say no",
|
|
|
|
|
"Outlook not so good",
|
|
|
|
|
"Very doubtful"
|
|
|
|
|
};
|
2017-04-13 00:03:03 +02:00
|
|
|
|
|
2018-02-14 23:01:28 +01:00
|
|
|
|
var answer = new Random().Next(replies.Count);
|
2017-10-26 00:55:04 +02:00
|
|
|
|
await ReplyAsync(replies[answer]);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
_errorHandler.HandleCommandException(e, Context);
|
|
|
|
|
}
|
2017-04-13 00:03:03 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|