Fixed code inconsistencies and adding support for logging to sentryio

This commit is contained in:
Runebaas 2017-10-26 00:55:04 +02:00
parent 2e083bc188
commit 9efac29956
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
18 changed files with 228 additions and 161 deletions

View file

@ -8,11 +8,13 @@ namespace Geekbot.net.Commands
{
public class EightBall : ModuleBase
{
private readonly Random rnd;
private readonly Random _rnd;
private readonly IErrorHandler _errorHandler;
public EightBall(Random RandomClient)
public EightBall(Random RandomClient, IErrorHandler errorHandler)
{
rnd = RandomClient;
_rnd = RandomClient;
_errorHandler = errorHandler;
}
[Command("8ball", RunMode = RunMode.Async)]
@ -20,32 +22,39 @@ namespace Geekbot.net.Commands
[Summary("Ask 8Ball a Question.")]
public async Task Ball([Remainder] [Summary("Question")] string echo)
{
var replies = new List<string>
try
{
"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"
};
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"
};
var answer = rnd.Next(replies.Count);
await ReplyAsync(replies[answer]);
var answer = _rnd.Next(replies.Count);
await ReplyAsync(replies[answer]);
}
catch (Exception e)
{
_errorHandler.HandleCommandException(e, Context);
}
}
}
}