Random is now even more random
This commit is contained in:
parent
5dd7d343ee
commit
341de410f1
6 changed files with 46 additions and 9 deletions
|
@ -2,11 +2,18 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib.IClients;
|
||||
|
||||
namespace Geekbot.net.Modules
|
||||
{
|
||||
public class EightBall : ModuleBase
|
||||
{
|
||||
private readonly IRandomClient rnd;
|
||||
public EightBall(IRandomClient randomClient)
|
||||
{
|
||||
rnd = randomClient;
|
||||
}
|
||||
|
||||
[Command("8ball"), Summary("Ask 8Ball a Question.")]
|
||||
public async Task Ball([Remainder, Summary("The Question")] string echo)
|
||||
{
|
||||
|
@ -32,8 +39,7 @@ namespace Geekbot.net.Modules
|
|||
"Outlook not so good",
|
||||
"Very doubtful"};
|
||||
|
||||
var rnd = new Random();
|
||||
var answer = rnd.Next(replies.Count);
|
||||
var answer = rnd.Client.Next(replies.Count);
|
||||
await ReplyAsync(replies[answer]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Geekbot.net.Lib;
|
||||
using Geekbot.net.Lib.IClients;
|
||||
|
||||
namespace Geekbot.net.Modules
|
||||
{
|
||||
public class Roll : ModuleBase
|
||||
{
|
||||
private readonly IRedisClient redis;
|
||||
public Roll(IRedisClient redisClient)
|
||||
private readonly IRandomClient rnd;
|
||||
public Roll(IRedisClient redisClient, IRandomClient randomClient)
|
||||
{
|
||||
redis = redisClient;
|
||||
rnd = randomClient;
|
||||
}
|
||||
|
||||
[Command("roll"), Summary("Roll a number between 1 and 100.")]
|
||||
public async Task RollCommand([Remainder, Summary("stuff...")] string stuff = "nothing")
|
||||
{
|
||||
var rnd = new Random();
|
||||
var number = rnd.Next(1, 100);
|
||||
var number = rnd.Client.Next(1, 100);
|
||||
var guess = 1000;
|
||||
int.TryParse(stuff, out guess);
|
||||
if (guess <= 100 && guess > 0)
|
||||
|
@ -40,8 +41,7 @@ namespace Geekbot.net.Modules
|
|||
[Command("dice"), Summary("Roll a dice")]
|
||||
public async Task DiceCommand([Summary("The highest number on the dice")] int max = 6)
|
||||
{
|
||||
var rnd = new Random();
|
||||
var number = rnd.Next(1, max);
|
||||
var number = rnd.Client.Next(1, max);
|
||||
await ReplyAsync(Context.Message.Author.Mention + ", you rolled " + number);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue