diff --git a/src/NadekoBot.Generators/LocalizedStringsGenerator.cs b/src/NadekoBot.Generators/LocalizedStringsGenerator.cs index 259d289a9..fefc06537 100644 --- a/src/NadekoBot.Generators/LocalizedStringsGenerator.cs +++ b/src/NadekoBot.Generators/LocalizedStringsGenerator.cs @@ -22,69 +22,82 @@ namespace NadekoBot.Generators { private const string LocStrSource = @"namespace NadekoBot { - public readonly ref struct LocStr + public readonly ref struct LocStr0 { public readonly string Key; - public LocStr(string key) + public LocStr0(string key) { Key = key; } - public static implicit operator LocStr(string data) - => new LocStr(data); + public static implicit operator LocStr0(string data) + => new LocStr0(data); } - public readonly ref struct LocStr + public readonly ref struct LocStr1 { public readonly string Key; - public LocStr(string key) + public LocStr1(string key) { Key = key; } - public static implicit operator LocStr(string data) - => new LocStr(data); + public static implicit operator LocStr1(string data) + => new LocStr1(data); } - public readonly ref struct LocStr + 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 LocStr(string key) + public LocStr3(string key) { Key = key; } - public static implicit operator LocStr(string data) - => new LocStr(data); + public static implicit operator LocStr3(string data) + => new LocStr3(data); } - public readonly ref struct LocStr + public readonly ref struct LocStr4 { public readonly string Key; - public LocStr(string key) + public LocStr4(string key) { Key = key; } - public static implicit operator LocStr(string data) - => new LocStr(data); + public static implicit operator LocStr4(string data) + => new LocStr4(data); } - public readonly ref struct LocStr + public readonly ref struct LocStr5 { public readonly string Key; - public LocStr(string key) + public LocStr5(string key) { Key = key; } - public static implicit operator LocStr(string data) - => new LocStr(data); + public static implicit operator LocStr5(string data) + => new LocStr5(data); } }"; @@ -159,15 +172,17 @@ namespace NadekoBot.Generators max += 1; if (max == 0) - return "LocStr"; + return "LocStr0"; if (max == 1) - return "LocStr"; + return "LocStr1"; if (max == 2) - return "LocStr"; + return "LocStr2"; if (max == 3) - return "LocStr"; + return "LocStr3"; if (max == 4) - return "LocStr"; + return "LocStr4"; + if (max == 5) + return "LocStr5"; return "!Error"; } diff --git a/src/NadekoBot/Common/NadekoModule.cs b/src/NadekoBot/Common/NadekoModule.cs index db7594205..49a777c46 100644 --- a/src/NadekoBot/Common/NadekoModule.cs +++ b/src/NadekoBot/Common/NadekoModule.cs @@ -33,8 +33,23 @@ namespace NadekoBot.Modules protected string GetText(string key) => Strings.GetText(key, _cultureInfo); - protected string GetText(in LocStr key) => + 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(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 736de181d..eca414edd 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("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 f3a557d59..3198626ff 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("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("prot_enable", "Anti-Spam"), + await SendConfirmAsync(GetText(strs.prot_enable, "Anti-Spam"), $"{ctx.User.Mention} {GetAntiSpamString(stats)}").ConfigureAwait(false); } @@ -247,7 +247,7 @@ namespace NadekoBot.Modules.Administration } private string GetAntiAltString(AntiAltStats alt) - => GetText("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())); @@ -266,7 +266,7 @@ namespace NadekoBot.Modules.Administration add = $" ({TimeSpan.FromMinutes(settings.MuteTime):hh\\hmm\\m})"; } - return GetText("spam_stats", + return GetText(strs.spam_stats, Format.Bold(settings.MessageThreshold.ToString()), Format.Bold(settings.Action.ToString() + add), ignoredString); @@ -281,7 +281,7 @@ namespace NadekoBot.Modules.Administration actionString += $" **({TimeSpan.FromMinutes(stats.AntiRaidSettings.PunishDuration):hh\\hmm\\m})**"; } - return GetText("raid_stats", + return GetText(strs.raid_stats, Format.Bold(stats.AntiRaidSettings.UserThreshold.ToString()), Format.Bold(stats.AntiRaidSettings.Seconds.ToString()), actionString); diff --git a/src/NadekoBot/Modules/Administration/RoleCommands.cs b/src/NadekoBot/Modules/Administration/RoleCommands.cs index 8302bab1d..d330d2e2a 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("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 324e45b27..423001338 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("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("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 a65c625c7..0f9c6a43e 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("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("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 2369e013d..a396ffc28 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("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); @@ -96,12 +96,12 @@ namespace NadekoBot.Modules.Administration .WithOkColor(); if (punishment is null) { - embed.WithDescription(GetText("user_warned", + embed.WithDescription(GetText(strs.user_warned, Format.Bold(user.ToString()))); } else { - embed.WithDescription(GetText("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("warnlog_for", user)); + .WithTitle(GetText(strs.warnlog_for, user)); if (!warnings.Any()) { @@ -233,13 +233,13 @@ namespace NadekoBot.Modules.Administration foreach (var w in warnings) { i++; - var name = GetText("warned_on_by", + var name = GetText(strs.warned_on_by, w.DateAdded.Value.ToString("dd.MM.yyy"), w.DateAdded.Value.ToString("HH:mm"), w.Moderator); if (w.Forgiven) - name = $"{Format.Strikethrough(name)} {GetText("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("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("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("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("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("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("mass_kill_in_progress", bans.Count())) - .AddField(GetText("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("mass_kill_completed", bans.Count())) - .AddField(GetText("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/CustomReactions/Services/CustomReactionsService.cs b/src/NadekoBot/Modules/CustomReactions/Services/CustomReactionsService.cs index ec7f19ceb..7f1803c6d 100644 --- a/src/NadekoBot/Modules/CustomReactions/Services/CustomReactionsService.cs +++ b/src/NadekoBot/Modules/CustomReactions/Services/CustomReactionsService.cs @@ -411,7 +411,7 @@ namespace NadekoBot.Modules.CustomReactions.Services { if (pc.Verbose) { - var returnMsg = _strings.GetText("perm_prevent", sg.Id, + var returnMsg = _strings.GetText(strs.perm_prevent, sg.Id, index + 1, Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), sg))); diff --git a/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs b/src/NadekoBot/Modules/Gambling/AnimalRacingCommands.cs index 808c1956e..5ac019df3 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("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("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("animal_race_starting", options.StartTime), - footer: GetText("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("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("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("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("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 17741e64d..3248fbbcc 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("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("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("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 ea524c99c..22da2c32a 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("event_title", type.ToString())) + .WithTitle(GetText(strs.event_title, type.ToString())) .WithDescription(GetReactionDescription(opts.Amount, currentPot)) - .WithFooter(GetText("event_duration_footer", opts.Hours)); + .WithFooter(GetText(strs.event_duration_footer, opts.Hours)); case CurrencyEvent.Type.GameStatus: return _eb.Create() .WithOkColor() - .WithTitle(GetText("event_title", type.ToString())) + .WithTitle(GetText(strs.event_title, type.ToString())) .WithDescription(GetGameStatusDescription(opts.Amount, currentPot)) - .WithFooter(GetText("event_duration_footer", opts.Hours)); + .WithFooter(GetText(strs.event_duration_footer, opts.Hours)); default: break; } @@ -72,7 +72,7 @@ namespace NadekoBot.Modules.Gambling string potSizeStr = Format.Bold(potSize == 0 ? "āˆž" + CurrencySign : potSize.ToString() + CurrencySign); - return GetText("new_reaction_event", + return GetText(strs.new_reaction_event, CurrencySign, Format.Bold(amount + CurrencySign), potSizeStr); @@ -83,7 +83,7 @@ namespace NadekoBot.Modules.Gambling string potSizeStr = Format.Bold(potSize == 0 ? "āˆž" + CurrencySign : potSize.ToString() + CurrencySign); - return GetText("new_gamestatus_event", + return GetText(strs.new_gamestatus_event, CurrencySign, Format.Bold(amount + CurrencySign), potSizeStr); diff --git a/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs b/src/NadekoBot/Modules/Gambling/CurrencyRaffleCommands.cs index ee0f6d3c0..f25698912 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("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("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("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 5a3cc7133..4c4d3c2b8 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("dice_rolled", Format.Code(gen.ToString()))).ConfigureAwait(false); + Format.Bold(ctx.User.ToString()) + " " + GetText(strs.dice_rolled, Format.Code(gen.ToString()))).ConfigureAwait(false); } } @@ -128,8 +128,8 @@ namespace NadekoBot.Modules.Gambling await ctx.Channel.SendFileAsync(ms, $"dice.{format.FileExtensions.First()}", Format.Bold(ctx.User.ToString()) + " " + - GetText("dice_rolled_num", Format.Bold(values.Count.ToString())) + - " " + GetText("total_average", + 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("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("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 d8842c120..8ea122ba0 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("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 1a837dd7b..a2414fbdc 100644 --- a/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs +++ b/src/NadekoBot/Modules/Gambling/FlipCoinCommands.cs @@ -67,8 +67,8 @@ namespace NadekoBot.Modules.Gambling i.Dispose(); } var msg = count != 1 - ? Format.Bold(ctx.User.ToString()) + " " + GetText("flip_results", count, headCount, tailCount) - : Format.Bold(ctx.User.ToString()) + " " + GetText("flipped", headCount > 0 + ? 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))); await ctx.Channel.SendFileAsync(stream, $"{count} coins.{format.FileExtensions.First()}", msg).ConfigureAwait(false); @@ -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("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 5eaea3f39..16cd48594 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -196,7 +196,7 @@ namespace NadekoBot.Modules.Gambling } var embed = _eb.Create() - .WithTitle(GetText("transactions", + .WithTitle(GetText(strs.transactions, ((SocketGuild)ctx.Guild)?.GetUser(userId)?.ToString() ?? $"{userId}")) .WithOkColor(); @@ -209,7 +209,7 @@ namespace NadekoBot.Modules.Gambling } embed.WithDescription(desc); - embed.WithFooter(GetText("page", page + 1)); + embed.WithFooter(GetText(strs.page, page + 1)); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } @@ -476,11 +476,11 @@ namespace NadekoBot.Modules.Gambling var result = br.Roll(); - var str = Format.Bold(ctx.User.ToString()) + Format.Code(GetText("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); - str += GetText("br_win", + str += GetText(strs.br_win, n(win) + CurrencySign, result.Threshold + (result.Roll == 100 ? " šŸ‘‘" : "")); await _cs.AddAsync(ctx.User, "Betroll Gamble", @@ -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("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) || @@ -652,14 +652,14 @@ namespace NadekoBot.Modules.Gambling "Rps-win", amount, gamble: true).ConfigureAwait(false); embed.WithOkColor(); embed.AddField(GetText(strs.won), n(amount)); - msg = GetText("rps_win", ctx.User.Mention, + msg = GetText(strs.rps_win, ctx.User.Mention, getRpsPick(pick), getRpsPick(nadekoPick)); } else { embed.WithErrorColor(); amount = 0; - msg = GetText("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 aeca71ca9..be3b05c83 100644 --- a/src/NadekoBot/Modules/Gambling/ShopCommands.cs +++ b/src/NadekoBot/Modules/Gambling/ShopCommands.cs @@ -62,7 +62,7 @@ namespace NadekoBot.Modules.Gambling return _eb.Create().WithErrorColor() .WithDescription(GetText(strs.shop_none)); var embed = _eb.Create().WithOkColor() - .WithTitle(GetText("shop", CurrencySign)); + .WithTitle(GetText(strs.shop)); for (int i = 0; i < theseEntries.Length; i++) { @@ -173,7 +173,7 @@ namespace NadekoBot.Modules.Gambling { await (await ctx.User.GetOrCreateDMChannelAsync().ConfigureAwait(false)) .EmbedAsync(_eb.Create().WithOkColor() - .WithTitle(GetText("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("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("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("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("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 90199e8b8..eeedaa6fa 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("slot_single", CurrencySign, 1); + msg = GetText(strs.slot_single, CurrencySign, 1); else if (result.Multiplier == 4) - msg = GetText("slot_two", CurrencySign, 4); + msg = GetText(strs.slot_two, CurrencySign, 4); else if (result.Multiplier == 10) - msg = GetText("slot_three", 10); + msg = GetText(strs.slot_three, 10); else if (result.Multiplier == 30) - msg = GetText("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 6acb49b00..a5ccc387e 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("waifu_reset_price", Format.Bold(price + CurrencySign))); + .WithDescription(GetText(strs.waifu_reset_price, Format.Bold(price + CurrencySign))); if (!await PromptUserConfirmAsync(embed)) return; @@ -68,11 +68,11 @@ namespace NadekoBot.Modules.Gambling await ReplyErrorLocalizedAsync("not_enough", CurrencySign); return; } - var msg = GetText("waifu_claimed", + var msg = GetText(strs.waifu_claimed, Format.Bold(target.ToString()), amount + CurrencySign); if (w.Affinity?.UserId == ctx.User.Id) - msg += "\n" + GetText("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("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 130e3db99..666d90c40 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("acro_started", Format.Bold(string.Join(".", game.StartingLetters)))) - .WithFooter(GetText("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("acro_vote_cast", Format.Bold(user))); + GetText(strs.acro_vote_cast, Format.Bold(user))); } private async Task Game_OnVotingStarted(AcrophobiaGame game, ImmutableArray> submissions) @@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Games { await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor() .WithDescription( - GetText("acro_winner_only", + GetText(strs.acro_winner_only, Format.Bold(submissions.First().Key.UserName))) .WithFooter(submissions.First().Key.Input)) .ConfigureAwait(false); @@ -118,7 +118,7 @@ namespace NadekoBot.Modules.Games var embed = _eb.Create() .WithOkColor() .WithTitle(GetText(strs.acrophobia) + " - " + GetText(strs.submissions_closed)) - .WithDescription(GetText("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("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 e617be1a8..a76f07ed1 100644 --- a/src/NadekoBot/Modules/Games/Common/TicTacToe.cs +++ b/src/NadekoBot/Modules/Games/Common/TicTacToe.cs @@ -114,10 +114,10 @@ namespace NadekoBot.Modules.Games.Common if (_phase == Phase.Ended) embed.WithFooter(GetText(strs.ttt_no_moves)); else - embed.WithFooter(GetText("ttt_users_move", _users[_curUserIndex])); + embed.WithFooter(GetText(strs.ttt_users_move, _users[_curUserIndex])); } else - embed.WithFooter(GetText("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 e3c570046..bbc5294f3 100644 --- a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs +++ b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs @@ -246,7 +246,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia { var embedS = _eb.Create().WithOkColor() .WithTitle(GetText(strs.trivia_game)) - .WithDescription(GetText("trivia_win", + .WithDescription(GetText(strs.trivia_win, guildUser.Mention, Format.Bold(CurrentQuestion.Answer))); if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute)) @@ -264,7 +264,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia } var embed = _eb.Create().WithOkColor() .WithTitle(GetText(strs.trivia_game)) - .WithDescription(GetText("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 +283,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia foreach (var kvp in Users.OrderByDescending(kvp => kvp.Value)) { - sb.AppendLine(GetText("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 fb2ce1c83..3c8e29627 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("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 6b1952762..97a912712 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("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 @@ -109,14 +109,14 @@ namespace NadekoBot.Modules.Games for (int i = 0; i < stats.Length; i++) { var (Index, votes, Text) = stats[i]; - sb.AppendLine(GetText("poll_result", + sb.AppendLine(GetText(strs.poll_result, Index + 1, Format.Bold(Text), Format.Bold(votes.ToString()))); } return eb.WithDescription(sb.ToString()) - .WithFooter(GetText("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 855387310..d93125cfe 100644 --- a/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs +++ b/src/NadekoBot/Modules/Games/Services/ChatterbotService.cs @@ -122,7 +122,7 @@ namespace NadekoBot.Modules.Games.Services { if (pc.Verbose) { - var returnMsg = _strings.GetText("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/Games/Services/PollService.cs b/src/NadekoBot/Modules/Games/Services/PollService.cs index dc24ef5cf..e85685192 100644 --- a/src/NadekoBot/Modules/Games/Services/PollService.cs +++ b/src/NadekoBot/Modules/Games/Services/PollService.cs @@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Games.Services private async Task Pr_OnVoted(IUserMessage msg, IGuildUser usr) { - var toDelete = await msg.Channel.SendConfirmAsync(_eb, _strs.GetText("poll_voted", + var toDelete = await msg.Channel.SendConfirmAsync(_eb, _strs.GetText(strs.poll_voted, usr.Guild.Id, Format.Bold(usr.ToString()))) .ConfigureAwait(false); toDelete.DeleteAfter(5); diff --git a/src/NadekoBot/Modules/Help/Help.cs b/src/NadekoBot/Modules/Help/Help.cs index 8b69e9902..9d73a0e21 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("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("commands_instr", Prefix)); + embed.WithFooter(GetText(strs.commands_instr, Prefix)); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Help/Services/HelpService.cs b/src/NadekoBot/Modules/Help/Services/HelpService.cs index c97a3a0ed..dac5f5c53 100644 --- a/src/NadekoBot/Modules/Help/Services/HelpService.cs +++ b/src/NadekoBot/Modules/Help/Services/HelpService.cs @@ -78,7 +78,7 @@ namespace NadekoBot.Modules.Help.Services } em - .AddField(GetText("usage", guild), + .AddField(_strings.GetText(strs.usage), string.Join("\n", Array.ConvertAll(com.RealRemarksArr(_strings, guild?.Id, prefix), arg => Format.Code(arg))), false) diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/NadekoBot/Modules/Music/Music.cs index 047764b68..e5ad44aff 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("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("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("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 50160de89..8df96fe7c 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("playlists_page", num), MusicIconUrl) + .WithAuthor(GetText(strs.playlists_page, num), MusicIconUrl) .WithDescription(string.Join("\n", playlists.Select(r => - GetText("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("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 e53013a92..cf9f3becb 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("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/Permissions/Services/PermissionsService.cs b/src/NadekoBot/Modules/Permissions/Services/PermissionsService.cs index 871956303..44b670246 100644 --- a/src/NadekoBot/Modules/Permissions/Services/PermissionsService.cs +++ b/src/NadekoBot/Modules/Permissions/Services/PermissionsService.cs @@ -129,7 +129,7 @@ namespace NadekoBot.Modules.Permissions.Services try { await channel.SendErrorAsync(_eb, - _strings.GetText("perm_prevent", guild.Id, index + 1, + _strings.GetText(strs.perm_prevent, guild.Id, index + 1, Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), (SocketGuild) guild)))) .ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs b/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs index 49d1b6217..a4290f5e8 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("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 56d9e7c7b..dab3bbdec 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("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 bc813e167..c61c475eb 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("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 3e972bc77..b81d5dc58 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("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 623561013..013e440df 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("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/Searches/Services/AnimeSearchService.cs b/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs index 3dbc5a20f..973d4e3c6 100644 --- a/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs +++ b/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs @@ -50,6 +50,7 @@ namespace NadekoBot.Modules.Searches.Services } } + // todo fix novel public async Task GetNovelData(string query) { if (string.IsNullOrWhiteSpace(query)) diff --git a/src/NadekoBot/Modules/Utility/CalcCommands.cs b/src/NadekoBot/Modules/Utility/CalcCommands.cs index cbca29ca8..9f09a3e59 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("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 6308c1d14..f06db8fa3 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("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("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("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 6748acb80..b303f3529 100644 --- a/src/NadekoBot/Modules/Utility/InfoCommands.cs +++ b/src/NadekoBot/Modules/Utility/InfoCommands.cs @@ -135,16 +135,16 @@ namespace NadekoBot.Modules.Utility StringBuilder str = new StringBuilder(); foreach (var kvp in CmdHandler.UserMessagesSent.OrderByDescending(kvp => kvp.Value).Skip(page * activityPerPage).Take(activityPerPage)) { - str.AppendLine(GetText("activity_line", + str.AppendLine(GetText(strs.activity_line, ++startCount, Format.Bold(kvp.Key.ToString()), kvp.Value / _stats.GetUptime().TotalSeconds, kvp.Value)); } await ctx.Channel.EmbedAsync(_eb.Create() - .WithTitle(GetText("activity_page", page + 1)) + .WithTitle(GetText(strs.activity_page, page + 1)) .WithOkColor() - .WithFooter(GetText("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 1baae746b..724f55756 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("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 28c74597f..9ebfd4aac 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("clpa_fail_sup", helpcmd)) - .WithFooter(GetText("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 7715e1427..f7a69de2c 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("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("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("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("quote_deleted", id); + response = GetText(strs.quote_deleted, id); } } if (success) diff --git a/src/NadekoBot/Modules/Utility/RemindCommands.cs b/src/NadekoBot/Modules/Utility/RemindCommands.cs index 0af4bc6ea..c95860d28 100644 --- a/src/NadekoBot/Modules/Utility/RemindCommands.cs +++ b/src/NadekoBot/Modules/Utility/RemindCommands.cs @@ -190,7 +190,7 @@ namespace NadekoBot.Modules.Utility try { await SendConfirmAsync( - "ā° " + GetText("remind", + "ā° " + GetText(strs.remind, Format.Bold(!isPrivate ? $"<#{targetId}>" : ctx.User.Username), Format.Bold(message), $"{ts.Days}d {ts.Hours}h {ts.Minutes}min", diff --git a/src/NadekoBot/Modules/Utility/RepeatCommands.cs b/src/NadekoBot/Modules/Utility/RepeatCommands.cs index ac1bad2a3..6ca4e9566 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("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 300741f10..b6e4f36be 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("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 cfef8f605..a886f9455 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("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("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("roles_all_page", page), + await SendConfirmAsync(GetText(strs.roles_all_page, page), "\n• " + string.Join("\n• ", (IEnumerable)roles).SanitizeMentions(true)).ConfigureAwait(false); } } @@ -259,7 +259,7 @@ namespace NadekoBot.Modules.Utility .AddField(GetText(strs.owner_ids), ownerIds, true) .AddField(GetText(strs.uptime), _stats.GetUptimeString("\n"), true) .AddField(GetText(strs.presence), - GetText("presence_txt", + GetText(strs.presence_txt, _coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels), 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("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("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 894e0c550..849f379b7 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("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("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("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("club_leaderboard", page + 1)) + .WithTitle(GetText(strs.club_leaderboard, page + 1)) .WithOkColor(); var i = page * 9; diff --git a/src/NadekoBot/Modules/Xp/Services/XpService.cs b/src/NadekoBot/Modules/Xp/Services/XpService.cs index b4efaafe5..ea6f19fad 100644 --- a/src/NadekoBot/Modules/Xp/Services/XpService.cs +++ b/src/NadekoBot/Modules/Xp/Services/XpService.cs @@ -264,14 +264,14 @@ namespace NadekoBot.Modules.Xp.Services { var chan = await x.User.GetOrCreateDMChannelAsync(); if (chan != null) - await chan.SendConfirmAsync(_eb, _strings.GetText("level_up_dm", + await chan.SendConfirmAsync(_eb, _strings.GetText(strs.level_up_dm, x.Guild.Id, x.User.Mention, Format.Bold(x.Level.ToString()), Format.Bold(x.Guild.ToString() ?? "-"))); } else if (x.MessageChannel != null) // channel { - await x.MessageChannel.SendConfirmAsync(_eb, _strings.GetText("level_up_channel", + await x.MessageChannel.SendConfirmAsync(_eb, _strings.GetText(strs.level_up_channel, x.Guild.Id, x.User.Mention, Format.Bold(x.Level.ToString()))); } @@ -288,7 +288,7 @@ namespace NadekoBot.Modules.Xp.Services chan = x.MessageChannel; } - await chan.SendConfirmAsync(_eb, _strings.GetText("level_up_global", + await chan.SendConfirmAsync(_eb, _strings.GetText(strs.level_up_global, x.Guild.Id, x.User.Mention, Format.Bold(x.Level.ToString()))); } diff --git a/src/NadekoBot/Modules/Xp/Xp.cs b/src/NadekoBot/Modules/Xp/Xp.cs index 989024df0..e1a271ac9 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("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("xp_receive_role", Format.Bold(str)); + str = GetText(strs.xp_receive_role, Format.Bold(str)); else - str = GetText("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("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("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("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 2daa796e7..f4beb54a6 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -377,21 +377,14 @@ namespace NadekoBot.Extensions return msg.Content.Headers.ContentLength / 1.MB(); } - public static string GetText(this IBotStrings strings, LocStr str, ulong? guildId = null) - => strings.GetText(str.Key, guildId); - - public static string GetText(this IBotStrings strings, LocStr str, CultureInfo 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, 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, LocStr str, ulong? guildId, T obj1) - => strings.GetText(str.Key, guildId, obj1); - - public static string GetText(this IBotStrings strings, LocStr str, CultureInfo culture, T obj1) - => strings.GetText(str.Key, culture, obj1); - - public static string GetText(this IBotStrings strings, LocStr str, ulong? guildId, T1 obj1, T2 obj2) - => strings.GetText(str.Key, guildId, obj1, obj2); - public static string GetText(this IBotStrings strings, LocStr str, CultureInfo culture, T1 obj1, T2 obj2) - => strings.GetText(str.Key, culture, obj1, obj2); } }