Removing bloat, fixing file names

This commit is contained in:
Kwoth
2023-03-11 09:10:37 +01:00
parent 8c8e9f7770
commit 1ad0bc33af
72 changed files with 210 additions and 2157 deletions

View File

@@ -1,5 +1,6 @@
#nullable disable
using Nadeko.Common;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Common.AnimalRacing;
using NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions;
@@ -135,7 +136,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task JoinRace(ShmartNumber amount = default)
public async Task JoinRace([OverrideTypeReader(typeof(BalanceTypeReader))] long amount = default)
{
if (!await CheckBetOptional(amount))
return;

View File

@@ -1,4 +1,5 @@
using NadekoBot.Modules.Gambling.Bank;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Gambling.Bank;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Services;
@@ -22,14 +23,14 @@ public partial class Gambling
}
[Cmd]
public async Task BankDeposit(ShmartNumber amount)
public async Task BankDeposit([OverrideTypeReader(typeof(BalanceTypeReader))] long amount)
{
if (amount <= 0)
return;
if (await _bank.DepositAsync(ctx.User.Id, amount))
{
await ReplyConfirmLocalizedAsync(strs.bank_deposited(N(amount.Value)));
await ReplyConfirmLocalizedAsync(strs.bank_deposited(N(amount)));
}
else
{
@@ -38,14 +39,14 @@ public partial class Gambling
}
[Cmd]
public async Task BankWithdraw(ShmartBankAmount amount)
public async Task BankWithdraw([OverrideTypeReader(typeof(BankBalanceTypeReader))] long amount)
{
if (amount <= 0)
return;
if (await _bank.WithdrawAsync(ctx.User.Id, amount))
{
await ReplyConfirmLocalizedAsync(strs.bank_withdrew(N(amount.Amount)));
await ReplyConfirmLocalizedAsync(strs.bank_withdrew(N(amount)));
}
else
{

View File

@@ -1,5 +1,6 @@
#nullable disable
using Nadeko.Common;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Common.Blackjack;
using NadekoBot.Modules.Gambling.Services;
@@ -30,7 +31,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task BlackJack(ShmartNumber amount)
public async Task BlackJack([OverrideTypeReader(typeof(BalanceTypeReader))] long amount)
{
if (!await CheckBetMandatory(amount))
return;

View File

@@ -1,5 +1,6 @@
#nullable disable
using Nadeko.Econ;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Services;
using SixLabors.ImageSharp;
@@ -135,12 +136,12 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public Task BetDraw(ShmartNumber amount, InputValueGuess val, InputColorGuess? col = null)
public Task BetDraw([OverrideTypeReader(typeof(BalanceTypeReader))] long amount, InputValueGuess val, InputColorGuess? col = null)
=> BetDrawInternal(amount, val, col);
[Cmd]
[RequireContext(ContextType.Guild)]
public Task BetDraw(ShmartNumber amount, InputColorGuess col, InputValueGuess? val = null)
public Task BetDraw([OverrideTypeReader(typeof(BalanceTypeReader))] long amount, InputColorGuess col, InputValueGuess? val = null)
=> BetDrawInternal(amount, val, col);
public async Task BetDrawInternal(long amount, InputValueGuess? val, InputColorGuess? col)

View File

@@ -1,5 +1,6 @@
#nullable disable
using Nadeko.Common;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Services;
using SixLabors.ImageSharp;
@@ -96,7 +97,7 @@ public partial class Gambling
}
[Cmd]
public async Task Betflip(ShmartNumber amount, BetFlipGuess guess)
public async Task Betflip([OverrideTypeReader(typeof(BalanceTypeReader))] long amount, BetFlipGuess guess)
{
if (!await CheckBetMandatory(amount) || amount == 1)
return;

View File

@@ -14,6 +14,7 @@ using System.Collections.Immutable;
using System.Globalization;
using System.Text;
using Nadeko.Econ.Gambling.Rps;
using NadekoBot.Common.TypeReaders;
namespace NadekoBot.Modules.Gambling;
@@ -428,26 +429,26 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public async Task Give(ShmartNumber amount, IGuildUser receiver, [Leftover] string msg)
public async Task Give([OverrideTypeReader(typeof(BalanceTypeReader))] long amount, IGuildUser receiver, [Leftover] string msg)
{
if (amount <= 0 || ctx.User.Id == receiver.Id || receiver.IsBot)
{
return;
}
if (!await _cs.TransferAsync(_eb, ctx.User, receiver, amount, msg, N(amount.Value)))
if (!await _cs.TransferAsync(_eb, ctx.User, receiver, amount, msg, N(amount)))
{
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
await ReplyConfirmLocalizedAsync(strs.gifted(N(amount.Value), Format.Bold(receiver.ToString())));
await ReplyConfirmLocalizedAsync(strs.gifted(N(amount), Format.Bold(receiver.ToString())));
}
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(1)]
public Task Give(ShmartNumber amount, [Leftover] IGuildUser receiver)
public Task Give([OverrideTypeReader(typeof(BalanceTypeReader))] long amount, [Leftover] IGuildUser receiver)
=> Give(amount, receiver, null);
[Cmd]
@@ -583,7 +584,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task RollDuel(ShmartNumber amount, IUser u)
public async Task RollDuel([OverrideTypeReader(typeof(BalanceTypeReader))] long amount, IUser u)
{
if (ctx.User.Id == u.Id)
{
@@ -622,7 +623,7 @@ public partial class Gambling : GamblingModule<GamblingService>
await ReplyConfirmLocalizedAsync(strs.roll_duel_challenge(Format.Bold(ctx.User.ToString()),
Format.Bold(u.ToString()),
Format.Bold(N(amount.Value))));
Format.Bold(N(amount))));
}
async Task GameOnGameTick(RollDuelGame arg)
@@ -674,7 +675,7 @@ public partial class Gambling : GamblingModule<GamblingService>
}
[Cmd]
public async Task BetRoll(ShmartNumber amount)
public async Task BetRoll([OverrideTypeReader(typeof(BalanceTypeReader))] long amount)
{
if (!await CheckBetMandatory(amount))
{
@@ -804,7 +805,7 @@ public partial class Gambling : GamblingModule<GamblingService>
}
[Cmd]
public async Task Rps(InputRpsPick pick, ShmartNumber amount = default)
public async Task Rps(InputRpsPick pick, [OverrideTypeReader(typeof(BalanceTypeReader))] long amount = default)
{
static string GetRpsPick(InputRpsPick p)
{
@@ -840,7 +841,7 @@ public partial class Gambling : GamblingModule<GamblingService>
else if (result.Result == RpsResultType.Win)
{
if ((long)result.Won > 0)
embed.AddField(GetText(strs.won), N(amount.Value));
embed.AddField(GetText(strs.won), N(amount));
msg = GetText(strs.rps_win(ctx.User.Mention,
GetRpsPick(pick),
@@ -864,7 +865,7 @@ public partial class Gambling : GamblingModule<GamblingService>
new[] { "⬆", "↖", "⬅", "↙", "⬇", "↘", "➡", "↗" }.ToImmutableArray();
[Cmd]
public async Task LuckyLadder(ShmartNumber amount)
public async Task LuckyLadder([OverrideTypeReader(typeof(BalanceTypeReader))] long amount)
{
if (!await CheckBetMandatory(amount))
return;

View File

@@ -1,5 +1,6 @@
#nullable disable
using Nadeko.Common;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Services;
@@ -44,7 +45,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task Plant(ShmartNumber amount, string pass = null)
public async Task Plant([OverrideTypeReader(typeof(BalanceTypeReader))] long amount, string pass = null)
{
if (amount < 1)
return;

View File

@@ -1,5 +1,6 @@
#nullable disable
using Nadeko.Common;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Services;
@@ -19,13 +20,13 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public Task RaffleCur(Mixed _, ShmartNumber amount)
public Task RaffleCur(Mixed _, [OverrideTypeReader(typeof(BalanceTypeReader))] long amount)
=> RaffleCur(amount, true);
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(1)]
public async Task RaffleCur(ShmartNumber amount, bool mixed = false)
public async Task RaffleCur([OverrideTypeReader(typeof(BalanceTypeReader))] long amount, bool mixed = false)
{
if (!await CheckBetMandatory(amount))
return;

View File

@@ -9,6 +9,7 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using System.Text;
using Nadeko.Econ.Gambling;
using NadekoBot.Common.TypeReaders;
using Color = SixLabors.ImageSharp.Color;
using Image = SixLabors.ImageSharp.Image;
@@ -48,7 +49,7 @@ public partial class Gambling
=> Task.CompletedTask;
[Cmd]
public async Task Slot(ShmartNumber amount)
public async Task Slot([OverrideTypeReader(typeof(BalanceTypeReader))] long amount)
{
if (!await CheckBetMandatory(amount))
return;
@@ -76,7 +77,7 @@ public partial class Gambling
.WithOkColor();
var bb = new ButtonBuilder(emote: Emoji.Parse("🔁"), customId: "slot:again", label: "Pull Again");
var si = new SimpleInteraction<ShmartNumber>(bb, (_, amount) => Slot(amount), amount);
var si = new SimpleInteraction<long>(bb, (_, amount) => Slot(amount), amount);
var inter = _inter.Create(ctx.User.Id, si);
var msg = await ctx.Channel.SendFileAsync(imgStream,