diff --git a/src/NadekoBot.Generators/LocalizedStringsGenerator.cs b/src/NadekoBot.Generators/LocalizedStringsGenerator.cs index fefc06537..fff279bb0 100644 --- a/src/NadekoBot.Generators/LocalizedStringsGenerator.cs +++ b/src/NadekoBot.Generators/LocalizedStringsGenerator.cs @@ -11,99 +11,33 @@ using Newtonsoft.Json; namespace NadekoBot.Generators { - internal class FieldData + internal class TranslationPair { - public string Type { get; set; } public string Name { get; set; } + public string Value { get; set; } } - + [Generator] public class LocalizedStringsGenerator : ISourceGenerator { private const string LocStrSource = @"namespace NadekoBot { - public readonly ref struct LocStr0 + public readonly struct LocStr { public readonly string Key; + public readonly object[] Parms; - public LocStr0(string key) + public LocStr(string key, params object[] data) { Key = key; + Params = data; } - - public static implicit operator LocStr0(string data) - => new LocStr0(data); - } - - public readonly ref struct LocStr1 - { - public readonly string Key; - - public LocStr1(string key) - { - Key = key; - } - - public static implicit operator LocStr1(string data) - => new LocStr1(data); - } - - public readonly ref struct LocStr2 - { - public readonly string Key; - - public LocStr2(string key) - { - Key = key; - } - - public static implicit operator LocStr2(string data) - => new LocStr2(data); - } - - public readonly ref struct LocStr3 - { - public readonly string Key; - - public LocStr3(string key) - { - Key = key; - } - - public static implicit operator LocStr3(string data) - => new LocStr3(data); - } - - public readonly ref struct LocStr4 - { - public readonly string Key; - - public LocStr4(string key) - { - Key = key; - } - - public static implicit operator LocStr4(string data) - => new LocStr4(data); - } - - public readonly ref struct LocStr5 - { - public readonly string Key; - - public LocStr5(string key) - { - Key = key; - } - - public static implicit operator LocStr5(string data) - => new LocStr5(data); } }"; - + public void Initialize(GeneratorInitializationContext context) { - + } public void Execute(GeneratorExecutionContext context) @@ -125,66 +59,60 @@ namespace NadekoBot.Generators foreach (var field in fields) { - sw.WriteLine($"public static {field.Type} {field.Name} => \"{field.Name}\";"); + var matches = Regex.Matches(field.Value, @"{(?\d)}"); + var max = 0; + foreach (Match match in matches) + { + max = Math.Max(max, int.Parse(match.Groups["num"].Value) + 1); + } + + List typedParamStrings = new List(); + var paramStrings = string.Empty; + for (var i = 0; i < max; i++) + { + typedParamStrings.Add($"object p{i}"); + paramStrings += $", p{i}"; + } + + + var sig = string.Empty; + if(max > 0) + sig = $"({string.Join(", ", typedParamStrings)})"; + + sw.WriteLine($"public static LocStr {field.Name}{sig} => new LocStr(\"{field.Name}\"{paramStrings});"); } sw.Indent--; sw.WriteLine("}"); sw.Indent--; sw.WriteLine("}"); - - + + sw.Flush(); context.AddSource("strs.cs", stringWriter.ToString()); } - + context.AddSource("LocStr.cs", LocStrSource); } - private List GetFields(string dataText) + private List GetFields(string dataText) { if (string.IsNullOrWhiteSpace(dataText)) throw new ArgumentNullException(nameof(dataText)); - + var data = JsonConvert.DeserializeObject>(dataText); - var list = new List(); + var list = new List(); foreach (var entry in data) { - list.Add(new FieldData() + list.Add(new TranslationPair() { - Type = GetFieldType(entry.Value), Name = entry.Key, + Value = entry.Value }); } return list; } - - private string GetFieldType(string value) - { - var matches = Regex.Matches(value, @"{(?\d)}"); - int max = -1; - foreach (Match match in matches) - { - max = Math.Max(max, int.Parse(match.Groups["num"].Value)); - } - - max += 1; - if (max == 0) - return "LocStr0"; - if (max == 1) - return "LocStr1"; - if (max == 2) - return "LocStr2"; - if (max == 3) - return "LocStr3"; - if (max == 4) - return "LocStr4"; - if (max == 5) - return "LocStr5"; - - return "!Error"; - } } } \ No newline at end of file diff --git a/src/NadekoBot/Common/NadekoModule.cs b/src/NadekoBot/Common/NadekoModule.cs index 49a777c46..d81529d15 100644 --- a/src/NadekoBot/Common/NadekoModule.cs +++ b/src/NadekoBot/Common/NadekoModule.cs @@ -33,23 +33,8 @@ namespace NadekoBot.Modules protected string GetText(string key) => Strings.GetText(key, _cultureInfo); - protected string GetText(in LocStr0 key) => - Strings.GetText(key, _cultureInfo); - - protected string GetText(in LocStr1 key, object obj1) => - Strings.GetText(key, _cultureInfo, obj1); - - protected string GetText(in LocStr2 key, object obj1, object obj2) => - Strings.GetText(key, _cultureInfo, obj1, obj2); - - protected string GetText(in LocStr3 key, object obj1, object obj2, object obj3) => - Strings.GetText(key, _cultureInfo, obj1, obj2, obj3); - - protected string GetText(in LocStr4 key, object obj1, object obj2, object obj3, object obj4) => - Strings.GetText(key, _cultureInfo, obj1, obj2, obj3, obj4); - - protected string GetText(in LocStr5 key, object obj1, object obj2, object obj3, object obj4, object obj5) => - Strings.GetText(key, _cultureInfo, obj1, obj2, obj3, obj4, obj5); + protected string GetText(in LocStr data) => + Strings.GetText(data, _cultureInfo); protected string GetText(string key, params object[] args) => Strings.GetText(key, _cultureInfo, args); diff --git a/src/NadekoBot/Modules/Administration/DangerousCommands.cs b/src/NadekoBot/Modules/Administration/DangerousCommands.cs index eca414edd..f19f012c0 100644 --- a/src/NadekoBot/Modules/Administration/DangerousCommands.cs +++ b/src/NadekoBot/Modules/Administration/DangerousCommands.cs @@ -107,7 +107,7 @@ namespace NadekoBot.Modules.Administration public async Task PurgeUser(ulong userId) { var embed = _eb.Create() - .WithDescription(GetText(strs.purge_user_confirm, Format.Bold(userId.ToString()))); + .WithDescription(GetText(strs.purge_user_confirm(Format.Bold(userId.ToString())))); if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false)) { diff --git a/src/NadekoBot/Modules/Administration/ProtectionCommands.cs b/src/NadekoBot/Modules/Administration/ProtectionCommands.cs index 3198626ff..ad0c13991 100644 --- a/src/NadekoBot/Modules/Administration/ProtectionCommands.cs +++ b/src/NadekoBot/Modules/Administration/ProtectionCommands.cs @@ -133,7 +133,7 @@ namespace NadekoBot.Modules.Administration return; } - await SendConfirmAsync(GetText(strs.prot_enable, "Anti-Raid"), + await SendConfirmAsync(GetText(strs.prot_enable("Anti-Raid")), $"{ctx.User.Mention} {GetAntiRaidString(stats)}") .ConfigureAwait(false); } @@ -199,7 +199,7 @@ namespace NadekoBot.Modules.Administration var stats = await _service.StartAntiSpamAsync(ctx.Guild.Id, messageCount, action, time, role?.Id).ConfigureAwait(false); - await SendConfirmAsync(GetText(strs.prot_enable, "Anti-Spam"), + await SendConfirmAsync(GetText(strs.prot_enable("Anti-Spam")), $"{ctx.User.Mention} {GetAntiSpamString(stats)}").ConfigureAwait(false); } @@ -247,10 +247,10 @@ namespace NadekoBot.Modules.Administration } private string GetAntiAltString(AntiAltStats alt) - => GetText(strs.anti_alt_status, + => GetText(strs.anti_alt_status( Format.Bold(alt.MinAge.ToString(@"dd\d\ hh\h\ mm\m\ ")), Format.Bold(alt.Action.ToString()), - Format.Bold(alt.Counter.ToString())); + Format.Bold(alt.Counter.ToString()))); private string GetAntiSpamString(AntiSpamStats stats) { diff --git a/src/NadekoBot/Modules/Administration/RoleCommands.cs b/src/NadekoBot/Modules/Administration/RoleCommands.cs index d330d2e2a..276ae2679 100644 --- a/src/NadekoBot/Modules/Administration/RoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/RoleCommands.cs @@ -150,7 +150,7 @@ namespace NadekoBot.Modules.Administration } var content = msg?.Content.TrimTo(30) ?? "DELETED!"; embed.AddField($"**{rr.Index + 1}.** {(ch?.Name ?? "DELETED!")}", - GetText(strs.reaction_roles_message, rr.ReactionRoles?.Count ?? 0, content)); + GetText(strs.reaction_roles_message(rr.ReactionRoles?.Count ?? 0, content))); } } await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); diff --git a/src/NadekoBot/Modules/Administration/SelfAssignedRolesCommands.cs b/src/NadekoBot/Modules/Administration/SelfAssignedRolesCommands.cs index 423001338..a4b0936e1 100644 --- a/src/NadekoBot/Modules/Administration/SelfAssignedRolesCommands.cs +++ b/src/NadekoBot/Modules/Administration/SelfAssignedRolesCommands.cs @@ -128,7 +128,7 @@ namespace NadekoBot.Modules.Administration var groupNameText = ""; if (!groups.TryGetValue(kvp.Key, out var name)) { - groupNameText = Format.Bold(GetText(strs.self_assign_group, kvp.Key)); + groupNameText = Format.Bold(GetText(strs.self_assign_group(kvp.Key))); } else { @@ -155,7 +155,7 @@ namespace NadekoBot.Modules.Administration } return _eb.Create().WithOkColor() - .WithTitle(Format.Bold(GetText(strs.self_assign_list, roles.Count()))) + .WithTitle(Format.Bold(GetText(strs.self_assign_list(roles.Count())))) .WithDescription(rolesStr.ToString()) .WithFooter(exclusive ? GetText(strs.self_assign_are_exclusive) diff --git a/src/NadekoBot/Modules/Administration/SelfCommands.cs b/src/NadekoBot/Modules/Administration/SelfCommands.cs index 0f9c6a43e..dedfe3910 100644 --- a/src/NadekoBot/Modules/Administration/SelfCommands.cs +++ b/src/NadekoBot/Modules/Administration/SelfCommands.cs @@ -119,7 +119,7 @@ namespace NadekoBot.Modules.Administration [{GetText(strs.channel)}]: {x.ChannelName} #{x.ChannelId} [{GetText(strs.command_text)}]: {x.CommandText}```")), title: string.Empty, - footer: GetText(strs.page, page + 1)) + footer: GetText(strs.page(page + 1))) .ConfigureAwait(false); } } @@ -152,7 +152,7 @@ namespace NadekoBot.Modules.Administration {GetIntervalText(x.Interval)} [{GetText(strs.command_text)}]: {x.CommandText}```")), title: string.Empty, - footer: GetText(strs.page, page + 1)) + footer: GetText(strs.page(page + 1))) .ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/Administration/UserPunishCommands.cs b/src/NadekoBot/Modules/Administration/UserPunishCommands.cs index a396ffc28..2a9142481 100644 --- a/src/NadekoBot/Modules/Administration/UserPunishCommands.cs +++ b/src/NadekoBot/Modules/Administration/UserPunishCommands.cs @@ -61,7 +61,7 @@ namespace NadekoBot.Modules.Administration try { await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).EmbedAsync(_eb.Create().WithErrorColor() - .WithDescription(GetText(strs.warned_on, ctx.Guild.ToString())) + .WithDescription(GetText(strs.warned_on(ctx.Guild.ToString()))) .AddField(GetText(strs.moderator), ctx.User.ToString()) .AddField(GetText(strs.reason), reason ?? "-")) .ConfigureAwait(false); @@ -101,7 +101,7 @@ namespace NadekoBot.Modules.Administration } 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()))); } @@ -221,7 +221,7 @@ namespace NadekoBot.Modules.Administration var user = (ctx.Guild as SocketGuild)?.GetUser(userId)?.ToString() ?? userId.ToString(); var embed = _eb.Create() .WithOkColor() - .WithTitle(GetText(strs.warnlog_for, user)); + .WithTitle(GetText(strs.warnlog_for(user))); if (!warnings.Any()) { @@ -239,7 +239,7 @@ namespace NadekoBot.Modules.Administration w.Moderator); 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))}"; embed.AddField($"#`{i}` " + name, w.Reason.TrimTo(1020)); } @@ -436,7 +436,7 @@ namespace NadekoBot.Modules.Administration { try { - var defaultMessage = GetText(strs.bandm, Format.Bold(ctx.Guild.Name), msg); + var defaultMessage = GetText(strs.bandm(Format.Bold(ctx.Guild.Name), msg)); var embed = _service.GetBanUserDmEmbed(Context, guildUser, defaultMessage, msg, time.Time); if (embed is not null) { @@ -503,7 +503,7 @@ namespace NadekoBot.Modules.Administration try { - var defaultMessage = GetText(strs.bandm, Format.Bold(ctx.Guild.Name), msg); + var defaultMessage = GetText(strs.bandm(Format.Bold(ctx.Guild.Name), msg)); var embed = _service.GetBanUserDmEmbed(Context, user, defaultMessage, msg, null); if (embed is not null) { @@ -584,7 +584,7 @@ namespace NadekoBot.Modules.Administration private async Task InternalBanMessageTest(string reason, TimeSpan? duration) { var dmChannel = await ctx.User.GetOrCreateDMChannelAsync(); - var defaultMessage = GetText(strs.bandm, Format.Bold(ctx.Guild.Name), reason); + var defaultMessage = GetText(strs.bandm(Format.Bold(ctx.Guild.Name), reason)); var embed = _service.GetBanUserDmEmbed(Context, (IGuildUser)ctx.User, defaultMessage, @@ -685,7 +685,7 @@ namespace NadekoBot.Modules.Administration 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)).ConfigureAwait(false)); } catch { @@ -741,7 +741,7 @@ namespace NadekoBot.Modules.Administration try { - await user.SendErrorAsync(_eb, GetText(strs.kickdm, Format.Bold(ctx.Guild.Name), msg)) + await user.SendErrorAsync(_eb, GetText(strs.kickdm(Format.Bold(ctx.Guild.Name), msg))) .ConfigureAwait(false); } catch @@ -783,8 +783,8 @@ namespace NadekoBot.Modules.Administration //send a message but don't wait for it var banningMessageTask = ctx.Channel.EmbedAsync(_eb.Create() - .WithDescription(GetText(strs.mass_kill_in_progress, bans.Count())) - .AddField(GetText(strs.invalid, missing), missStr) + .WithDescription(GetText(strs.mass_kill_in_progress(bans.Count()))) + .AddField(GetText(strs.invalid(missing), missStr)) .WithOkColor()); //do the banning @@ -800,8 +800,8 @@ namespace NadekoBot.Modules.Administration var banningMessage = await banningMessageTask.ConfigureAwait(false); await banningMessage.ModifyAsync(x => x.Embed = _eb.Create() - .WithDescription(GetText(strs.mass_kill_completed, bans.Count())) - .AddField(GetText(strs.invalid, missing), missStr) + .WithDescription(GetText(strs.mass_kill_completed(bans.Count()))) + .AddField(GetText(strs.invalid(missing), missStr)) .WithOkColor() .Build()).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs b/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs index 5ac019df3..1d830f16b 100644 --- a/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs +++ b/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs @@ -77,13 +77,13 @@ namespace NadekoBot.Modules.Gambling if (race.FinishedUsers[0].Bet > 0) { return SendConfirmAsync(GetText(strs.animal_race), - GetText(strs.animal_race_won_money, Format.Bold(winner.Username), + GetText(strs.animal_race_won_money(Format.Bold(winner.Username)), winner.Animal.Icon, (race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign)); } else { return SendConfirmAsync(GetText(strs.animal_race), - GetText(strs.animal_race_won, Format.Bold(winner.Username), winner.Animal.Icon)); + GetText(strs.animal_race_won(Format.Bold(winner.Username), winner.Animal.Icon))); } } @@ -93,8 +93,8 @@ namespace NadekoBot.Modules.Gambling ar.OnStarted += Ar_OnStarted; _client.MessageReceived += _client_MessageReceived; - return SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_starting, options.StartTime), - footer: GetText(strs.animal_race_join_instr, Prefix)); + return SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_starting(options.StartTime)), + footer: GetText(strs.animal_race_join_instr(Prefix))); } private Task Ar_OnStarted(AnimalRace race) @@ -102,7 +102,7 @@ namespace NadekoBot.Modules.Gambling if (race.Users.Count == race.MaxUsers) return SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_full)); else - return SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_starting_with_x, race.Users.Count)); + return SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_starting_with_x(race.Users.Count))); } private async Task Ar_OnStateUpdate(AnimalRace race) @@ -153,9 +153,9 @@ namespace NadekoBot.Modules.Gambling var user = await ar.JoinRace(ctx.User.Id, ctx.User.ToString(), amount) .ConfigureAwait(false); 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)).ConfigureAwait(false)); 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)).ConfigureAwait(false)); } catch (ArgumentOutOfRangeException) { @@ -176,7 +176,7 @@ namespace NadekoBot.Modules.Gambling } catch (NotEnoughFundsException) { - await SendErrorAsync(GetText(strs.not_enough, CurrencySign)).ConfigureAwait(false); + await SendErrorAsync(GetText(strs.not_enough(CurrencySign)).ConfigureAwait(false)); } } } diff --git a/src/NadekoBot/Modules/Gambling/Connect4Commands.cs b/src/NadekoBot/Modules/Gambling/Connect4Commands.cs index 3248fbbcc..c5c5c5ae9 100644 --- a/src/NadekoBot/Modules/Gambling/Connect4Commands.cs +++ b/src/NadekoBot/Modules/Gambling/Connect4Commands.cs @@ -129,11 +129,11 @@ namespace NadekoBot.Modules.Gambling string title; if (result == Connect4Game.Result.CurrentPlayerWon) { - title = GetText(strs.connect4_won, Format.Bold(arg.CurrentPlayer.Username), Format.Bold(arg.OtherPlayer.Username)); + title = GetText(strs.connect4_won(Format.Bold(arg.CurrentPlayer.Username), Format.Bold(arg.OtherPlayer.Username))); } else if (result == Connect4Game.Result.OtherPlayerWon) { - title = GetText(strs.connect4_won, Format.Bold(arg.OtherPlayer.Username), Format.Bold(arg.CurrentPlayer.Username)); + title = GetText(strs.connect4_won(Format.Bold(arg.OtherPlayer.Username), Format.Bold(arg.CurrentPlayer.Username))); } else title = GetText(strs.connect4_draw); @@ -180,7 +180,7 @@ namespace NadekoBot.Modules.Gambling if (game.CurrentPhase == Connect4Game.Phase.P1Move || game.CurrentPhase == Connect4Game.Phase.P2Move) - sb.AppendLine(GetText(strs.connect4_player_to_move, Format.Bold(game.CurrentPlayer.Username))); + sb.AppendLine(GetText(strs.connect4_player_to_move(Format.Bold(game.CurrentPlayer.Username)))); for (int i = Connect4Game.NumberOfRows; i > 0; i--) { diff --git a/src/NadekoBot/Modules/Gambling/CurrencyEventsCommands.cs b/src/NadekoBot/Modules/Gambling/CurrencyEventsCommands.cs index 22da2c32a..598a00463 100644 --- a/src/NadekoBot/Modules/Gambling/CurrencyEventsCommands.cs +++ b/src/NadekoBot/Modules/Gambling/CurrencyEventsCommands.cs @@ -52,15 +52,15 @@ namespace NadekoBot.Modules.Gambling case CurrencyEvent.Type.Reaction: return _eb.Create() .WithOkColor() - .WithTitle(GetText(strs.event_title, type.ToString())) + .WithTitle(GetText(strs.event_title(type.ToString()))) .WithDescription(GetReactionDescription(opts.Amount, currentPot)) - .WithFooter(GetText(strs.event_duration_footer, opts.Hours)); + .WithFooter(GetText(strs.event_duration_footer(opts.Hours))); case CurrencyEvent.Type.GameStatus: return _eb.Create() .WithOkColor() - .WithTitle(GetText(strs.event_title, type.ToString())) + .WithTitle(GetText(strs.event_title(type.ToString()))) .WithDescription(GetGameStatusDescription(opts.Amount, currentPot)) - .WithFooter(GetText(strs.event_duration_footer, opts.Hours)); + .WithFooter(GetText(strs.event_duration_footer(opts.Hours))); default: break; } diff --git a/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs b/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs index f25698912..4bc7645e6 100644 --- a/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs +++ b/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs @@ -35,7 +35,7 @@ namespace NadekoBot.Modules.Gambling return; 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)).ConfigureAwait(false)); } var res = await _service.JoinOrCreateGame(ctx.Channel.Id, ctx.User, amount, mixed, OnEnded) @@ -43,9 +43,9 @@ namespace NadekoBot.Modules.Gambling if (res.Item1 != null) { - 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})")), - footer: GetText(strs.rafflecur_joined, ctx.User.ToString())).ConfigureAwait(false); + footer: GetText(strs.rafflecur_joined(ctx.User.ToString())).ConfigureAwait(false)); } else { diff --git a/src/NadekoBot/Modules/Gambling/DiceRollCommands.cs b/src/NadekoBot/Modules/Gambling/DiceRollCommands.cs index 4c4d3c2b8..bf1b6e4fc 100644 --- a/src/NadekoBot/Modules/Gambling/DiceRollCommands.cs +++ b/src/NadekoBot/Modules/Gambling/DiceRollCommands.cs @@ -47,7 +47,7 @@ namespace NadekoBot.Modules.Gambling { await ctx.Channel.SendFileAsync(ms, $"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()))).ConfigureAwait(false)); } } @@ -128,7 +128,7 @@ namespace NadekoBot.Modules.Gambling await ctx.Channel.SendFileAsync(ms, $"dice.{format.FileExtensions.First()}", 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, Format.Bold(values.Sum().ToString()), Format.Bold((values.Sum() / (1.0f * values.Count)).ToString("N2")))).ConfigureAwait(false); @@ -152,7 +152,7 @@ namespace NadekoBot.Modules.Gambling } var embed = _eb.Create() .WithOkColor() - .WithDescription(ctx.User.Mention + " " + GetText(strs.dice_rolled_num, Format.Bold(n1.ToString()))) + .WithDescription(ctx.User.Mention + " " + GetText(strs.dice_rolled_num(Format.Bold(n1.ToString())))) .AddField(Format.Bold("Result"), string.Join(" ", rolls.Select(c => Format.Code($"[{c}]")))); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); @@ -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())))) diff --git a/src/NadekoBot/Modules/Gambling/DrawCommands.cs b/src/NadekoBot/Modules/Gambling/DrawCommands.cs index 8ea122ba0..9117b4509 100644 --- a/src/NadekoBot/Modules/Gambling/DrawCommands.cs +++ b/src/NadekoBot/Modules/Gambling/DrawCommands.cs @@ -66,7 +66,7 @@ namespace NadekoBot.Modules.Gambling toSend += $" drew `{Deck.GetHandValue(cardObjects)}`"; if (guildId != null) - toSend += "\n" + GetText(strs.cards_left, Format.Bold(cards.CardPool.Count.ToString())); + toSend += "\n" + GetText(strs.cards_left(Format.Bold(cards.CardPool.Count.ToString()))); return (img.ToStream(), toSend); } diff --git a/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs b/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs index a2414fbdc..1f981d30e 100644 --- a/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs +++ b/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs @@ -67,7 +67,7 @@ namespace NadekoBot.Modules.Gambling i.Dispose(); } 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(GetText(strs.heads)) : Format.Bold(GetText(strs.tails))); @@ -115,7 +115,7 @@ namespace NadekoBot.Modules.Gambling if (guess == result) { var toWin = (long)(amount * _config.BetFlip.Multiplier); - str = Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flip_guess, toWin + CurrencySign); + str = Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flip_guess(toWin + CurrencySign)); await _cs.AddAsync(ctx.User, "Betflip Gamble", toWin, false, gamble: true).ConfigureAwait(false); } else diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index 16cd48594..e85c95b00 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -209,7 +209,7 @@ namespace NadekoBot.Modules.Gambling } embed.WithDescription(desc); - embed.WithFooter(GetText(strs.page, page + 1)); + embed.WithFooter(GetText(strs.page(page + 1))); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } @@ -476,7 +476,7 @@ namespace NadekoBot.Modules.Gambling var result = br.Roll(); - var str = Format.Bold(ctx.User.ToString()) + Format.Code(GetText(strs.roll, result.Roll)); + var str = Format.Bold(ctx.User.ToString()) + Format.Code(GetText(strs.roll(result.Roll))); if (result.Multiplier > 0) { var win = (long)(amount * result.Multiplier); @@ -641,7 +641,7 @@ namespace NadekoBot.Modules.Gambling await _cs.AddAsync(ctx.User.Id, "Rps-draw", amount, gamble: true).ConfigureAwait(false); embed.WithOkColor(); - msg = GetText(strs.rps_draw, getRpsPick(pick)); + msg = GetText(strs.rps_draw(getRpsPick(pick))); } else if ((pick == RpsPick.Paper && nadekoPick == RpsPick.Rock) || (pick == RpsPick.Rock && nadekoPick == RpsPick.Scissors) || @@ -659,7 +659,7 @@ namespace NadekoBot.Modules.Gambling { embed.WithErrorColor(); 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)); } diff --git a/src/NadekoBot/Modules/Gambling/ShopCommands.cs b/src/NadekoBot/Modules/Gambling/ShopCommands.cs index be3b05c83..e374131b2 100644 --- a/src/NadekoBot/Modules/Gambling/ShopCommands.cs +++ b/src/NadekoBot/Modules/Gambling/ShopCommands.cs @@ -173,7 +173,7 @@ namespace NadekoBot.Modules.Gambling { await (await ctx.User.GetOrCreateDMChannelAsync().ConfigureAwait(false)) .EmbedAsync(_eb.Create().WithOkColor() - .WithTitle(GetText(strs.shop_purchase, ctx.Guild.Name)) + .WithTitle(GetText(strs.shop_purchase(ctx.Guild.Name))) .AddField(GetText(strs.item), item.Text, false) .AddField(GetText(strs.price), entry.Price.ToString(), true) .AddField(GetText(strs.name), entry.Name, true)) @@ -433,7 +433,7 @@ namespace NadekoBot.Modules.Gambling var embed = _eb.Create().WithOkColor(); 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.type), entry.Type.ToString(), true); else if (entry.Type == ShopEntryType.List) @@ -441,7 +441,7 @@ namespace NadekoBot.Modules.Gambling .AddField(GetText(strs.price), entry.Price.ToString(), true) .AddField(GetText(strs.type), GetText(strs.random_unique_item), true); //else if (entry.Type == ShopEntryType.Infinite_List) - // return embed.AddField(GetText(strs.name), GetText(strs.shop_role, Format.Bold(entry.RoleName)), true) + // return embed.AddField(GetText(strs.name), GetText(strs.shop_role(Format.Bold(entry.RoleName)), true)) // .AddField(GetText(strs.price), entry.Price.ToString(), true) // .AddField(GetText(strs.type), entry.Type.ToString(), true); else return null; @@ -451,11 +451,11 @@ namespace NadekoBot.Modules.Gambling { if (entry.Type == ShopEntryType.Role) { - return GetText(strs.shop_role, Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE")); + return GetText(strs.shop_role(Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE"))); } else if (entry.Type == ShopEntryType.List) { - return GetText(strs.unique_items_left, entry.Items.Count) + "\n" + entry.Name; + return GetText(strs.unique_items_left(entry.Items.Count)) + "\n" + entry.Name; } //else if (entry.Type == ShopEntryType.Infinite_List) //{ diff --git a/src/NadekoBot/Modules/Gambling/SlotCommands.cs b/src/NadekoBot/Modules/Gambling/SlotCommands.cs index eeedaa6fa..03a6cbc89 100644 --- a/src/NadekoBot/Modules/Gambling/SlotCommands.cs +++ b/src/NadekoBot/Modules/Gambling/SlotCommands.cs @@ -203,13 +203,13 @@ namespace NadekoBot.Modules.Gambling await _cs.AddAsync(ctx.User, $"Slot Machine x{result.Multiplier}", amount * result.Multiplier, false, gamble: true).ConfigureAwait(false); Interlocked.Add(ref _totalPaidOut, amount * result.Multiplier); if (result.Multiplier == 1) - msg = GetText(strs.slot_single, CurrencySign, 1); + msg = GetText(strs.slot_single(CurrencySign, 1)); else if (result.Multiplier == 4) - msg = GetText(strs.slot_two, CurrencySign, 4); + msg = GetText(strs.slot_two(CurrencySign, 4)); else if (result.Multiplier == 10) - msg = GetText(strs.slot_three, 10); + msg = GetText(strs.slot_three(10)); else if (result.Multiplier == 30) - msg = GetText(strs.slot_jackpot, 30); + msg = GetText(strs.slot_jackpot(30)); } using (var imgStream = bgImage.ToStream()) diff --git a/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs b/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs index a5ccc387e..47a6cb8cc 100644 --- a/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs +++ b/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs @@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Gambling var price = _service.GetResetPrice(ctx.User); var embed = _eb.Create() .WithTitle(GetText(strs.waifu_reset_confirm)) - .WithDescription(GetText(strs.waifu_reset_price, Format.Bold(price + CurrencySign))); + .WithDescription(GetText(strs.waifu_reset_price(Format.Bold(price + CurrencySign)))); if (!await PromptUserConfirmAsync(embed)) return; @@ -72,7 +72,7 @@ namespace NadekoBot.Modules.Gambling Format.Bold(target.ToString()), amount + CurrencySign); 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 msg = " " + msg; await SendConfirmAsync(ctx.User.Mention + msg); @@ -292,7 +292,7 @@ namespace NadekoBot.Modules.Gambling .AddField(GetText(strs.changes_of_heart), $"{wi.AffinityCount} - \"the {affInfo}\"", true) .AddField(GetText(strs.divorces), wi.DivorceCount.ToString(), 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 ? nobody : string.Join("\n", wi.Claims.Shuffle().Take(30)), true) diff --git a/src/NadekoBot/Modules/Games/AcropobiaCommands.cs b/src/NadekoBot/Modules/Games/AcropobiaCommands.cs index 666d90c40..198ed0307 100644 --- a/src/NadekoBot/Modules/Games/AcropobiaCommands.cs +++ b/src/NadekoBot/Modules/Games/AcropobiaCommands.cs @@ -82,8 +82,8 @@ namespace NadekoBot.Modules.Games { var embed = _eb.Create().WithOkColor() .WithTitle(GetText(strs.acrophobia)) - .WithDescription(GetText(strs.acro_started, Format.Bold(string.Join(".", game.StartingLetters)))) - .WithFooter(GetText(strs.acro_started_footer, game.Opts.SubmissionTime)); + .WithDescription(GetText(strs.acro_started(Format.Bold(string.Join(".", game.StartingLetters))))) + .WithFooter(GetText(strs.acro_started_footer(game.Opts.SubmissionTime))); return ctx.Channel.EmbedAsync(embed); } @@ -92,7 +92,7 @@ namespace NadekoBot.Modules.Games { return SendConfirmAsync( GetText(strs.acrophobia), - GetText(strs.acro_vote_cast, Format.Bold(user))); + GetText(strs.acro_vote_cast(Format.Bold(user)))); } private async Task Game_OnVotingStarted(AcrophobiaGame game, ImmutableArray> submissions) @@ -118,7 +118,7 @@ namespace NadekoBot.Modules.Games var embed = _eb.Create() .WithOkColor() .WithTitle(GetText(strs.acrophobia) + " - " + GetText(strs.submissions_closed)) - .WithDescription(GetText(strs.acro_nym_was, Format.Bold(string.Join(".", game.StartingLetters)) + "\n" + + .WithDescription(GetText(strs.acro_nym_was(Format.Bold(string.Join(".", game.StartingLetters))) + "\n" + $@"-- {submissions.Aggregate("", (agg, cur) => agg + $"`{++i}.` **{cur.Key.Input}**\n")} --")) @@ -138,7 +138,7 @@ $@"-- var winner = table.First(); var embed = _eb.Create().WithOkColor() .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()))) .WithFooter(winner.Key.Input); diff --git a/src/NadekoBot/Modules/Games/Common/TicTacToe.cs b/src/NadekoBot/Modules/Games/Common/TicTacToe.cs index a76f07ed1..4d8ddd498 100644 --- a/src/NadekoBot/Modules/Games/Common/TicTacToe.cs +++ b/src/NadekoBot/Modules/Games/Common/TicTacToe.cs @@ -74,12 +74,6 @@ namespace NadekoBot.Modules.Games.Common private string GetText(LocStr key) => _strings.GetText(key, _channel.GuildId); - - private string GetText(LocStr key, T param) - => _strings.GetText(key, _channel.GuildId, param); - - private string GetText(LocStr key, T1 param, T2 param2) - => _strings.GetText(key, _channel.GuildId, param, param2); public string GetState() { @@ -104,7 +98,7 @@ namespace NadekoBot.Modules.Games.Common var embed = _eb.Create() .WithOkColor() .WithDescription(Environment.NewLine + GetState()) - .WithAuthor(GetText(strs.vs, _users[0], _users[1])); + .WithAuthor(GetText(strs.vs(_users[0], _users[1]))); if (!string.IsNullOrWhiteSpace(title)) embed.WithTitle(title); @@ -114,10 +108,10 @@ namespace NadekoBot.Modules.Games.Common if (_phase == Phase.Ended) embed.WithFooter(GetText(strs.ttt_no_moves)); else - embed.WithFooter(GetText(strs.ttt_users_move, _users[_curUserIndex])); + embed.WithFooter(GetText(strs.ttt_users_move(_users[_curUserIndex]))); } else - embed.WithFooter(GetText(strs.ttt_has_won, _winner)); + embed.WithFooter(GetText(strs.ttt_has_won(_winner))); return embed; } diff --git a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs index bbc5294f3..c8320c981 100644 --- a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs +++ b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs @@ -64,12 +64,6 @@ namespace NadekoBot.Modules.Games.Common.Trivia private string GetText(in LocStr key) => _strings.GetText(key, Channel.GuildId); - - private string GetText(in LocStr key, T param1) - => _strings.GetText(key, Channel.GuildId, param1); - - private string GetText(in LocStr key, T1 param1, T2 param2) - => _strings.GetText(key, Channel.GuildId, param1, param2); public async Task StartGame() { @@ -99,7 +93,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia .AddField(GetText(strs.question), CurrentQuestion.Question); if (showHowToQuit) - questionEmbed.WithFooter(GetText(strs.trivia_quit, _quitCommand)); + questionEmbed.WithFooter(GetText(strs.trivia_quit(_quitCommand))); if (Uri.IsWellFormedUriString(CurrentQuestion.ImageUrl, UriKind.Absolute)) questionEmbed.WithImageUrl(CurrentQuestion.ImageUrl); @@ -159,7 +153,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia { var embed = _eb.Create().WithErrorColor() .WithTitle(GetText(strs.trivia_game)) - .WithDescription(GetText(strs.trivia_times_up, Format.Bold(CurrentQuestion.Answer))); + .WithDescription(GetText(strs.trivia_times_up(Format.Bold(CurrentQuestion.Answer)))); if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute)) embed.WithImageUrl(CurrentQuestion.AnswerImageUrl); @@ -246,9 +240,9 @@ namespace NadekoBot.Modules.Games.Common.Trivia { var embedS = _eb.Create().WithOkColor() .WithTitle(GetText(strs.trivia_game)) - .WithDescription(GetText(strs.trivia_win, + .WithDescription(GetText(strs.trivia_win( guildUser.Mention, - Format.Bold(CurrentQuestion.Answer))); + Format.Bold(CurrentQuestion.Answer)))); if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute)) embedS.WithImageUrl(CurrentQuestion.AnswerImageUrl); await Channel.EmbedAsync(embedS).ConfigureAwait(false); @@ -264,7 +258,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia } var embed = _eb.Create().WithOkColor() .WithTitle(GetText(strs.trivia_game)) - .WithDescription(GetText(strs.trivia_guess, guildUser.Mention, Format.Bold(CurrentQuestion.Answer))); + .WithDescription(GetText(strs.trivia_guess(guildUser.Mention, Format.Bold(CurrentQuestion.Answer)))); if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute)) embed.WithImageUrl(CurrentQuestion.AnswerImageUrl); await Channel.EmbedAsync(embed).ConfigureAwait(false); @@ -283,7 +277,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia 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(); diff --git a/src/NadekoBot/Modules/Games/HangmanCommands.cs b/src/NadekoBot/Modules/Games/HangmanCommands.cs index 3c8e29627..1332bd3fa 100644 --- a/src/NadekoBot/Modules/Games/HangmanCommands.cs +++ b/src/NadekoBot/Modules/Games/HangmanCommands.cs @@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Games [RequireContext(ContextType.Guild)] 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)).ConfigureAwait(false)); } [NadekoCommand, Aliases] diff --git a/src/NadekoBot/Modules/Games/PollCommands.cs b/src/NadekoBot/Modules/Games/PollCommands.cs index 97a912712..2e70ed235 100644 --- a/src/NadekoBot/Modules/Games/PollCommands.cs +++ b/src/NadekoBot/Modules/Games/PollCommands.cs @@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Games await ctx.Channel .EmbedAsync(_eb.Create() .WithOkColor() - .WithTitle(GetText(strs.poll_created, ctx.User.ToString())) + .WithTitle(GetText(strs.poll_created(ctx.User.ToString()))) .WithDescription( Format.Bold(poll.Question) + "\n\n" + string.Join("\n", poll.Answers @@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Games } return eb.WithDescription(sb.ToString()) - .WithFooter(GetText(strs.x_votes_cast, totalVotesCast)) + .WithFooter(GetText(strs.x_votes_cast(totalVotesCast))) .WithOkColor(); } } diff --git a/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs b/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs index d93125cfe..7a33354e8 100644 --- a/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs +++ b/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs @@ -122,7 +122,14 @@ namespace NadekoBot.Modules.Games.Services { if (pc.Verbose) { - var returnMsg = _strings.GetText(strs.perm_prevent, 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 { } + var returnMsg = _strings.GetText( + strs.perm_prevent( + 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 { } Log.Information(returnMsg); } return true; diff --git a/src/NadekoBot/Modules/Help/Help.cs b/src/NadekoBot/Modules/Help/Help.cs index 9d73a0e21..33b528bb1 100644 --- a/src/NadekoBot/Modules/Help/Help.cs +++ b/src/NadekoBot/Modules/Help/Help.cs @@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Help .OrderBy(module => module.Name) .ForEach(module => embed.AddField($"{GetModuleEmoji(module.Name)} {module.Name}", GetText($"module_description_{module.Name.ToLowerInvariant()}") + "\n" + - Format.Code(GetText(strs.module_footer, Prefix, module.Name.ToLowerInvariant())), + Format.Code(GetText(strs.module_footer(Prefix, module.Name.ToLowerInvariant()))), true)); return embed; @@ -230,7 +230,7 @@ namespace NadekoBot.Modules.Help embed.AddField(g.ElementAt(i).Key, "```css\n" + string.Join("\n", transformed) + "\n```", true); } } - embed.WithFooter(GetText(strs.commands_instr, Prefix)); + embed.WithFooter(GetText(strs.commands_instr(Prefix))); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/NadekoBot/Modules/Music/Music.cs index e5ad44aff..8c92aec72 100644 --- a/src/NadekoBot/Modules/Music/Music.cs +++ b/src/NadekoBot/Modules/Music/Music.cs @@ -293,10 +293,10 @@ namespace NadekoBot.Modules.Music var repeatType = mp.Repeat; var add = ""; if (mp.IsStopped) - add += Format.Bold(GetText(strs.queue_stopped, Format.Code(Prefix + "play"))) + "\n"; + add += Format.Bold(GetText(strs.queue_stopped(Format.Code(Prefix + "play")))) + "\n"; // var mps = mp.MaxPlaytimeSeconds; // if (mps > 0) - // add += Format.Bold(GetText(strs.song_skips_after, TimeSpan.FromSeconds(mps).ToString("HH\\:mm\\:ss"))) + "\n"; + // add += Format.Bold(GetText(strs.song_skips_after(TimeSpan.FromSeconds(mps).ToString("HH\\:mm\\:ss")))) + "\n"; if (repeatType == PlayerRepeatType.Track) { add += "šŸ”‚ " + GetText(strs.repeating_track) + "\n"; @@ -329,7 +329,7 @@ namespace NadekoBot.Modules.Music desc = add + "\n" + desc; var embed = _eb.Create() - .WithAuthor(GetText(strs.player_queue, curPage + 1, (tracks.Count / LQ_ITEMS_PER_PAGE) + 1), + .WithAuthor(GetText(strs.player_queue(curPage + 1, (tracks.Count / LQ_ITEMS_PER_PAGE) + 1)), MusicIconUrl) .WithDescription(desc) .WithFooter($" {mp.PrettyVolume()} | šŸŽ¶ {tracks.Count} | āŒ› {mp.PrettyTotalTime()} ") diff --git a/src/NadekoBot/Modules/Music/PlaylistCommands.cs b/src/NadekoBot/Modules/Music/PlaylistCommands.cs index 8df96fe7c..2b8d8c66f 100644 --- a/src/NadekoBot/Modules/Music/PlaylistCommands.cs +++ b/src/NadekoBot/Modules/Music/PlaylistCommands.cs @@ -63,9 +63,9 @@ namespace NadekoBot.Modules.Music var embed = _eb .Create(ctx) - .WithAuthor(GetText(strs.playlists_page, num), MusicIconUrl) + .WithAuthor(GetText(strs.playlists_page(num), MusicIconUrl)) .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(); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); @@ -225,7 +225,7 @@ namespace NadekoBot.Modules.Music try { msg = await ctx.Channel - .SendMessageAsync(GetText(strs.attempting_to_queue, Format.Bold(mpl.Songs.Count.ToString()))) + .SendMessageAsync(GetText(strs.attempting_to_queue(Format.Bold(mpl.Songs.Count.ToString())))) .ConfigureAwait(false); } catch (Exception) diff --git a/src/NadekoBot/Modules/Permissions/Permissions.cs b/src/NadekoBot/Modules/Permissions/Permissions.cs index cf9f3becb..3f9dbb3cb 100644 --- a/src/NadekoBot/Modules/Permissions/Permissions.cs +++ b/src/NadekoBot/Modules/Permissions/Permissions.cs @@ -121,7 +121,7 @@ namespace NadekoBot.Modules.Permissions } var startPos = 20 * (page - 1); - var toSend = Format.Bold(GetText(strs.page, page)) + "\n\n" + string.Join("\n", + var toSend = Format.Bold(GetText(strs.page(page))) + "\n\n" + string.Join("\n", perms.Reverse() .Skip(startPos) .Take(20) diff --git a/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs b/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs index a4290f5e8..74c875537 100644 --- a/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs @@ -83,7 +83,7 @@ namespace NadekoBot.Modules.Searches var embed = _eb.Create() .WithOkColor() - .WithTitle(GetText(strs.mal_profile, name)) + .WithTitle(GetText(strs.mal_profile(name))) .AddField("šŸ’š " + GetText(strs.watching), stats[0], true) .AddField("šŸ’™ " + GetText(strs.completed), stats[1], true); if (info.Count < 3) diff --git a/src/NadekoBot/Modules/Searches/CryptoCommands.cs b/src/NadekoBot/Modules/Searches/CryptoCommands.cs index dab3bbdec..ea1a31148 100644 --- a/src/NadekoBot/Modules/Searches/CryptoCommands.cs +++ b/src/NadekoBot/Modules/Searches/CryptoCommands.cs @@ -24,7 +24,7 @@ namespace NadekoBot.Modules.Searches { var embed = _eb.Create() .WithTitle(GetText(strs.crypto_not_found)) - .WithDescription(GetText(strs.did_you_mean, Format.Bold($"{nearest.Name} ({nearest.Symbol})"))); + .WithDescription(GetText(strs.did_you_mean(Format.Bold($"{nearest.Name} ({nearest.Symbol})")))); if (await PromptUserConfirmAsync(embed).ConfigureAwait(false)) { diff --git a/src/NadekoBot/Modules/Searches/PlaceCommands.cs b/src/NadekoBot/Modules/Searches/PlaceCommands.cs index c61c475eb..1adc1cdbb 100644 --- a/src/NadekoBot/Modules/Searches/PlaceCommands.cs +++ b/src/NadekoBot/Modules/Searches/PlaceCommands.cs @@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Searches [NadekoCommand, Aliases] public async Task Placelist() { - await SendConfirmAsync(GetText(strs.list_of_place_tags, Prefix), + await SendConfirmAsync(GetText(strs.list_of_place_tags(Prefix)), _typesStr) .ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs index b81d5dc58..1e5cbe6c4 100644 --- a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs @@ -44,7 +44,7 @@ namespace NadekoBot.Modules.Searches .WithDescription(p.BaseStats.ToString()) .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.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); return; } diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/NadekoBot/Modules/Searches/Searches.cs index 013e440df..12932915c 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/NadekoBot/Modules/Searches/Searches.cs @@ -756,7 +756,7 @@ namespace NadekoBot.Modules.Searches // .AddField(GetText(strs.genres), gameData.TotalEpisodes.ToString(), true) // .AddField(GetText(strs.price), gameData.IsFree ? GetText(strs.FREE) : game, true) // .AddField(GetText(strs.links), gameData.GetGenresString(), true) - // .WithFooter(GetText(strs.recommendations, gameData.TotalRecommendations)); + // .WithFooter(GetText(strs.recommendations(gameData.TotalRecommendations))); await ctx.Channel.SendMessageAsync($"https://store.steampowered.com/app/{appId}").ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Utility/CalcCommands.cs b/src/NadekoBot/Modules/Utility/CalcCommands.cs index 9f09a3e59..e4fd92f08 100644 --- a/src/NadekoBot/Modules/Utility/CalcCommands.cs +++ b/src/NadekoBot/Modules/Utility/CalcCommands.cs @@ -55,7 +55,7 @@ namespace NadekoBot.Modules.Utility "GetHashCode", "GetType" }); - await SendConfirmAsync(GetText(strs.calcops, Prefix), string.Join(", ", selection)).ConfigureAwait(false); + await SendConfirmAsync(GetText(strs.calcops(Prefix), string.Join(", ", selection)).ConfigureAwait(false)); } } diff --git a/src/NadekoBot/Modules/Utility/ConfigCommands.cs b/src/NadekoBot/Modules/Utility/ConfigCommands.cs index f06db8fa3..5389be21d 100644 --- a/src/NadekoBot/Modules/Utility/ConfigCommands.cs +++ b/src/NadekoBot/Modules/Utility/ConfigCommands.cs @@ -52,7 +52,7 @@ namespace NadekoBot.Modules.Utility var configNames = _settingServices.Select(x => x.Name); var embed = _eb.Create() .WithErrorColor() - .WithDescription(GetText(strs.config_not_found, Format.Code(name))) + .WithDescription(GetText(strs.config_not_found(Format.Code(name)))) .AddField(GetText(strs.config_list), string.Join("\n", configNames)); await ctx.Channel.EmbedAsync(embed); @@ -90,7 +90,7 @@ namespace NadekoBot.Modules.Utility { var embed = _eb.Create() .WithErrorColor() - .WithDescription(GetText(strs.config_not_found, Format.Code(name))) + .WithDescription(GetText(strs.config_not_found(Format.Code(name)))) .AddField(GetText(strs.config_list), string.Join("\n", configNames)); await ctx.Channel.EmbedAsync(embed); @@ -123,7 +123,7 @@ namespace NadekoBot.Modules.Utility var propStrings = GetPropsAndValuesString(setting, propNames); var propErrorEmbed = _eb.Create() .WithErrorColor() - .WithDescription(GetText(strs.config_prop_not_found, Format.Code(prop), Format.Code(name))) + .WithDescription(GetText(strs.config_prop_not_found(Format.Code(prop), Format.Code(name)))) .AddField($"āš™ļø {setting.Name}", propStrings); await ctx.Channel.EmbedAsync(propErrorEmbed); diff --git a/src/NadekoBot/Modules/Utility/InfoCommands.cs b/src/NadekoBot/Modules/Utility/InfoCommands.cs index b303f3529..18afe0e95 100644 --- a/src/NadekoBot/Modules/Utility/InfoCommands.cs +++ b/src/NadekoBot/Modules/Utility/InfoCommands.cs @@ -142,9 +142,9 @@ namespace NadekoBot.Modules.Utility } await ctx.Channel.EmbedAsync(_eb.Create() - .WithTitle(GetText(strs.activity_page, page + 1)) + .WithTitle(GetText(strs.activity_page(page + 1))) .WithOkColor() - .WithFooter(GetText(strs.activity_users_total, CmdHandler.UserMessagesSent.Count)) + .WithFooter(GetText(strs.activity_users_total(CmdHandler.UserMessagesSent.Count))) .WithDescription(str.ToString())).ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/Utility/InviteCommands.cs b/src/NadekoBot/Modules/Utility/InviteCommands.cs index 724f55756..112e3a1b5 100644 --- a/src/NadekoBot/Modules/Utility/InviteCommands.cs +++ b/src/NadekoBot/Modules/Utility/InviteCommands.cs @@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Utility var inv = invites.ElementAt(index); 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.ToString()))).ConfigureAwait(false)); } } } diff --git a/src/NadekoBot/Modules/Utility/PatreonCommands.cs b/src/NadekoBot/Modules/Utility/PatreonCommands.cs index 9ebfd4aac..945bd24e3 100644 --- a/src/NadekoBot/Modules/Utility/PatreonCommands.cs +++ b/src/NadekoBot/Modules/Utility/PatreonCommands.cs @@ -41,8 +41,8 @@ namespace NadekoBot.Modules.Utility .AddField(GetText(strs.clpa_fail_already_title), GetText(strs.clpa_fail_already)) .AddField(GetText(strs.clpa_fail_wait_title), GetText(strs.clpa_fail_wait)) .AddField(GetText(strs.clpa_fail_conn_title), GetText(strs.clpa_fail_conn)) - .AddField(GetText(strs.clpa_fail_sup_title), GetText(strs.clpa_fail_sup, helpcmd)) - .WithFooter(GetText(strs.clpa_next_update, rem))); + .AddField(GetText(strs.clpa_fail_sup_title), GetText(strs.clpa_fail_sup(helpcmd))) + .WithFooter(GetText(strs.clpa_next_update(rem)))); } } } diff --git a/src/NadekoBot/Modules/Utility/QuoteCommands.cs b/src/NadekoBot/Modules/Utility/QuoteCommands.cs index f7a69de2c..5d7d5204d 100644 --- a/src/NadekoBot/Modules/Utility/QuoteCommands.cs +++ b/src/NadekoBot/Modules/Utility/QuoteCommands.cs @@ -48,7 +48,7 @@ namespace NadekoBot.Modules.Utility } if (quotes.Any()) - await SendConfirmAsync(GetText(strs.quotes_page, page + 1), + await SendConfirmAsync(GetText(strs.quotes_page(page + 1)), string.Join("\n", quotes.Select(q => $"`#{q.Id}` {Format.Bold(q.Keyword.SanitizeAllMentions()),-20} by {q.AuthorName.SanitizeAllMentions()}"))) .ConfigureAwait(false); else @@ -113,12 +113,12 @@ namespace NadekoBot.Modules.Utility { await ctx.Channel.EmbedAsync(_eb.Create(ctx) .WithOkColor() - .WithTitle(GetText(strs.quote_id, $"#{data.Id}")) + .WithTitle(GetText(strs.quote_id($"#{data.Id}"))) .AddField(GetText(strs.trigger), data.Keyword) .AddField(GetText(strs.response), data.Text.Length > 1000 ? GetText(strs.redacted_too_long) : Format.Sanitize(data.Text)) - .WithFooter(GetText(strs.created_by, $"{data.AuthorName} ({data.AuthorId})")) + .WithFooter(GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})"))) ).ConfigureAwait(false); } @@ -222,7 +222,7 @@ namespace NadekoBot.Modules.Utility uow.Quotes.Remove(q); await uow.SaveChangesAsync(); success = true; - response = GetText(strs.quote_deleted, id); + response = GetText(strs.quote_deleted(id)); } } if (success) diff --git a/src/NadekoBot/Modules/Utility/RepeatCommands.cs b/src/NadekoBot/Modules/Utility/RepeatCommands.cs index 6ca4e9566..74892add6 100644 --- a/src/NadekoBot/Modules/Utility/RepeatCommands.cs +++ b/src/NadekoBot/Modules/Utility/RepeatCommands.cs @@ -50,7 +50,7 @@ namespace NadekoBot.Modules.Utility var description = GetRepeaterInfoString(removed); await ctx.Channel.EmbedAsync(_eb.Create() .WithOkColor() - .WithTitle(GetText(strs.repeater_removed, index + 1)) + .WithTitle(GetText(strs.repeater_removed(index + 1))) .WithDescription(description)); } diff --git a/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs b/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs index b6e4f36be..ae3975c1f 100644 --- a/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs +++ b/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs @@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Utility } 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())).ConfigureAwait(false)); } } } diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index a886f9455..ea745d6e1 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -117,7 +117,7 @@ namespace NadekoBot.Modules.Utility return _eb.Create().WithOkColor().WithDescription(GetText(strs.no_user_on_this_page)); return _eb.Create().WithOkColor() - .WithTitle(GetText(strs.inrole_list, Format.Bold(role?.Name ?? "No Role")) + $" - {roleUsers.Length}") + .WithTitle(GetText(strs.inrole_list(Format.Bold(role?.Name ?? "No Role")) + $" - {roleUsers.Length}")) .WithDescription(string.Join("\n", pageUsers)); }, roleUsers.Length, 20).ConfigureAwait(false); } @@ -199,7 +199,7 @@ namespace NadekoBot.Modules.Utility else { - await SendConfirmAsync(GetText(strs.roles_page, page, Format.Bold(target.ToString())), + await SendConfirmAsync(GetText(strs.roles_page(page, Format.Bold(target.ToString()))), "\n• " + string.Join("\n• ", (IEnumerable)roles).SanitizeMentions(true)).ConfigureAwait(false); } } @@ -212,7 +212,7 @@ namespace NadekoBot.Modules.Utility } else { - await SendConfirmAsync(GetText(strs.roles_all_page, page), + await SendConfirmAsync(GetText(strs.roles_all_page(page)), "\n• " + string.Join("\n• ", (IEnumerable)roles).SanitizeMentions(true)).ConfigureAwait(false); } } @@ -269,7 +269,7 @@ namespace NadekoBot.Modules.Utility { var tags = ctx.Message.Tags.Where(t => t.Type == TagType.Emoji).Select(t => (Emote)t.Value); - var result = string.Join("\n", tags.Select(m => GetText(strs.showemojis, m, m.Url))); + var result = string.Join("\n", tags.Select(m => GetText(strs.showemojis(m, m.Url)))); if (string.IsNullOrWhiteSpace(result)) await ReplyErrorLocalizedAsync("showemojis_none").ConfigureAwait(false); @@ -298,7 +298,7 @@ namespace NadekoBot.Modules.Utility .WithOkColor(); foreach (var guild in guilds) embed.AddField(guild.Name, - GetText(strs.listservers, guild.Id, guild.MemberCount, guild.OwnerId), + GetText(strs.listservers(guild.Id, guild.MemberCount, guild.OwnerId)), false); await ctx.Channel.EmbedAsync(embed); diff --git a/src/NadekoBot/Modules/Xp/Club.cs b/src/NadekoBot/Modules/Xp/Club.cs index 849f379b7..d8e089d4a 100644 --- a/src/NadekoBot/Modules/Xp/Club.cs +++ b/src/NadekoBot/Modules/Xp/Club.cs @@ -138,7 +138,7 @@ namespace NadekoBot.Modules.Xp var embed = _eb.Create() .WithOkColor() .WithTitle($"{club.ToString()}") - .WithDescription(GetText(strs.level_x, lvl.Level) + $" ({club.Xp} xp)") + .WithDescription(GetText(strs.level_x(lvl.Level) + $" ({club.Xp} xp)")) .AddField(GetText(strs.desc), string.IsNullOrWhiteSpace(club.Description) ? "-" : club.Description, false) .AddField(GetText(strs.owner), club.Owner.ToString(), true) @@ -188,7 +188,7 @@ namespace NadekoBot.Modules.Xp .Select(x => x.ToString())); return _eb.Create() - .WithTitle(GetText(strs.club_bans_for, club.ToString())) + .WithTitle(GetText(strs.club_bans_for(club.ToString()))) .WithDescription(toShow) .WithOkColor(); }, bans.Length, 10); @@ -219,7 +219,7 @@ namespace NadekoBot.Modules.Xp .Select(x => x.ToString())); return _eb.Create() - .WithTitle(GetText(strs.club_apps_for, club.ToString())) + .WithTitle(GetText(strs.club_apps_for(club.ToString()))) .WithDescription(toShow) .WithOkColor(); }, apps.Length, 10); @@ -374,7 +374,7 @@ namespace NadekoBot.Modules.Xp var clubs = _service.GetClubLeaderboardPage(page); var embed = _eb.Create() - .WithTitle(GetText(strs.club_leaderboard, page + 1)) + .WithTitle(GetText(strs.club_leaderboard(page + 1))) .WithOkColor(); var i = page * 9; diff --git a/src/NadekoBot/Modules/Xp/Xp.cs b/src/NadekoBot/Modules/Xp/Xp.cs index e1a271ac9..dd315abbd 100644 --- a/src/NadekoBot/Modules/Xp/Xp.cs +++ b/src/NadekoBot/Modules/Xp/Xp.cs @@ -72,13 +72,13 @@ namespace NadekoBot.Modules.Xp var str = ctx.Guild.GetRole(x.RoleId)?.ToString(); if (str is null) - str = GetText(strs.role_not_found, Format.Code(x.RoleId.ToString())); + str = GetText(strs.role_not_found(Format.Code(x.RoleId.ToString()))); else { if (!x.Remove) - str = GetText(strs.xp_receive_role, Format.Bold(str)); + str = GetText(strs.xp_receive_role(Format.Bold(str))); else - str = GetText(strs.xp_lose_role, Format.Bold(str)); + str = GetText(strs.xp_lose_role(Format.Bold(str))); } return (x.Level, Text: sign + str); }) @@ -105,7 +105,7 @@ namespace NadekoBot.Modules.Xp foreach (var reward in localRewards) { - embed.AddField(GetText(strs.level_x, reward.Key), + embed.AddField(GetText(strs.level_x(reward.Key)), string.Join("\n", reward.Select(y => y.Item2))); } @@ -364,7 +364,7 @@ namespace NadekoBot.Modules.Xp embed.AddField( $"#{(i + 1 + curPage * 9)} {(user?.ToString() ?? users[i].UserId.ToString())}", - $"{GetText(strs.level_x, levelStats.Level)} - {levelStats.TotalXp}xp {awardStr}"); + $"{GetText(strs.level_x(levelStats.Level))} - {levelStats.TotalXp}xp {awardStr}"); } return embed; } @@ -392,7 +392,7 @@ namespace NadekoBot.Modules.Xp var user = users[i]; embed.AddField( $"#{i + 1 + page * 9} {(user.ToString())}", - $"{GetText(strs.level_x, new LevelStats(users[i].TotalXp).Level)} - {users[i].TotalXp}xp"); + $"{GetText(strs.level_x(new LevelStats(users[i].TotalXp).Level))} - {users[i].TotalXp}xp"); } } diff --git a/src/NadekoBot/_Extensions/Extensions.cs b/src/NadekoBot/_Extensions/Extensions.cs index f4beb54a6..6c3bf579e 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -377,14 +377,9 @@ namespace NadekoBot.Extensions return msg.Content.Headers.ContentLength / 1.MB(); } - public static string GetText(this IBotStrings strings, LocStr0 str, ulong? guildId = null) + public static string GetText(this IBotStrings strings, in LocStr str, ulong? guildId = null) => strings.GetText(str.Key, guildId); - public static string GetText(this IBotStrings strings, LocStr0 str, CultureInfo culture) - => strings.GetText(str.Key, culture); - - public static string GetText(this IBotStrings strings, LocStr0 str, ulong? guildId = null) - => strings.GetText(str.Key, guildId); - public static string GetText(this IBotStrings strings, LocStr0 str, CultureInfo culture) - => strings.GetText(str.Key, culture); + public static string GetText(this IBotStrings strings, in LocStr str, CultureInfo culture) + => strings.GetText(str.Key, culture, str.Parms); } }