- Fixed counting parameters which have formats in response strings

- Almost finished porting localized string keys as methods
- Compiles
This commit is contained in:
Kwoth
2021-07-27 13:07:23 +02:00
parent 0115d35247
commit 4484732f5d
29 changed files with 94 additions and 95 deletions

View File

@@ -25,7 +25,7 @@ namespace NadekoBot.Generators
public readonly struct LocStr public readonly struct LocStr
{ {
public readonly string Key; public readonly string Key;
public readonly object[] Parms; public readonly object[] Params;
public LocStr(string key, params object[] data) public LocStr(string key, params object[] data)
{ {
@@ -59,7 +59,7 @@ namespace NadekoBot.Generators
foreach (var field in fields) foreach (var field in fields)
{ {
var matches = Regex.Matches(field.Value, @"{(?<num>\d)}"); var matches = Regex.Matches(field.Value, @"{(?<num>\d)[}:]");
var max = 0; var max = 0;
foreach (Match match in matches) foreach (Match match in matches)
{ {

View File

@@ -266,10 +266,10 @@ namespace NadekoBot.Modules.Administration
add = $" ({TimeSpan.FromMinutes(settings.MuteTime):hh\\hmm\\m})"; add = $" ({TimeSpan.FromMinutes(settings.MuteTime):hh\\hmm\\m})";
} }
return GetText(strs.spam_stats, return GetText(strs.spam_stats(
Format.Bold(settings.MessageThreshold.ToString()), Format.Bold(settings.MessageThreshold.ToString()),
Format.Bold(settings.Action.ToString() + add), Format.Bold(settings.Action + add),
ignoredString); ignoredString));
} }
private string GetAntiRaidString(AntiRaidStats stats) private string GetAntiRaidString(AntiRaidStats stats)
@@ -280,11 +280,11 @@ namespace NadekoBot.Modules.Administration
{ {
actionString += $" **({TimeSpan.FromMinutes(stats.AntiRaidSettings.PunishDuration):hh\\hmm\\m})**"; actionString += $" **({TimeSpan.FromMinutes(stats.AntiRaidSettings.PunishDuration):hh\\hmm\\m})**";
} }
return GetText(strs.raid_stats, return GetText(strs.raid_stats(
Format.Bold(stats.AntiRaidSettings.UserThreshold.ToString()), Format.Bold(stats.AntiRaidSettings.UserThreshold.ToString()),
Format.Bold(stats.AntiRaidSettings.Seconds.ToString()), Format.Bold(stats.AntiRaidSettings.Seconds.ToString()),
actionString); actionString));
} }
} }
} }

View File

@@ -96,13 +96,12 @@ namespace NadekoBot.Modules.Administration
.WithOkColor(); .WithOkColor();
if (punishment is null) if (punishment is null)
{ {
embed.WithDescription(GetText(strs.user_warned, embed.WithDescription(GetText(strs.user_warned(Format.Bold(user.ToString()))));
Format.Bold(user.ToString())));
} }
else else
{ {
embed.WithDescription(GetText(strs.user_warned_and_punished(Format.Bold(user.ToString())), embed.WithDescription(GetText(strs.user_warned_and_punished(Format.Bold(user.ToString()),
Format.Bold(punishment.Punishment.ToString()))); Format.Bold(punishment.Punishment.ToString()))));
} }
if (dmFailed) if (dmFailed)
@@ -233,10 +232,10 @@ namespace NadekoBot.Modules.Administration
foreach (var w in warnings) foreach (var w in warnings)
{ {
i++; i++;
var name = GetText(strs.warned_on_by, var name = GetText(strs.warned_on_by(
w.DateAdded.Value.ToString("dd.MM.yyy"), w.DateAdded.Value.ToString("dd.MM.yyy"),
w.DateAdded.Value.ToString("HH:mm"), w.DateAdded.Value.ToString("HH:mm"),
w.Moderator); w.Moderator));
if (w.Forgiven) if (w.Forgiven)
name = $"{Format.Strikethrough(name)} {GetText(strs.warn_cleared_by(w.ForgivenBy))}"; name = $"{Format.Strikethrough(name)} {GetText(strs.warn_cleared_by(w.ForgivenBy))}";
@@ -685,7 +684,7 @@ namespace NadekoBot.Modules.Administration
try try
{ {
await user.SendErrorAsync(_eb, GetText(strs.sbdm(Format.Bold(ctx.Guild.Name), msg)).ConfigureAwait(false)); await user.SendErrorAsync(_eb, GetText(strs.sbdm(Format.Bold(ctx.Guild.Name), msg)));
} }
catch catch
{ {
@@ -784,7 +783,7 @@ namespace NadekoBot.Modules.Administration
//send a message but don't wait for it //send a message but don't wait for it
var banningMessageTask = ctx.Channel.EmbedAsync(_eb.Create() var banningMessageTask = ctx.Channel.EmbedAsync(_eb.Create()
.WithDescription(GetText(strs.mass_kill_in_progress(bans.Count()))) .WithDescription(GetText(strs.mass_kill_in_progress(bans.Count())))
.AddField(GetText(strs.invalid(missing), missStr)) .AddField(GetText(strs.invalid(missing)), missStr)
.WithOkColor()); .WithOkColor());
//do the banning //do the banning
@@ -801,7 +800,7 @@ namespace NadekoBot.Modules.Administration
await banningMessage.ModifyAsync(x => x.Embed = _eb.Create() await banningMessage.ModifyAsync(x => x.Embed = _eb.Create()
.WithDescription(GetText(strs.mass_kill_completed(bans.Count()))) .WithDescription(GetText(strs.mass_kill_completed(bans.Count())))
.AddField(GetText(strs.invalid(missing), missStr)) .AddField(GetText(strs.invalid(missing)), missStr)
.WithOkColor() .WithOkColor()
.Build()).ConfigureAwait(false); .Build()).ConfigureAwait(false);
} }

View File

@@ -411,9 +411,10 @@ namespace NadekoBot.Modules.CustomReactions.Services
{ {
if (pc.Verbose) if (pc.Verbose)
{ {
var returnMsg = _strings.GetText(strs.perm_prevent, sg.Id, var returnMsg = _strings.GetText(
index + 1, strs.perm_prevent(index + 1,
Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), sg))); Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), sg))),
sg.Id);
try try
{ {

View File

@@ -77,8 +77,10 @@ namespace NadekoBot.Modules.Gambling
if (race.FinishedUsers[0].Bet > 0) if (race.FinishedUsers[0].Bet > 0)
{ {
return SendConfirmAsync(GetText(strs.animal_race), return SendConfirmAsync(GetText(strs.animal_race),
GetText(strs.animal_race_won_money(Format.Bold(winner.Username)), GetText(strs.animal_race_won_money(
winner.Animal.Icon, (race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign)); Format.Bold(winner.Username),
winner.Animal.Icon,
(race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign)));
} }
else else
{ {
@@ -153,9 +155,9 @@ namespace NadekoBot.Modules.Gambling
var user = await ar.JoinRace(ctx.User.Id, ctx.User.ToString(), amount) var user = await ar.JoinRace(ctx.User.Id, ctx.User.ToString(), amount)
.ConfigureAwait(false); .ConfigureAwait(false);
if (amount > 0) if (amount > 0)
await SendConfirmAsync(GetText(strs.animal_race_join_bet(ctx.User.Mention, user.Animal.Icon, amount + CurrencySign)).ConfigureAwait(false)); await SendConfirmAsync(GetText(strs.animal_race_join_bet(ctx.User.Mention, user.Animal.Icon, amount + CurrencySign)));
else else
await SendConfirmAsync(GetText(strs.animal_race_join(ctx.User.Mention, user.Animal.Icon)).ConfigureAwait(false)); await SendConfirmAsync(GetText(strs.animal_race_join(ctx.User.Mention, user.Animal.Icon)));
} }
catch (ArgumentOutOfRangeException) catch (ArgumentOutOfRangeException)
{ {
@@ -176,7 +178,7 @@ namespace NadekoBot.Modules.Gambling
} }
catch (NotEnoughFundsException) catch (NotEnoughFundsException)
{ {
await SendErrorAsync(GetText(strs.not_enough(CurrencySign)).ConfigureAwait(false)); await SendErrorAsync(GetText(strs.not_enough(CurrencySign)));
} }
} }
} }

View File

@@ -72,10 +72,10 @@ namespace NadekoBot.Modules.Gambling
string potSizeStr = Format.Bold(potSize == 0 string potSizeStr = Format.Bold(potSize == 0
? "∞" + CurrencySign ? "∞" + CurrencySign
: potSize.ToString() + CurrencySign); : potSize.ToString() + CurrencySign);
return GetText(strs.new_reaction_event, return GetText(strs.new_reaction_event(
CurrencySign, CurrencySign,
Format.Bold(amount + CurrencySign), Format.Bold(amount + CurrencySign),
potSizeStr); potSizeStr));
} }
private string GetGameStatusDescription(long amount, long potSize) private string GetGameStatusDescription(long amount, long potSize)
@@ -83,10 +83,10 @@ namespace NadekoBot.Modules.Gambling
string potSizeStr = Format.Bold(potSize == 0 string potSizeStr = Format.Bold(potSize == 0
? "∞" + CurrencySign ? "∞" + CurrencySign
: potSize.ToString() + CurrencySign); : potSize.ToString() + CurrencySign);
return GetText(strs.new_gamestatus_event, return GetText(strs.new_gamestatus_event(
CurrencySign, CurrencySign,
Format.Bold(amount + CurrencySign), Format.Bold(amount + CurrencySign),
potSizeStr); potSizeStr));
} }
} }
} }

View File

@@ -35,7 +35,7 @@ namespace NadekoBot.Modules.Gambling
return; return;
async Task OnEnded(IUser arg, long won) async Task OnEnded(IUser arg, long won)
{ {
await SendConfirmAsync(GetText(strs.rafflecur_ended(CurrencyName, Format.Bold(arg.ToString()), won + CurrencySign)).ConfigureAwait(false)); await SendConfirmAsync(GetText(strs.rafflecur_ended(CurrencyName, Format.Bold(arg.ToString()), won + CurrencySign)));
} }
var res = await _service.JoinOrCreateGame(ctx.Channel.Id, var res = await _service.JoinOrCreateGame(ctx.Channel.Id,
ctx.User, amount, mixed, OnEnded) ctx.User, amount, mixed, OnEnded)
@@ -45,7 +45,7 @@ namespace NadekoBot.Modules.Gambling
{ {
await SendConfirmAsync(GetText(strs.rafflecur(res.Item1.GameType.ToString())), await SendConfirmAsync(GetText(strs.rafflecur(res.Item1.GameType.ToString())),
string.Join("\n", res.Item1.Users.Select(x => $"{x.DiscordUser} ({x.Amount})")), string.Join("\n", res.Item1.Users.Select(x => $"{x.DiscordUser} ({x.Amount})")),
footer: GetText(strs.rafflecur_joined(ctx.User.ToString())).ConfigureAwait(false)); footer: GetText(strs.rafflecur_joined(ctx.User.ToString())));
} }
else else
{ {

View File

@@ -47,7 +47,7 @@ namespace NadekoBot.Modules.Gambling
{ {
await ctx.Channel.SendFileAsync(ms, await ctx.Channel.SendFileAsync(ms,
$"dice.{format.FileExtensions.First()}", $"dice.{format.FileExtensions.First()}",
Format.Bold(ctx.User.ToString()) + " " + GetText(strs.dice_rolled(Format.Code(gen.ToString()))).ConfigureAwait(false)); Format.Bold(ctx.User.ToString()) + " " + GetText(strs.dice_rolled(Format.Code(gen.ToString()))));
} }
} }
@@ -129,9 +129,9 @@ namespace NadekoBot.Modules.Gambling
await ctx.Channel.SendFileAsync(ms, $"dice.{format.FileExtensions.First()}", await ctx.Channel.SendFileAsync(ms, $"dice.{format.FileExtensions.First()}",
Format.Bold(ctx.User.ToString()) + " " + Format.Bold(ctx.User.ToString()) + " " +
GetText(strs.dice_rolled_num(Format.Bold(values.Count.ToString()))) + GetText(strs.dice_rolled_num(Format.Bold(values.Count.ToString()))) +
" " + GetText(strs.total_average, " " + GetText(strs.total_average(
Format.Bold(values.Sum().ToString()), Format.Bold(values.Sum().ToString()),
Format.Bold((values.Sum() / (1.0f * values.Count)).ToString("N2")))).ConfigureAwait(false); Format.Bold((values.Sum() / (1.0f * values.Count)).ToString("N2")))));
} }
} }

View File

@@ -68,9 +68,9 @@ namespace NadekoBot.Modules.Gambling
} }
var msg = count != 1 var msg = count != 1
? Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flip_results(count, headCount, tailCount)) ? Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flip_results(count, headCount, tailCount))
: Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flipped, headCount > 0 : Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flipped(headCount > 0
? Format.Bold(GetText(strs.heads)) ? Format.Bold(GetText(strs.heads))
: Format.Bold(GetText(strs.tails))); : Format.Bold(GetText(strs.tails))));
await ctx.Channel.SendFileAsync(stream, $"{count} coins.{format.FileExtensions.First()}", msg).ConfigureAwait(false); await ctx.Channel.SendFileAsync(stream, $"{count} coins.{format.FileExtensions.First()}", msg).ConfigureAwait(false);
} }
} }

View File

@@ -196,8 +196,8 @@ namespace NadekoBot.Modules.Gambling
} }
var embed = _eb.Create() var embed = _eb.Create()
.WithTitle(GetText(strs.transactions, .WithTitle(GetText(strs.transactions(
((SocketGuild)ctx.Guild)?.GetUser(userId)?.ToString() ?? $"{userId}")) ((SocketGuild)ctx.Guild)?.GetUser(userId)?.ToString() ?? $"{userId}")))
.WithOkColor(); .WithOkColor();
var desc = ""; var desc = "";
@@ -480,9 +480,9 @@ namespace NadekoBot.Modules.Gambling
if (result.Multiplier > 0) if (result.Multiplier > 0)
{ {
var win = (long)(amount * result.Multiplier); var win = (long)(amount * result.Multiplier);
str += GetText(strs.br_win, str += GetText(strs.br_win(
n(win) + CurrencySign, n(win) + CurrencySign,
result.Threshold + (result.Roll == 100 ? " 👑" : "")); result.Threshold + (result.Roll == 100 ? " 👑" : "")));
await _cs.AddAsync(ctx.User, "Betroll Gamble", await _cs.AddAsync(ctx.User, "Betroll Gamble",
win, false, gamble: true).ConfigureAwait(false); win, false, gamble: true).ConfigureAwait(false);
} }
@@ -652,15 +652,13 @@ namespace NadekoBot.Modules.Gambling
"Rps-win", amount, gamble: true).ConfigureAwait(false); "Rps-win", amount, gamble: true).ConfigureAwait(false);
embed.WithOkColor(); embed.WithOkColor();
embed.AddField(GetText(strs.won), n(amount)); embed.AddField(GetText(strs.won), n(amount));
msg = GetText(strs.rps_win, ctx.User.Mention, msg = GetText(strs.rps_win(ctx.User.Mention, getRpsPick(pick), getRpsPick(nadekoPick)));
getRpsPick(pick), getRpsPick(nadekoPick));
} }
else else
{ {
embed.WithErrorColor(); embed.WithErrorColor();
amount = 0; amount = 0;
msg = GetText(strs.rps_win(ctx.Client.CurrentUser.Mention, getRpsPick(nadekoPick)), msg = GetText(strs.rps_win(ctx.Client.CurrentUser.Mention, getRpsPick(nadekoPick), getRpsPick(pick)));
getRpsPick(pick));
} }
embed embed

View File

@@ -433,7 +433,7 @@ namespace NadekoBot.Modules.Gambling
var embed = _eb.Create().WithOkColor(); var embed = _eb.Create().WithOkColor();
if (entry.Type == ShopEntryType.Role) if (entry.Type == ShopEntryType.Role)
return embed.AddField(GetText(strs.name), GetText(strs.shop_role(Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE")), true)) return embed.AddField(GetText(strs.name), GetText(strs.shop_role(Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE"))), true)
.AddField(GetText(strs.price), entry.Price.ToString(), true) .AddField(GetText(strs.price), entry.Price.ToString(), true)
.AddField(GetText(strs.type), entry.Type.ToString(), true); .AddField(GetText(strs.type), entry.Type.ToString(), true);
else if (entry.Type == ShopEntryType.List) else if (entry.Type == ShopEntryType.List)

View File

@@ -68,9 +68,9 @@ namespace NadekoBot.Modules.Gambling
await ReplyErrorLocalizedAsync("not_enough", CurrencySign); await ReplyErrorLocalizedAsync("not_enough", CurrencySign);
return; return;
} }
var msg = GetText(strs.waifu_claimed, var msg = GetText(strs.waifu_claimed(
Format.Bold(target.ToString()), Format.Bold(target.ToString()),
amount + CurrencySign); amount + CurrencySign));
if (w.Affinity?.UserId == ctx.User.Id) if (w.Affinity?.UserId == ctx.User.Id)
msg += "\n" + GetText(strs.waifu_fulfilled(target, w.Price + CurrencySign)); msg += "\n" + GetText(strs.waifu_fulfilled(target, w.Price + CurrencySign));
else else
@@ -292,7 +292,7 @@ namespace NadekoBot.Modules.Gambling
.AddField(GetText(strs.changes_of_heart), $"{wi.AffinityCount} - \"the {affInfo}\"", true) .AddField(GetText(strs.changes_of_heart), $"{wi.AffinityCount} - \"the {affInfo}\"", true)
.AddField(GetText(strs.divorces), wi.DivorceCount.ToString(), true) .AddField(GetText(strs.divorces), wi.DivorceCount.ToString(), true)
.AddField("\u200B", "\u200B", true) .AddField("\u200B", "\u200B", true)
.AddField(GetText(strs.fans(wi.Fans.Count), fansStr, true)) .AddField(GetText(strs.fans(wi.Fans.Count)), fansStr, true)
.AddField($"Waifus ({wi.ClaimCount})", wi.ClaimCount == 0 .AddField($"Waifus ({wi.ClaimCount})", wi.ClaimCount == 0
? nobody ? nobody
: string.Join("\n", wi.Claims.Shuffle().Take(30)), true) : string.Join("\n", wi.Claims.Shuffle().Take(30)), true)

View File

@@ -105,9 +105,7 @@ namespace NadekoBot.Modules.Games
if (submissions.Length == 1) if (submissions.Length == 1)
{ {
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor() await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithDescription( .WithDescription(GetText(strs.acro_winner_only(Format.Bold(submissions.First().Key.UserName))))
GetText(strs.acro_winner_only,
Format.Bold(submissions.First().Key.UserName)))
.WithFooter(submissions.First().Key.Input)) .WithFooter(submissions.First().Key.Input))
.ConfigureAwait(false); .ConfigureAwait(false);
return; return;
@@ -138,8 +136,8 @@ $@"--
var winner = table.First(); var winner = table.First();
var embed = _eb.Create().WithOkColor() var embed = _eb.Create().WithOkColor()
.WithTitle(GetText(strs.acrophobia)) .WithTitle(GetText(strs.acrophobia))
.WithDescription(GetText(strs.acro_winner(Format.Bold(winner.Key.UserName)), .WithDescription(GetText(strs.acro_winner(Format.Bold(winner.Key.UserName),
Format.Bold(winner.Value.ToString()))) Format.Bold(winner.Value.ToString()))))
.WithFooter(winner.Key.Input); .WithFooter(winner.Key.Input);
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);

View File

@@ -277,7 +277,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia
foreach (var kvp in Users.OrderByDescending(kvp => kvp.Value)) foreach (var kvp in Users.OrderByDescending(kvp => kvp.Value))
{ {
sb.AppendLine(GetText(strs.trivia_points(Format.Bold(kvp.Key.ToString()), kvp.Value).SnPl(kvp.Value))); sb.AppendLine(GetText(strs.trivia_points(Format.Bold(kvp.Key.ToString()), kvp.Value)).SnPl(kvp.Value));
} }
return sb.ToString(); return sb.ToString();

View File

@@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Games
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Hangmanlist() public async Task Hangmanlist()
{ {
await SendConfirmAsync(Format.Code(GetText(strs.hangman_types(Prefix)) + "\n" + string.Join("\n", _service.TermPool.Data.Keys)).ConfigureAwait(false)); await SendConfirmAsync(Format.Code(GetText(strs.hangman_types(Prefix)) + "\n" + string.Join("\n", _service.TermPool.Data.Keys)));
} }
[NadekoCommand, Aliases] [NadekoCommand, Aliases]

View File

@@ -109,10 +109,10 @@ namespace NadekoBot.Modules.Games
for (int i = 0; i < stats.Length; i++) for (int i = 0; i < stats.Length; i++)
{ {
var (Index, votes, Text) = stats[i]; var (Index, votes, Text) = stats[i];
sb.AppendLine(GetText(strs.poll_result, sb.AppendLine(GetText(strs.poll_result(
Index + 1, Index + 1,
Format.Bold(Text), Format.Bold(Text),
Format.Bold(votes.ToString()))); Format.Bold(votes.ToString()))));
} }
return eb.WithDescription(sb.ToString()) return eb.WithDescription(sb.ToString())

View File

@@ -122,12 +122,8 @@ namespace NadekoBot.Modules.Games.Services
{ {
if (pc.Verbose) if (pc.Verbose)
{ {
var returnMsg = _strings.GetText( var returnMsg = _strings.GetText(strs.perm_prevent(index + 1,
strs.perm_prevent( Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), (SocketGuild)guild))));
guild.Id,
index + 1,
Format.Bold(pc.Permissions[index]
.GetCommand(_cmd.GetPrefix(guild), (SocketGuild)guild))));
try { await usrMsg.Channel.SendErrorAsync(_eb, returnMsg).ConfigureAwait(false); } catch { } try { await usrMsg.Channel.SendErrorAsync(_eb, returnMsg).ConfigureAwait(false); } catch { }
Log.Information(returnMsg); Log.Information(returnMsg);

View File

@@ -99,8 +99,8 @@ namespace NadekoBot.Modules.Games.Services
private async Task Pr_OnVoted(IUserMessage msg, IGuildUser usr) private async Task Pr_OnVoted(IUserMessage msg, IGuildUser usr)
{ {
var toDelete = await msg.Channel.SendConfirmAsync(_eb, _strs.GetText(strs.poll_voted, var toDelete = await msg.Channel.SendConfirmAsync(_eb,
usr.Guild.Id, Format.Bold(usr.ToString()))) _strs.GetText(strs.poll_voted(Format.Bold(usr.ToString())), usr.GuildId))
.ConfigureAwait(false); .ConfigureAwait(false);
toDelete.DeleteAfter(5); toDelete.DeleteAfter(5);
try { await msg.DeleteAsync().ConfigureAwait(false); } catch { } try { await msg.DeleteAsync().ConfigureAwait(false); } catch { }

View File

@@ -63,7 +63,7 @@ namespace NadekoBot.Modules.Music
var embed = _eb var embed = _eb
.Create(ctx) .Create(ctx)
.WithAuthor(GetText(strs.playlists_page(num), MusicIconUrl)) .WithAuthor(GetText(strs.playlists_page(num)), MusicIconUrl)
.WithDescription(string.Join("\n", playlists.Select(r => .WithDescription(string.Join("\n", playlists.Select(r =>
GetText(strs.playlists(r.Id, r.Name, r.Author, r.Songs.Count))))) GetText(strs.playlists(r.Id, r.Name, r.Author, r.Songs.Count)))))
.WithOkColor(); .WithOkColor();

View File

@@ -128,10 +128,10 @@ namespace NadekoBot.Modules.Permissions.Services
{ {
try try
{ {
await channel.SendErrorAsync(_eb, await channel.SendErrorAsync(_eb,
_strings.GetText(strs.perm_prevent, guild.Id, index + 1, _strings.GetText(strs.perm_prevent(index + 1,
Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), (SocketGuild) guild)))) Format.Bold(pc.Permissions[index]
.ConfigureAwait(false); .GetCommand(_cmd.GetPrefix(guild), (SocketGuild)guild))), guild.Id));
} }
catch catch
{ {

View File

@@ -44,7 +44,7 @@ namespace NadekoBot.Modules.Searches
.WithDescription(p.BaseStats.ToString()) .WithDescription(p.BaseStats.ToString())
.WithThumbnailUrl($"https://assets.pokemon.com/assets/cms2/img/pokedex/detail/{p.Id.ToString("000")}.png") .WithThumbnailUrl($"https://assets.pokemon.com/assets/cms2/img/pokedex/detail/{p.Id.ToString("000")}.png")
.AddField(GetText(strs.types), string.Join("\n", p.Types), true) .AddField(GetText(strs.types), string.Join("\n", p.Types), true)
.AddField(GetText(strs.height_weight), GetText(strs.height_weight_val(p.HeightM, p.WeightKg), true)) .AddField(GetText(strs.height_weight), GetText(strs.height_weight_val(p.HeightM, p.WeightKg)), true)
.AddField(GetText(strs.abilities), string.Join("\n", p.Abilities.Select(a => a.Value)), true)).ConfigureAwait(false); .AddField(GetText(strs.abilities), string.Join("\n", p.Abilities.Select(a => a.Value)), true)).ConfigureAwait(false);
return; return;
} }

View File

@@ -55,7 +55,7 @@ namespace NadekoBot.Modules.Utility
"GetHashCode", "GetHashCode",
"GetType" "GetType"
}); });
await SendConfirmAsync(GetText(strs.calcops(Prefix), string.Join(", ", selection)).ConfigureAwait(false)); await SendConfirmAsync(GetText(strs.calcops(Prefix)), string.Join(", ", selection));
} }
} }

View File

@@ -135,10 +135,10 @@ namespace NadekoBot.Modules.Utility
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
foreach (var kvp in CmdHandler.UserMessagesSent.OrderByDescending(kvp => kvp.Value).Skip(page * activityPerPage).Take(activityPerPage)) foreach (var kvp in CmdHandler.UserMessagesSent.OrderByDescending(kvp => kvp.Value).Skip(page * activityPerPage).Take(activityPerPage))
{ {
str.AppendLine(GetText(strs.activity_line, str.AppendLine(GetText(strs.activity_line(
++startCount, ++startCount,
Format.Bold(kvp.Key.ToString()), Format.Bold(kvp.Key.ToString()),
kvp.Value / _stats.GetUptime().TotalSeconds, kvp.Value)); kvp.Value / _stats.GetUptime().TotalSeconds, kvp.Value)));
} }
await ctx.Channel.EmbedAsync(_eb.Create() await ctx.Channel.EmbedAsync(_eb.Create()

View File

@@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Utility
var inv = invites.ElementAt(index); var inv = invites.ElementAt(index);
await inv.DeleteAsync().ConfigureAwait(false); await inv.DeleteAsync().ConfigureAwait(false);
await ReplyAsync(GetText(strs.invite_deleted(Format.Bold(inv.Code.ToString()))).ConfigureAwait(false)); await ReplyAsync(GetText(strs.invite_deleted(Format.Bold(inv.Code))));
} }
} }
} }

View File

@@ -190,11 +190,11 @@ namespace NadekoBot.Modules.Utility
try try
{ {
await SendConfirmAsync( await SendConfirmAsync(
"⏰ " + GetText(strs.remind, "⏰ " + GetText(strs.remind(
Format.Bold(!isPrivate ? $"<#{targetId}>" : ctx.User.Username), Format.Bold(!isPrivate ? $"<#{targetId}>" : ctx.User.Username),
Format.Bold(message), Format.Bold(message),
$"{ts.Days}d {ts.Hours}h {ts.Minutes}min", $"{ts.Days}d {ts.Hours}h {ts.Minutes}min",
gTime, gTime)).ConfigureAwait(false); gTime, gTime))).ConfigureAwait(false);
} }
catch catch
{ {

View File

@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Utility
} }
res = Math.Round(res, 4); res = Math.Round(res, 4);
await SendConfirmAsync(GetText(strs.convert(value, originUnit.Triggers.Last(), res, targetUnit.Triggers.Last())).ConfigureAwait(false)); await SendConfirmAsync(GetText(strs.convert(value, originUnit.Triggers.Last(), res, targetUnit.Triggers.Last())));
} }
} }
} }

View File

@@ -259,8 +259,8 @@ namespace NadekoBot.Modules.Utility
.AddField(GetText(strs.owner_ids), ownerIds, true) .AddField(GetText(strs.owner_ids), ownerIds, true)
.AddField(GetText(strs.uptime), _stats.GetUptimeString("\n"), true) .AddField(GetText(strs.uptime), _stats.GetUptimeString("\n"), true)
.AddField(GetText(strs.presence), .AddField(GetText(strs.presence),
GetText(strs.presence_txt, GetText(strs.presence_txt(
_coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels), true)) _coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels)), true))
.ConfigureAwait(false); .ConfigureAwait(false);
} }

View File

@@ -264,16 +264,19 @@ namespace NadekoBot.Modules.Xp.Services
{ {
var chan = await x.User.GetOrCreateDMChannelAsync(); var chan = await x.User.GetOrCreateDMChannelAsync();
if (chan != null) if (chan != null)
await chan.SendConfirmAsync(_eb, _strings.GetText(strs.level_up_dm, await chan.SendConfirmAsync(_eb,
x.Guild.Id, _strings.GetText(strs.level_up_dm(
x.User.Mention, Format.Bold(x.Level.ToString()), x.User.Mention, Format.Bold(x.Level.ToString()),
Format.Bold(x.Guild.ToString() ?? "-"))); Format.Bold(x.Guild.ToString() ?? "-")),
x.Guild.Id));
} }
else if (x.MessageChannel != null) // channel else if (x.MessageChannel != null) // channel
{ {
await x.MessageChannel.SendConfirmAsync(_eb, _strings.GetText(strs.level_up_channel, await x.MessageChannel.SendConfirmAsync(_eb,
x.Guild.Id, _strings.GetText(strs.level_up_channel(
x.User.Mention, Format.Bold(x.Level.ToString()))); x.User.Mention,
Format.Bold(x.Level.ToString())),
x.Guild.Id));
} }
} }
else else
@@ -288,9 +291,11 @@ namespace NadekoBot.Modules.Xp.Services
chan = x.MessageChannel; chan = x.MessageChannel;
} }
await chan.SendConfirmAsync(_eb, _strings.GetText(strs.level_up_global, await chan.SendConfirmAsync(_eb,
x.Guild.Id, _strings.GetText(strs.level_up_global(
x.User.Mention, Format.Bold(x.Level.ToString()))); x.User.Mention,
Format.Bold(x.Level.ToString())),
x.Guild.Id));
} }
})); }));
} }

View File

@@ -380,6 +380,6 @@ namespace NadekoBot.Extensions
public static string GetText(this IBotStrings strings, in LocStr str, ulong? guildId = null) public static string GetText(this IBotStrings strings, in LocStr str, ulong? guildId = null)
=> strings.GetText(str.Key, guildId); => strings.GetText(str.Key, guildId);
public static string GetText(this IBotStrings strings, in LocStr str, CultureInfo culture) public static string GetText(this IBotStrings strings, in LocStr str, CultureInfo culture)
=> strings.GetText(str.Key, culture, str.Parms); => strings.GetText(str.Key, culture, str.Params);
} }
} }