Make random more random than the google bot
This commit is contained in:
parent
cabf942362
commit
acc8947782
11 changed files with 20 additions and 43 deletions
|
@ -12,11 +12,9 @@ namespace Geekbot.net.Commands
|
|||
{
|
||||
private readonly IMediaProvider _checkEmImages;
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly Random _rnd;
|
||||
|
||||
public CheckEm(Random RandomClient, IMediaProvider mediaProvider, IErrorHandler errorHandler)
|
||||
public CheckEm(IMediaProvider mediaProvider, IErrorHandler errorHandler)
|
||||
{
|
||||
_rnd = RandomClient;
|
||||
_checkEmImages = mediaProvider;
|
||||
_errorHandler = errorHandler;
|
||||
}
|
||||
|
@ -28,7 +26,7 @@ namespace Geekbot.net.Commands
|
|||
{
|
||||
try
|
||||
{
|
||||
var number = _rnd.Next(10000000, 99999999);
|
||||
var number = new Random().Next(10000000, 99999999);
|
||||
var dubtriqua = "";
|
||||
|
||||
var ns = GetIntArray(number);
|
||||
|
|
|
@ -8,12 +8,10 @@ namespace Geekbot.net.Commands
|
|||
public class Choose : ModuleBase
|
||||
{
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly Random _rnd;
|
||||
private readonly ITranslationHandler _translation;
|
||||
|
||||
public Choose(Random RandomClient, IErrorHandler errorHandler, ITranslationHandler translation)
|
||||
public Choose(IErrorHandler errorHandler, ITranslationHandler translation)
|
||||
{
|
||||
_rnd = RandomClient;
|
||||
_errorHandler = errorHandler;
|
||||
_translation = translation;
|
||||
}
|
||||
|
@ -28,7 +26,7 @@ namespace Geekbot.net.Commands
|
|||
{
|
||||
var transDict = _translation.GetDict(Context);
|
||||
var choicesArray = choices.Split(';');
|
||||
var choice = _rnd.Next(choicesArray.Length);
|
||||
var choice = new Random().Next(choicesArray.Length);
|
||||
await ReplyAsync(string.Format(transDict["Choice"], choicesArray[choice]));
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -10,13 +10,6 @@ namespace Geekbot.net.Commands
|
|||
{
|
||||
public class Dice : ModuleBase
|
||||
{
|
||||
private readonly Random _rnd;
|
||||
|
||||
public Dice(Random RandomClient)
|
||||
{
|
||||
_rnd = RandomClient;
|
||||
}
|
||||
|
||||
[Command("dice", RunMode = RunMode.Async)]
|
||||
[Remarks(CommandCategories.Randomness)]
|
||||
[Summary("Roll a dice.")]
|
||||
|
@ -75,7 +68,7 @@ namespace Geekbot.net.Commands
|
|||
var results = new List<int>();
|
||||
for (var i = 0; i < dice.times; i++)
|
||||
{
|
||||
var roll = _rnd.Next(1, dice.sides);
|
||||
var roll = new Random().Next(1, dice.sides);
|
||||
total += roll;
|
||||
results.Add(roll);
|
||||
if (roll == dice.sides) extraText = "**Critical Hit!**";
|
||||
|
|
|
@ -9,11 +9,9 @@ namespace Geekbot.net.Commands
|
|||
public class EightBall : ModuleBase
|
||||
{
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly Random _rnd;
|
||||
|
||||
public EightBall(Random RandomClient, IErrorHandler errorHandler)
|
||||
public EightBall(IErrorHandler errorHandler)
|
||||
{
|
||||
_rnd = RandomClient;
|
||||
_errorHandler = errorHandler;
|
||||
}
|
||||
|
||||
|
@ -48,7 +46,7 @@ namespace Geekbot.net.Commands
|
|||
"Very doubtful"
|
||||
};
|
||||
|
||||
var answer = _rnd.Next(replies.Count);
|
||||
var answer = new Random().Next(replies.Count);
|
||||
await ReplyAsync(replies[answer]);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Geekbot.net.Commands
|
|||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly IDatabase _redis;
|
||||
|
||||
public Quote(IDatabase redis, IErrorHandler errorHandler, Random random)
|
||||
public Quote(IDatabase redis, IErrorHandler errorHandler)
|
||||
{
|
||||
_redis = redis;
|
||||
_errorHandler = errorHandler;
|
||||
|
|
|
@ -10,13 +10,11 @@ namespace Geekbot.net.Commands
|
|||
{
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly IDatabase _redis;
|
||||
private readonly Random _rnd;
|
||||
private readonly ITranslationHandler _translation;
|
||||
|
||||
public Roll(IDatabase redis, Random RandomClient, IErrorHandler errorHandler, ITranslationHandler translation)
|
||||
public Roll(IDatabase redis, IErrorHandler errorHandler, ITranslationHandler translation)
|
||||
{
|
||||
_redis = redis;
|
||||
_rnd = RandomClient;
|
||||
_translation = translation;
|
||||
_errorHandler = errorHandler;
|
||||
}
|
||||
|
@ -28,7 +26,7 @@ namespace Geekbot.net.Commands
|
|||
{
|
||||
try
|
||||
{
|
||||
var number = _rnd.Next(1, 100);
|
||||
var number = new Random().Next(1, 100);
|
||||
var guess = 1000;
|
||||
int.TryParse(stuff, out guess);
|
||||
var transDict = _translation.GetDict(Context);
|
||||
|
|
|
@ -11,12 +11,10 @@ namespace Geekbot.net.Commands
|
|||
{
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly IDatabase _redis;
|
||||
private readonly Random _rnd;
|
||||
|
||||
public Ship(IDatabase redis, Random randomClient, IErrorHandler errorHandler)
|
||||
public Ship(IDatabase redis, IErrorHandler errorHandler)
|
||||
{
|
||||
_redis = redis;
|
||||
_rnd = randomClient;
|
||||
_errorHandler = errorHandler;
|
||||
}
|
||||
|
||||
|
@ -37,7 +35,7 @@ namespace Geekbot.net.Commands
|
|||
var shippingRate = 0;
|
||||
if (dbval.IsNullOrEmpty)
|
||||
{
|
||||
shippingRate = _rnd.Next(1, 100);
|
||||
shippingRate = new Random().Next(1, 100);
|
||||
_redis.HashSet($"{Context.Guild.Id}:Ships", dbstring, shippingRate);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -11,13 +11,11 @@ namespace Geekbot.net.Commands
|
|||
public class Slap : ModuleBase
|
||||
{
|
||||
private readonly IErrorHandler _errorHandler;
|
||||
private readonly Random _random;
|
||||
private readonly IDatabase _redis;
|
||||
|
||||
public Slap(IErrorHandler errorHandler, Random random, IDatabase redis)
|
||||
public Slap(IErrorHandler errorHandler, IDatabase redis)
|
||||
{
|
||||
_errorHandler = errorHandler;
|
||||
_random = random;
|
||||
_redis = redis;
|
||||
}
|
||||
|
||||
|
@ -61,7 +59,7 @@ namespace Geekbot.net.Commands
|
|||
_redis.HashIncrement($"{Context.Guild.Id}:SlapsRecieved", user.Id.ToString());
|
||||
_redis.HashIncrement($"{Context.Guild.Id}:SlapsGiven", Context.User.Id.ToString());
|
||||
|
||||
await ReplyAsync($"{Context.User.Username} slapped {user.Username} with a {things[_random.Next(things.Count - 1)]}");
|
||||
await ReplyAsync($"{Context.User.Username} slapped {user.Username} with a {things[new Random().Next(things.Count - 1)]}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue