Changed (almost) all responses to make them use the new system instead of raw strings

- Fixed many invalid string keys
This commit is contained in:
Kwoth
2021-07-30 22:42:10 +02:00
parent 4484732f5d
commit 919bedeae6
80 changed files with 883 additions and 859 deletions

View File

@@ -135,7 +135,7 @@ namespace NadekoBot.Modules.Gambling
private Task Ar_OnStartingFailed(AnimalRace race)
{
_service.AnimalRaces.TryRemove(ctx.Guild.Id, out _);
return ReplyErrorLocalizedAsync("animal_race_failed");
return ReplyErrorLocalizedAsync(strs.animal_race_failed);
}
[NadekoCommand, Aliases]
@@ -147,7 +147,7 @@ namespace NadekoBot.Modules.Gambling
if (!_service.AnimalRaces.TryGetValue(ctx.Guild.Id, out var ar))
{
await ReplyErrorLocalizedAsync("race_not_exist").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.race_not_exist).ConfigureAwait(false);
return;
}
try

View File

@@ -49,19 +49,19 @@ namespace NadekoBot.Modules.Gambling
if (!await bj.Join(ctx.User, amount).ConfigureAwait(false))
{
_service.Games.TryRemove(ctx.Channel.Id, out _);
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
bj.StateUpdated += Bj_StateUpdated;
bj.GameEnded += Bj_GameEnded;
bj.Start();
await ReplyConfirmLocalizedAsync("bj_created").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.bj_created).ConfigureAwait(false);
}
else
{
if (await bj.Join(ctx.User, amount).ConfigureAwait(false))
await ReplyConfirmLocalizedAsync("bj_joined").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.bj_joined).ConfigureAwait(false);
else
{
Log.Information($"{ctx.User} can't join a blackjack game as it's in " + bj.State.ToString() + " state already.");
@@ -182,7 +182,7 @@ namespace NadekoBot.Modules.Gambling
{
if (!await bj.Double(ctx.User).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
}
}

View File

@@ -27,14 +27,14 @@ namespace NadekoBot.Modules.Gambling.Common
}
if (amount < _config.MinBet)
{
await ReplyErrorLocalizedAsync("min_bet_limit",
Format.Bold(_config.MinBet.ToString()) + CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.min_bet_limit(
Format.Bold(_config.MinBet.ToString()) + CurrencySign));
return false;
}
if (_config.MaxBet > 0 && amount > _config.MaxBet)
{
await ReplyErrorLocalizedAsync("max_bet_limit",
Format.Bold(_config.MaxBet.ToString()) + CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.max_bet_limit(
Format.Bold(_config.MaxBet.ToString()) + CurrencySign));
return false;
}
return true;

View File

@@ -56,7 +56,7 @@ namespace NadekoBot.Modules.Gambling
{
if (!await _cs.RemoveAsync(ctx.User.Id, "Connect4-bet", options.Bet, true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
_service.Connect4Games.TryRemove(ctx.Channel.Id, out _);
game.Dispose();
return;
@@ -71,11 +71,11 @@ namespace NadekoBot.Modules.Gambling
game.Initialize();
if (options.Bet == 0)
{
await ReplyConfirmLocalizedAsync("connect4_created").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.connect4_created).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("connect4_created_bet", options.Bet + CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.connect4_created_bet(options.Bet + CurrencySign));
}
Task _client_MessageReceived(SocketMessage arg)
@@ -115,7 +115,7 @@ namespace NadekoBot.Modules.Gambling
_client.MessageReceived -= _client_MessageReceived;
toDispose.Dispose();
}
return ErrorLocalizedAsync("connect4_failed_to_start");
return ErrorLocalizedAsync(strs.connect4_failed_to_start);
}
Task Game_OnGameEnded(Connect4Game arg, Connect4Game.Result result)

View File

@@ -40,7 +40,7 @@ namespace NadekoBot.Modules.Gambling
GetEmbed
).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("start_event_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.start_event_fail).ConfigureAwait(false);
return;
}
}

View File

@@ -50,9 +50,9 @@ namespace NadekoBot.Modules.Gambling
else
{
if (res.Item2 == CurrencyRaffleService.JoinErrorType.AlreadyJoinedOrInvalidAmount)
await ReplyErrorLocalizedAsync("rafflecur_already_joined").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.rafflecur_already_joined).ConfigureAwait(false);
else if (res.Item2 == CurrencyRaffleService.JoinErrorType.NotEnoughCurrency)
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
}
}
}

View File

@@ -84,7 +84,7 @@ namespace NadekoBot.Modules.Gambling
{
if (num < 1 || num > 30)
{
await ReplyErrorLocalizedAsync("dice_invalid_number", 1, 30).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.dice_invalid_number(1, 30));
return;
}
@@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Gambling
var sum = arr.Sum();
var embed = _eb.Create().WithOkColor()
.WithDescription(ctx.User.Mention + " " + GetText(strs.dice_rolled_num(n1) + $"`1 - {n2}`"))
.WithDescription(ctx.User.Mention + " " + GetText(strs.dice_rolled_num(n1 + $"`1 - {n2}`")))
.AddField(Format.Bold("Rolls"), string.Join(" ",
(ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x =>
Format.Code(x.ToString()))))
@@ -200,7 +200,7 @@ namespace NadekoBot.Modules.Gambling
.ToArray();
if (arr[0] > arr[1])
{
await ReplyErrorLocalizedAsync("second_larger_than_first").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.second_larger_than_first).ConfigureAwait(false);
return;
}
rolled = new NadekoRandom().Next(arr[0], arr[1] + 1);
@@ -210,7 +210,7 @@ namespace NadekoBot.Modules.Gambling
rolled = new NadekoRandom().Next(0, int.Parse(range) + 1);
}
await ReplyConfirmLocalizedAsync("dice_rolled", Format.Bold(rolled.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.dice_rolled(Format.Bold(rolled.ToString()))).ConfigureAwait(false);
}
private Image<Rgba32> GetDice(int num)

View File

@@ -42,7 +42,7 @@ namespace NadekoBot.Modules.Gambling
{
try
{
await ReplyErrorLocalizedAsync("no_more_cards").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_more_cards).ConfigureAwait(false);
}
catch
{
@@ -117,7 +117,7 @@ namespace NadekoBot.Modules.Gambling
return c;
});
await ReplyConfirmLocalizedAsync("deck_reshuffled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.deck_reshuffled).ConfigureAwait(false);
}
}
}

View File

@@ -38,7 +38,7 @@ namespace NadekoBot.Modules.Gambling
{
if (count > 10 || count < 1)
{
await ReplyErrorLocalizedAsync("flip_invalid", 10).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.flip_invalid(10));
return;
}
var headCount = 0;
@@ -94,7 +94,7 @@ namespace NadekoBot.Modules.Gambling
var removed = await _cs.RemoveAsync(ctx.User, "Betflip Gamble", amount, false, gamble: true).ConfigureAwait(false);
if (!removed)
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
BetFlipGuess result;

View File

@@ -84,20 +84,20 @@ namespace NadekoBot.Modules.Gambling
var period = _config.Timely.Cooldown;
if (val <= 0 || period <= 0)
{
await ReplyErrorLocalizedAsync("timely_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.timely_none).ConfigureAwait(false);
return;
}
TimeSpan? rem;
if ((rem = _cache.AddTimelyClaim(ctx.User.Id, period)) != null)
{
await ReplyErrorLocalizedAsync("timely_already_claimed", rem?.ToString(@"dd\d\ hh\h\ mm\m\ ss\s")).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.timely_already_claimed(rem?.ToString(@"dd\d\ hh\h\ mm\m\ ss\s"))).ConfigureAwait(false);
return;
}
await _cs.AddAsync(ctx.User.Id, "Timely claim", val).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("timely", n(val) + CurrencySign, period).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.timely(n(val) + CurrencySign, period));
}
[NadekoCommand, Aliases]
@@ -105,7 +105,7 @@ namespace NadekoBot.Modules.Gambling
public async Task TimelyReset()
{
_cache.RemoveAllTimelyClaims();
await ReplyConfirmLocalizedAsync("timely_reset").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.timely_reset).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -122,9 +122,9 @@ namespace NadekoBot.Modules.Gambling
});
if (amount == 0)
await ReplyConfirmLocalizedAsync("timely_set_none").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.timely_set_none).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("timely_set", Format.Bold(n(amount) + CurrencySign), Format.Bold(period.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.timely_set(Format.Bold(n(amount) + CurrencySign), Format.Bold(period.ToString()))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -164,7 +164,7 @@ namespace NadekoBot.Modules.Gambling
public async Task Cash([Leftover] IUser user = null)
{
user = user ?? ctx.User;
await ConfirmLocalizedAsync("has", Format.Bold(user.ToString()), $"{GetCurrency(user.Id)} {CurrencySign}").ConfigureAwait(false);
await ConfirmLocalizedAsync(strs.has(Format.Bold(user.ToString()), $"{GetCurrency(user.Id)} {CurrencySign}"));
}
[NadekoCommand, Aliases]
@@ -217,7 +217,7 @@ namespace NadekoBot.Modules.Gambling
[Priority(0)]
public async Task Cash(ulong userId)
{
await ReplyConfirmLocalizedAsync("has", Format.Code(userId.ToString()), $"{GetCurrency(userId)} {CurrencySign}").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.has(Format.Code(userId.ToString()), $"{GetCurrency(userId)} {CurrencySign}"));
}
[NadekoCommand, Aliases]
@@ -230,12 +230,11 @@ namespace NadekoBot.Modules.Gambling
var success = await _cs.RemoveAsync((IGuildUser)ctx.User, $"Gift to {receiver.Username} ({receiver.Id}).", amount, false).ConfigureAwait(false);
if (!success)
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
await _cs.AddAsync(receiver, $"Gift from {ctx.User.Username} ({ctx.User.Id}) - {msg}.", amount, true).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("gifted", n(amount) + CurrencySign, Format.Bold(receiver.ToString()), msg)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.gifted(n(amount) + CurrencySign, Format.Bold(receiver.ToString())));
}
[NadekoCommand, Aliases]
@@ -270,7 +269,7 @@ namespace NadekoBot.Modules.Gambling
$"Awarded by bot owner. ({ctx.User.Username}/{ctx.User.Id}) {(msg ?? "")}",
amount,
gamble: (ctx.Client.CurrentUser.Id != usrId)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("awarded", n(amount) + CurrencySign, $"<@{usrId}>").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.awarded(n(amount) + CurrencySign, $"<@{usrId}>"));
}
[NadekoCommand, Aliases]
@@ -289,10 +288,10 @@ namespace NadekoBot.Modules.Gambling
gamble: true)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("mass_award",
await ReplyConfirmLocalizedAsync(strs.mass_award(
n(amount) + CurrencySign,
Format.Bold(users.Count.ToString()),
Format.Bold(role.Name)).ConfigureAwait(false);
Format.Bold(role.Name)));
}
[NadekoCommand, Aliases]
@@ -309,10 +308,10 @@ namespace NadekoBot.Modules.Gambling
gamble: true)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("mass_take",
await ReplyConfirmLocalizedAsync(strs.mass_take(
n(amount) + CurrencySign,
Format.Bold(users.Count.ToString()),
Format.Bold(role.Name)).ConfigureAwait(false);
Format.Bold(role.Name)));
}
[NadekoCommand, Aliases]
@@ -326,9 +325,9 @@ namespace NadekoBot.Modules.Gambling
if (await _cs.RemoveAsync(user, $"Taken by bot owner.({ctx.User.Username}/{ctx.User.Id})", amount,
gamble: (ctx.Client.CurrentUser.Id != user.Id)).ConfigureAwait(false))
await ReplyConfirmLocalizedAsync("take", n(amount) + CurrencySign, Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.take(n(amount) + CurrencySign, Format.Bold(user.ToString()))).ConfigureAwait(false);
else
await ReplyErrorLocalizedAsync("take_fail", n(amount) + CurrencySign, Format.Bold(user.ToString()), CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.take_fail(n(amount) + CurrencySign, Format.Bold(user.ToString()), CurrencySign));
}
@@ -341,9 +340,9 @@ namespace NadekoBot.Modules.Gambling
if (await _cs.RemoveAsync(usrId, $"Taken by bot owner.({ctx.User.Username}/{ctx.User.Id})", amount,
gamble: (ctx.Client.CurrentUser.Id != usrId)).ConfigureAwait(false))
await ReplyConfirmLocalizedAsync("take", amount + CurrencySign, $"<@{usrId}>").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.take(amount + CurrencySign, $"<@{usrId}>"));
else
await ReplyErrorLocalizedAsync("take_fail", amount + CurrencySign, Format.Code(usrId.ToString()), CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.take_fail(amount + CurrencySign, Format.Code(usrId.ToString()), CurrencySign));
}
private IUserMessage rdMsg = null;
@@ -385,7 +384,7 @@ namespace NadekoBot.Modules.Gambling
{
if (other.Amount != amount)
{
await ReplyErrorLocalizedAsync("roll_duel_already_challenged").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.roll_duel_already_challenged).ConfigureAwait(false);
}
else
{
@@ -398,11 +397,10 @@ namespace NadekoBot.Modules.Gambling
game.OnGameTick += Game_OnGameTick;
game.OnEnded += Game_OnEnded;
await ReplyConfirmLocalizedAsync("roll_duel_challenge",
await ReplyConfirmLocalizedAsync(strs.roll_duel_challenge(
Format.Bold(ctx.User.ToString()),
Format.Bold(u.ToString()),
Format.Bold(amount + CurrencySign))
.ConfigureAwait(false);
Format.Bold(amount + CurrencySign)));
}
async Task Game_OnGameTick(RollDuelGame arg)
@@ -446,11 +444,11 @@ namespace NadekoBot.Modules.Gambling
}
else if (reason == RollDuelGame.Reason.Timeout)
{
await ReplyErrorLocalizedAsync("roll_duel_timeout").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.roll_duel_timeout).ConfigureAwait(false);
}
else if (reason == RollDuelGame.Reason.NoFunds)
{
await ReplyErrorLocalizedAsync("roll_duel_no_funds").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.roll_duel_no_funds).ConfigureAwait(false);
}
}
finally
@@ -467,7 +465,7 @@ namespace NadekoBot.Modules.Gambling
if (!await _cs.RemoveAsync(ctx.User, "Betroll Gamble", amount, false, gamble: true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
@@ -630,7 +628,7 @@ namespace NadekoBot.Modules.Gambling
if (!await _cs.RemoveAsync(ctx.User.Id,
"Rps-bet", amount, gamble: true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
}

View File

@@ -70,8 +70,8 @@ namespace NadekoBot.Modules.Gambling.Services
}
}
private string GetText(ulong gid, string key, params object[] rep)
=> _strings.GetText(key, gid, rep);
private string GetText(ulong gid, LocStr str)
=> _strings.GetText(str, gid);
public bool ToggleCurrencyGeneration(ulong gid, ulong cid)
{
@@ -214,10 +214,10 @@ namespace NadekoBot.Modules.Gambling.Services
{
var prefix = _cmdHandler.GetPrefix(channel.Guild.Id);
var toSend = dropAmount == 1
? GetText(channel.GuildId, "curgen_sn", config.Currency.Sign)
+ " " + GetText(channel.GuildId, "pick_sn", prefix)
: GetText(channel.GuildId, "curgen_pl", dropAmount, config.Currency.Sign)
+ " " + GetText(channel.GuildId, "pick_pl", prefix);
? GetText(channel.GuildId, strs.curgen_sn(config.Currency.Sign))
+ " " + GetText(channel.GuildId, strs.pick_sn(prefix))
: GetText(channel.GuildId, strs.curgen_pl(dropAmount, config.Currency.Sign))
+ " " + GetText(channel.GuildId, strs.pick_pl(prefix));
var pw = config.Generation.HasPassword ? GenerateCurrencyPassword().ToUpperInvariant() : null;
@@ -311,15 +311,14 @@ namespace NadekoBot.Modules.Gambling.Services
// get the text
var prefix = _cmdHandler.GetPrefix(gid);
var msgToSend = GetText(gid,
"planted",
Format.Bold(user),
amount + _gss.Data.Currency.Sign,
prefix);
strs.planted(
Format.Bold(user),
amount + _gss.Data.Currency.Sign));
if (amount > 1)
msgToSend += " " + GetText(gid, "pick_pl", prefix);
msgToSend += " " + GetText(gid, strs.pick_pl(prefix));
else
msgToSend += " " + GetText(gid, "pick_sn", prefix);
msgToSend += " " + GetText(gid, strs.pick_sn(prefix));
//get the image
using (var stream = GetRandomCurrencyImage(pass, out var ext))

View File

@@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Gambling
if (entry is null)
{
await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_item_not_found).ConfigureAwait(false);
return;
}
@@ -117,13 +117,13 @@ namespace NadekoBot.Modules.Gambling
if (role is null)
{
await ReplyErrorLocalizedAsync("shop_role_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_role_not_found).ConfigureAwait(false);
return;
}
if (guser.RoleIds.Any(id => id == role.Id))
{
await ReplyErrorLocalizedAsync("shop_role_already_bought").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_role_already_bought).ConfigureAwait(false);
return;
}
@@ -137,18 +137,18 @@ namespace NadekoBot.Modules.Gambling
{
Log.Warning(ex, "Error adding shop role");
await _cs.AddAsync(ctx.User.Id, $"Shop error refund", entry.Price).ConfigureAwait(false);
await ReplyErrorLocalizedAsync("shop_role_purchase_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_role_purchase_error).ConfigureAwait(false);
return;
}
var profit = GetProfitAmount(entry.Price);
await _cs.AddAsync(entry.AuthorId, $"Shop sell item - {entry.Type}", profit).ConfigureAwait(false);
await _cs.AddAsync(ctx.Client.CurrentUser.Id, $"Shop sell item - cut", entry.Price - profit).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("shop_role_purchase", Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.shop_role_purchase(Format.Bold(role.Name))).ConfigureAwait(false);
return;
}
else
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
}
@@ -156,7 +156,7 @@ namespace NadekoBot.Modules.Gambling
{
if (entry.Items.Count == 0)
{
await ReplyErrorLocalizedAsync("out_of_stock").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.out_of_stock).ConfigureAwait(false);
return;
}
@@ -202,14 +202,14 @@ namespace NadekoBot.Modules.Gambling
}
}
}
await ReplyErrorLocalizedAsync("shop_buy_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_buy_error).ConfigureAwait(false);
return;
}
await ReplyConfirmLocalizedAsync("shop_item_purchase").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.shop_item_purchase).ConfigureAwait(false);
}
else
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
}
@@ -307,13 +307,13 @@ namespace NadekoBot.Modules.Gambling
}
}
if (entry is null)
await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_item_not_found).ConfigureAwait(false);
else if (!rightType)
await ReplyErrorLocalizedAsync("shop_item_wrong_type").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_item_wrong_type).ConfigureAwait(false);
else if (added == false)
await ReplyErrorLocalizedAsync("shop_list_item_not_unique").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_list_item_not_unique).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("shop_list_item_added").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.shop_list_item_added).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -342,7 +342,7 @@ namespace NadekoBot.Modules.Gambling
}
if (removed is null)
await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_item_not_found).ConfigureAwait(false);
else
await ctx.Channel.EmbedAsync(EntryToEmbed(removed)
.WithTitle(GetText(strs.shop_item_rm))).ConfigureAwait(false);

View File

@@ -149,13 +149,13 @@ namespace NadekoBot.Modules.Gambling
const int maxAmount = 9999;
if (amount > maxAmount)
{
await ReplyErrorLocalizedAsync("max_bet_limit", maxAmount + CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.max_bet_limit(maxAmount + CurrencySign));
return;
}
if (!await _cs.RemoveAsync(ctx.User, "Slot Machine", amount, false, gamble: true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
Interlocked.Add(ref _totalBet, amount.Value);

View File

@@ -34,10 +34,10 @@ namespace NadekoBot.Modules.Gambling
if (await _service.TryReset(ctx.User))
{
await ReplyConfirmLocalizedAsync("waifu_reset");
await ReplyConfirmLocalizedAsync(strs.waifu_reset);
return;
}
await ReplyErrorLocalizedAsync("waifu_reset_fail");
await ReplyErrorLocalizedAsync(strs.waifu_reset_fail);
}
[NadekoCommand, Aliases]
@@ -46,13 +46,13 @@ namespace NadekoBot.Modules.Gambling
{
if (amount < _config.Waifu.MinPrice)
{
await ReplyErrorLocalizedAsync("waifu_isnt_cheap", _config.Waifu.MinPrice + CurrencySign);
await ReplyErrorLocalizedAsync(strs.waifu_isnt_cheap(_config.Waifu.MinPrice + CurrencySign));
return;
}
if (target.Id == ctx.User.Id)
{
await ReplyErrorLocalizedAsync("waifu_not_yourself");
await ReplyErrorLocalizedAsync(strs.waifu_not_yourself);
return;
}
@@ -60,12 +60,12 @@ namespace NadekoBot.Modules.Gambling
if (result == WaifuClaimResult.InsufficientAmount)
{
await ReplyErrorLocalizedAsync("waifu_not_enough", Math.Ceiling(w.Price * (isAffinity ? 0.88f : 1.1f)));
await ReplyErrorLocalizedAsync(strs.waifu_not_enough(Math.Ceiling(w.Price * (isAffinity ? 0.88f : 1.1f))));
return;
}
if (result == WaifuClaimResult.NotEnoughFunds)
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
var msg = GetText(strs.waifu_claimed(
@@ -86,14 +86,14 @@ namespace NadekoBot.Modules.Gambling
if (!await _service.WaifuTransfer(ctx.User, waifuId, newOwner)
)
{
await ReplyErrorLocalizedAsync("waifu_transfer_fail");
await ReplyErrorLocalizedAsync(strs.waifu_transfer_fail);
return;
}
await ReplyConfirmLocalizedAsync("waifu_transfer_success",
await ReplyConfirmLocalizedAsync(strs.waifu_transfer_success(
Format.Bold(waifuId.ToString()),
Format.Bold(ctx.User.ToString()),
Format.Bold(newOwner.ToString()));
Format.Bold(newOwner.ToString())));
}
[NadekoCommand, Aliases]
@@ -103,14 +103,14 @@ namespace NadekoBot.Modules.Gambling
{
if (!await _service.WaifuTransfer(ctx.User, waifu.Id, newOwner))
{
await ReplyErrorLocalizedAsync("waifu_transfer_fail");
await ReplyErrorLocalizedAsync(strs.waifu_transfer_fail);
return;
}
await ReplyConfirmLocalizedAsync("waifu_transfer_success",
await ReplyConfirmLocalizedAsync(strs.waifu_transfer_success(
Format.Bold(waifu.ToString()),
Format.Bold(ctx.User.ToString()),
Format.Bold(newOwner.ToString()));
Format.Bold(newOwner.ToString())));
}
[NadekoCommand, Aliases]
@@ -121,7 +121,7 @@ namespace NadekoBot.Modules.Gambling
var waifuUserId = _service.GetWaifuUserId(ctx.User.Id, target);
if (waifuUserId == default)
{
return ReplyErrorLocalizedAsync("waifu_not_yours");
return ReplyErrorLocalizedAsync(strs.waifu_not_yours);
}
return Divorce(waifuUserId);
@@ -145,21 +145,21 @@ namespace NadekoBot.Modules.Gambling
if (result == DivorceResult.SucessWithPenalty)
{
await ReplyConfirmLocalizedAsync("waifu_divorced_like", Format.Bold(w.Waifu.ToString()), amount + CurrencySign);
await ReplyErrorLocalizedAsync(strs.waifu_divorced_like(Format.Bold(w.Waifu.ToString()), amount + CurrencySign));
}
else if (result == DivorceResult.Success)
{
await ReplyConfirmLocalizedAsync("waifu_divorced_notlike", amount + CurrencySign);
await ReplyErrorLocalizedAsync(strs.waifu_divorced_notlike(amount + CurrencySign));
}
else if (result == DivorceResult.NotYourWife)
{
await ReplyErrorLocalizedAsync("waifu_not_yours");
await ReplyErrorLocalizedAsync(strs.waifu_not_yours);
}
else
{
await ReplyErrorLocalizedAsync("waifu_recent_divorce",
await ReplyErrorLocalizedAsync(strs.waifu_recent_divorce(
Format.Bold(((int)remaining?.TotalHours).ToString()),
Format.Bold(remaining?.Minutes.ToString()));
Format.Bold(remaining?.Minutes.ToString())));
}
}
@@ -169,7 +169,7 @@ namespace NadekoBot.Modules.Gambling
{
if (u?.Id == ctx.User.Id)
{
await ReplyErrorLocalizedAsync("waifu_egomaniac");
await ReplyErrorLocalizedAsync(strs.waifu_egomaniac);
return;
}
var (oldAff, sucess, remaining) = await _service.ChangeAffinityAsync(ctx.User, u);
@@ -177,27 +177,27 @@ namespace NadekoBot.Modules.Gambling
{
if (remaining != null)
{
await ReplyErrorLocalizedAsync("waifu_affinity_cooldown",
await ReplyErrorLocalizedAsync(strs.waifu_affinity_cooldown(
Format.Bold(((int)remaining?.TotalHours).ToString()),
Format.Bold(remaining?.Minutes.ToString()));
Format.Bold(remaining?.Minutes.ToString())));
}
else
{
await ReplyErrorLocalizedAsync("waifu_affinity_already");
await ReplyErrorLocalizedAsync(strs.waifu_affinity_already);
}
return;
}
if (u is null)
{
await ReplyConfirmLocalizedAsync("waifu_affinity_reset");
await ReplyConfirmLocalizedAsync(strs.waifu_affinity_reset);
}
else if (oldAff is null)
{
await ReplyConfirmLocalizedAsync("waifu_affinity_set", Format.Bold(u.ToString()));
await ReplyConfirmLocalizedAsync(strs.waifu_affinity_set(Format.Bold(u.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync("waifu_affinity_changed", Format.Bold(oldAff.ToString()), Format.Bold(u.ToString()));
await ReplyConfirmLocalizedAsync(strs.waifu_affinity_changed(Format.Bold(oldAff.ToString()), Format.Bold(u.ToString())));
}
}
@@ -217,7 +217,7 @@ namespace NadekoBot.Modules.Gambling
if (waifus.Count() == 0)
{
await ReplyConfirmLocalizedAsync("waifus_none");
await ReplyConfirmLocalizedAsync(strs.waifus_none);
return;
}
@@ -338,20 +338,20 @@ namespace NadekoBot.Modules.Gambling
var item = allItems.FirstOrDefault(x => x.Name.ToLowerInvariant() == itemName.ToLowerInvariant());
if (item is null)
{
await ReplyErrorLocalizedAsync("waifu_gift_not_exist");
await ReplyErrorLocalizedAsync(strs.waifu_gift_not_exist);
return;
}
var sucess = await _service.GiftWaifuAsync(ctx.User, waifu, item);
if (sucess)
{
await ReplyConfirmLocalizedAsync("waifu_gift",
await ReplyConfirmLocalizedAsync(strs.waifu_gift(
Format.Bold(item.ToString() + " " + item.ItemEmoji),
Format.Bold(waifu.ToString()));
Format.Bold(waifu.ToString())));
}
else
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
}
}
}

View File

@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Gambling
if (!await _cs.RemoveAsync(ctx.User.Id, "Wheel Of Fortune - bet", amount, gamble: true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}