local image caching to redis done?
This commit is contained in:
@ -24,11 +24,11 @@ namespace NadekoBot.Modules.Gambling
|
||||
private static readonly Regex fudgeRegex = new Regex(@"^(?<n1>\d+)d(?:F|f)$", RegexOptions.Compiled);
|
||||
|
||||
private static readonly char[] _fateRolls = { '-', ' ', '+' };
|
||||
private readonly IImagesService _images;
|
||||
private readonly IImageCache _images;
|
||||
|
||||
public DriceRollCommands(IImagesService images)
|
||||
public DriceRollCommands(IDataCache data)
|
||||
{
|
||||
_images = images;
|
||||
_images = data.LocalImages;
|
||||
}
|
||||
|
||||
|
||||
@ -141,10 +141,8 @@ namespace NadekoBot.Modules.Gambling
|
||||
private async Task InternallDndRoll(string arg, bool ordered)
|
||||
{
|
||||
Match match;
|
||||
int n1;
|
||||
int n2;
|
||||
if ((match = fudgeRegex.Match(arg)).Length != 0 &&
|
||||
int.TryParse(match.Groups["n1"].ToString(), out n1) &&
|
||||
int.TryParse(match.Groups["n1"].ToString(), out int n1) &&
|
||||
n1 > 0 && n1 < 500)
|
||||
{
|
||||
var rng = new NadekoRandom();
|
||||
@ -164,13 +162,14 @@ namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
var rng = new NadekoRandom();
|
||||
if (int.TryParse(match.Groups["n1"].ToString(), out n1) &&
|
||||
int.TryParse(match.Groups["n2"].ToString(), out n2) &&
|
||||
int.TryParse(match.Groups["n2"].ToString(), out int n2) &&
|
||||
n1 <= 50 && n2 <= 100000 && n1 > 0 && n2 > 0)
|
||||
{
|
||||
var add = 0;
|
||||
var sub = 0;
|
||||
int.TryParse(match.Groups["add"].Value, out add);
|
||||
int.TryParse(match.Groups["sub"].Value, out sub);
|
||||
if (!int.TryParse(match.Groups["add"].Value, out int add) ||
|
||||
!int.TryParse(match.Groups["sub"].Value, out int sub))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var arr = new int[n1];
|
||||
for (int i = 0; i < n1; i++)
|
||||
@ -179,7 +178,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
}
|
||||
|
||||
var sum = arr.Sum();
|
||||
var embed = new EmbedBuilder().WithOkColor().WithDescription(Context.User.Mention + " " +GetText("dice_rolled_num", n1) + $"`1 - {n2}`")
|
||||
var embed = new EmbedBuilder().WithOkColor().WithDescription(Context.User.Mention + " " + GetText("dice_rolled_num", n1) + $"`1 - {n2}`")
|
||||
.AddField(efb => efb.WithName(Format.Bold("Rolls"))
|
||||
.WithValue(string.Join(" ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => Format.Code(x.ToString())))))
|
||||
.AddField(efb => efb.WithName(Format.Bold("Sum"))
|
||||
|
@ -17,15 +17,15 @@ namespace NadekoBot.Modules.Gambling
|
||||
[Group]
|
||||
public class FlipCoinCommands : NadekoSubmodule
|
||||
{
|
||||
private readonly IImagesService _images;
|
||||
private readonly IImageCache _images;
|
||||
private readonly IBotConfigProvider _bc;
|
||||
private readonly CurrencyService _cs;
|
||||
|
||||
private static readonly NadekoRandom rng = new NadekoRandom();
|
||||
|
||||
public FlipCoinCommands(IImagesService images, CurrencyService cs, IBotConfigProvider bc)
|
||||
public FlipCoinCommands(IDataCache data, CurrencyService cs, IBotConfigProvider bc)
|
||||
{
|
||||
_images = images;
|
||||
_images = data.LocalImages;
|
||||
_bc = bc;
|
||||
_cs = cs;
|
||||
}
|
||||
|
@ -32,12 +32,12 @@ namespace NadekoBot.Modules.Gambling
|
||||
//https://lh6.googleusercontent.com/-i1hjAJy_kN4/UswKxmhrbPI/AAAAAAAAB1U/82wq_4ZZc-Y/DE6B0895-6FC1-48BE-AC4F-14D1B91AB75B.jpg
|
||||
//thanks to judge for helping me with this
|
||||
|
||||
private readonly IImagesService _images;
|
||||
private readonly IImageCache _images;
|
||||
private readonly CurrencyService _cs;
|
||||
|
||||
public SlotCommands(IImagesService images, IBotConfigProvider bc, CurrencyService cs)
|
||||
public SlotCommands(IDataCache data, IBotConfigProvider bc, CurrencyService cs)
|
||||
{
|
||||
_images = images;
|
||||
_images = data.LocalImages;
|
||||
_bc = bc;
|
||||
_cs = cs;
|
||||
}
|
||||
|
Reference in New Issue
Block a user