Second iteration of source generated localized strings

- Strs renamed to strs
- Generic params will now default to object instead of string for convenient argument passing
- Many strings changed to use generated properties
This commit is contained in:
Kwoth
2021-07-24 20:41:07 +02:00
parent 34d0f66466
commit 70288f7670
63 changed files with 410 additions and 363 deletions

View File

@@ -73,6 +73,19 @@ namespace NadekoBot.Generators
public static implicit operator LocStr<T1, T2, T3>(string data)
=> new LocStr<T1, T2, T3>(data);
}
public readonly ref struct LocStr<T1, T2, T3, T4>
{
public readonly string Key;
public LocStr(string key)
{
Key = key;
}
public static implicit operator LocStr<T1, T2, T3, T4>(string data)
=> new LocStr<T1, T2, T3, T4>(data);
}
}";
public void Initialize(GeneratorInitializationContext context)
@@ -93,7 +106,7 @@ namespace NadekoBot.Generators
sw.WriteLine("{");
sw.Indent++;
sw.WriteLine("public static class Strs");
sw.WriteLine("public static class strs");
sw.WriteLine("{");
sw.Indent++;
@@ -109,7 +122,7 @@ namespace NadekoBot.Generators
sw.Flush();
context.AddSource("Strs.cs", stringWriter.ToString());
context.AddSource("strs.cs", stringWriter.ToString());
}
context.AddSource("LocStr.cs", LocStrSource);
@@ -138,20 +151,23 @@ namespace NadekoBot.Generators
private string GetFieldType(string value)
{
var matches = Regex.Matches(value, @"{(?<num>\d)}");
int max = 0;
int max = -1;
foreach (Match match in matches)
{
max = Math.Max(max, int.Parse(match.Groups["num"].Value));
}
max += 1;
if (max == 0)
return "LocStr";
if (max == 1)
return "LocStr<string>";
return "LocStr<object>";
if (max == 2)
return "LocStr<string, string>";
return "LocStr<object, object>";
if (max == 3)
return "LocStr<string, string, string>";
return "LocStr<object, object, object>";
if (max == 4)
return "LocStr<object, object, object, object>";
return "!Error";
}

View File

@@ -29,11 +29,12 @@ namespace NadekoBot.Modules
_cultureInfo = Localization.GetCultureInfo(ctx.Guild?.Id);
}
// todo remove
protected string GetText(string key) =>
Strings.GetText(key, _cultureInfo);
protected string GetText(in LocStr key) =>
Strings.GetText(key.Key, _cultureInfo);
Strings.GetText(key, _cultureInfo);
protected string GetText(string key, params object[] args) =>
Strings.GetText(key, _cultureInfo, args);

View File

@@ -52,7 +52,7 @@ namespace NadekoBot.Modules.Administration
var embed = _eb.Create()
.WithOkColor()
.WithTitle(GetText("server_delmsgoncmd"))
.WithTitle(GetText(strs.server_delmsgoncmd))
.WithDescription(enabled ? "✅" : "❌");
var str = string.Join("\n", channels
@@ -67,7 +67,7 @@ namespace NadekoBot.Modules.Administration
if (string.IsNullOrWhiteSpace(str))
str = "-";
embed.AddField(GetText("channel_delmsgoncmd"), str);
embed.AddField(GetText(strs.channel_delmsgoncmd), str);
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}

View File

@@ -23,7 +23,7 @@ namespace NadekoBot.Modules.Administration
try
{
var embed = _eb.Create()
.WithTitle(GetText("sql_confirm_exec"))
.WithTitle(GetText(strs.sql_confirm_exec))
.WithDescription(Format.Code(sql));
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))

View File

@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Administration
{
var result = await PromptUserConfirmAsync(_eb.Create()
.WithOkColor()
.WithDescription(GetText("perm_override_all_confirm")));
.WithDescription(GetText(strs.perm_override_all_confirm)));
if (!result)
return;
@@ -65,7 +65,7 @@ namespace NadekoBot.Modules.Administration
await ctx.SendPaginatedConfirmAsync(page, curPage =>
{
var eb = _eb.Create()
.WithTitle(GetText("perm_overrides"))
.WithTitle(GetText(strs.perm_overrides))
.WithOkColor();
var thisPageOverrides = overrides
@@ -74,7 +74,7 @@ namespace NadekoBot.Modules.Administration
.ToList();
if (thisPageOverrides.Count == 0)
eb.WithDescription(GetText("perm_override_page_none"));
eb.WithDescription(GetText(strs.perm_override_page_none));
else
eb.WithDescription(string.Join("\n",
thisPageOverrides.Select(ov => $"{ov.Command} => {ov.Perm.ToString()}")));

View File

@@ -123,7 +123,7 @@ namespace NadekoBot.Modules.Administration
public async Task LanguagesList()
{
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithTitle(GetText("lang_list"))
.WithTitle(GetText(strs.lang_list))
.WithDescription(string.Join("\n",
supportedLocales.Select(x => $"{Format.Code(x.Key),-10} => {x.Value}")))).ConfigureAwait(false);
}

View File

@@ -69,7 +69,7 @@ namespace NadekoBot.Modules.Administration
return Format.Bold(x);
}));
await SendConfirmAsync(Format.Bold(GetText("log_events")) + "\n" +
await SendConfirmAsync(Format.Bold(GetText(strs.log_events)) + "\n" +
str)
.ConfigureAwait(false);
}

View File

@@ -232,7 +232,7 @@ namespace NadekoBot.Modules.Administration
}
var embed = _eb.Create().WithOkColor()
.WithTitle(GetText("prot_active"));
.WithTitle(GetText(strs.prot_active));
if (spam != null)
embed.AddField("Anti-Spam", GetAntiSpamString(spam).TrimTo(1024), true);

View File

@@ -135,7 +135,7 @@ namespace NadekoBot.Modules.Administration
if (!_service.Get(ctx.Guild.Id, out var rrs) ||
!rrs.Any())
{
embed.WithDescription(GetText("no_reaction_roles"));
embed.WithDescription(GetText(strs.no_reaction_roles));
}
else
{

View File

@@ -158,8 +158,8 @@ namespace NadekoBot.Modules.Administration
.WithTitle(Format.Bold(GetText("self_assign_list", roles.Count())))
.WithDescription(rolesStr.ToString())
.WithFooter(exclusive
? GetText("self_assign_are_exclusive")
: GetText("self_assign_are_not_exclusive"));
? GetText(strs.self_assign_are_exclusive)
: GetText(strs.self_assign_are_not_exclusive));
}, roles.Count(), 20).ConfigureAwait(false);
}

View File

@@ -56,10 +56,10 @@ namespace NadekoBot.Modules.Administration
_service.AddNewAutoCommand(cmd);
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithTitle(GetText("scadd"))
.AddField(GetText("server"), cmd.GuildId is null ? $"-" : $"{cmd.GuildName}/{cmd.GuildId}", true)
.AddField(GetText("channel"), $"{cmd.ChannelName}/{cmd.ChannelId}", true)
.AddField(GetText("command_text"), cmdText, false));
.WithTitle(GetText(strs.scadd))
.AddField(GetText(strs.server), cmd.GuildId is null ? $"-" : $"{cmd.GuildName}/{cmd.GuildId}", true)
.AddField(GetText(strs.channel), $"{cmd.ChannelName}/{cmd.ChannelId}", true)
.AddField(GetText(strs.command_text), cmdText, false));
}
[NadekoCommand, Aliases]
@@ -115,9 +115,9 @@ namespace NadekoBot.Modules.Administration
text: string.Join("\n", scmds
.Select(x => $@"```css
#{++i + page * 5}
[{GetText("server")}]: {(x.GuildId.HasValue ? $"{x.GuildName} #{x.GuildId}" : "-")}
[{GetText("channel")}]: {x.ChannelName} #{x.ChannelId}
[{GetText("command_text")}]: {x.CommandText}```")),
[{GetText(strs.server)}]: {(x.GuildId.HasValue ? $"{x.GuildName} #{x.GuildId}" : "-")}
[{GetText(strs.channel)}]: {x.ChannelName} #{x.ChannelId}
[{GetText(strs.command_text)}]: {x.CommandText}```")),
title: string.Empty,
footer: GetText("page", page + 1))
.ConfigureAwait(false);
@@ -147,10 +147,10 @@ namespace NadekoBot.Modules.Administration
text: string.Join("\n", scmds
.Select(x => $@"```css
#{++i + page * 5}
[{GetText("server")}]: {(x.GuildId.HasValue ? $"{x.GuildName} #{x.GuildId}" : "-")}
[{GetText("channel")}]: {x.ChannelName} #{x.ChannelId}
[{GetText(strs.server)}]: {(x.GuildId.HasValue ? $"{x.GuildName} #{x.GuildId}" : "-")}
[{GetText(strs.channel)}]: {x.ChannelName} #{x.ChannelId}
{GetIntervalText(x.Interval)}
[{GetText("command_text")}]: {x.CommandText}```")),
[{GetText(strs.command_text)}]: {x.CommandText}```")),
title: string.Empty,
footer: GetText("page", page + 1))
.ConfigureAwait(false);
@@ -159,7 +159,7 @@ namespace NadekoBot.Modules.Administration
private string GetIntervalText(int interval)
{
return $"[{GetText("interval")}]: {interval}";
return $"[{GetText(strs.interval)}]: {interval}";
}
[NadekoCommand, Aliases]
@@ -273,7 +273,7 @@ namespace NadekoBot.Modules.Administration
var str = string.Join("\n", allShardStrings.Skip(25 * curPage).Take(25));
if (string.IsNullOrWhiteSpace(str))
str = GetText("no_shards_on_page");
str = GetText(strs.no_shards_on_page);
return _eb.Create()
.WithOkColor()

View File

@@ -238,10 +238,10 @@ namespace NadekoBot.Modules.Administration.Services
var bs = _bss.Data;
if (msg.Channel is IDMChannel && bs.ForwardMessages && ownerChannels.Any())
{
var title = _strings.GetText("dm_from") +
var title = _strings.GetText(strs.dm_from) +
$" [{msg.Author}]({msg.Author.Id})";
var attachamentsTxt = _strings.GetText("attachments");
var attachamentsTxt = _strings.GetText(strs.attachments);
var toSend = msg.Content;

View File

@@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Administration
await ctx.SendPaginatedConfirmAsync(page,
(curPage) => _eb.Create()
.WithOkColor()
.WithTitle(GetText("timezones_available"))
.WithTitle(GetText(strs.timezones_available))
.WithDescription(string.Join("\n", timezoneStrings
.Skip(curPage * timezonesPerPage)
.Take(timezonesPerPage))),

View File

@@ -62,8 +62,8 @@ namespace NadekoBot.Modules.Administration
{
await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).EmbedAsync(_eb.Create().WithErrorColor()
.WithDescription(GetText("warned_on", ctx.Guild.ToString()))
.AddField(GetText("moderator"), ctx.User.ToString())
.AddField(GetText("reason"), reason ?? "-"))
.AddField(GetText(strs.moderator), ctx.User.ToString())
.AddField(GetText(strs.reason), reason ?? "-"))
.ConfigureAwait(false);
}
catch
@@ -81,11 +81,11 @@ namespace NadekoBot.Modules.Administration
Log.Warning(ex.Message);
var errorEmbed = _eb.Create()
.WithErrorColor()
.WithDescription(GetText("cant_apply_punishment"));
.WithDescription(GetText(strs.cant_apply_punishment));
if (dmFailed)
{
errorEmbed.WithFooter("⚠️ " + GetText("unable_to_dm_user"));
errorEmbed.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
}
await ctx.Channel.EmbedAsync(errorEmbed);
@@ -107,7 +107,7 @@ namespace NadekoBot.Modules.Administration
if (dmFailed)
{
embed.WithFooter("⚠️ " + GetText("unable_to_dm_user"));
embed.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
}
await ctx.Channel.EmbedAsync(embed);
@@ -225,7 +225,7 @@ namespace NadekoBot.Modules.Administration
if (!warnings.Any())
{
embed.WithDescription(GetText("warnings_none"));
embed.WithDescription(GetText(strs.warnings_none));
}
else
{
@@ -273,7 +273,7 @@ namespace NadekoBot.Modules.Administration
});
return _eb.Create().WithOkColor()
.WithTitle(GetText("warnings_list"))
.WithTitle(GetText(strs.warnings_list))
.WithDescription(string.Join("\n", ws));
}, warnings.Length, 15).ConfigureAwait(false);
}
@@ -408,10 +408,10 @@ namespace NadekoBot.Modules.Administration
}
else
{
list = GetText("warnpl_none");
list = GetText(strs.warnpl_none);
}
await SendConfirmAsync(
GetText("warn_punish_list"),
GetText(strs.warn_punish_list),
list).ConfigureAwait(false);
}
@@ -452,14 +452,14 @@ namespace NadekoBot.Modules.Administration
await _mute.TimedBan(ctx.Guild, user, time.Time, ctx.User.ToString() + " | " + msg).ConfigureAwait(false);
var toSend = _eb.Create().WithOkColor()
.WithTitle("⛔️ " + GetText("banned_user"))
.AddField(GetText("username"), user.ToString(), true)
.WithTitle("⛔️ " + GetText(strs.banned_user))
.AddField(GetText(strs.username), user.ToString(), true)
.AddField("ID", user.Id.ToString(), true)
.AddField(GetText("duration"), $"{time.Time.Days}d {time.Time.Hours}h {time.Time.Minutes}m", true);
.AddField(GetText(strs.duration), $"{time.Time.Days}d {time.Time.Hours}h {time.Time.Minutes}m", true);
if (dmFailed)
{
toSend.WithFooter("⚠️ " + GetText("unable_to_dm_user"));
toSend.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
}
await ctx.Channel.EmbedAsync(toSend)
@@ -479,7 +479,7 @@ namespace NadekoBot.Modules.Administration
await ctx.Guild.AddBanAsync(userId, 7, ctx.User.ToString() + " | " + msg);
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithTitle("⛔️ " + GetText("banned_user"))
.WithTitle("⛔️ " + GetText(strs.banned_user))
.AddField("ID", userId.ToString(), true))
.ConfigureAwait(false);
}
@@ -519,13 +519,13 @@ namespace NadekoBot.Modules.Administration
await ctx.Guild.AddBanAsync(user, 7, ctx.User.ToString() + " | " + msg).ConfigureAwait(false);
var toSend = _eb.Create().WithOkColor()
.WithTitle("⛔️ " + GetText("banned_user"))
.AddField(GetText("username"), user.ToString(), true)
.WithTitle("⛔️ " + GetText(strs.banned_user))
.AddField(GetText(strs.username), user.ToString(), true)
.AddField("ID", user.Id.ToString(), true);
if (dmFailed)
{
toSend.WithFooter("⚠️ " + GetText("unable_to_dm_user"));
toSend.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
}
await ctx.Channel.EmbedAsync(toSend)
@@ -697,13 +697,13 @@ namespace NadekoBot.Modules.Administration
catch { await ctx.Guild.RemoveBanAsync(user).ConfigureAwait(false); }
var toSend = _eb.Create().WithOkColor()
.WithTitle("☣ " + GetText("sb_user"))
.AddField(GetText("username"), user.ToString(), true)
.WithTitle("☣ " + GetText(strs.sb_user))
.AddField(GetText(strs.username), user.ToString(), true)
.AddField("ID", user.Id.ToString(), true);
if (dmFailed)
{
toSend.WithFooter("⚠️ " + GetText("unable_to_dm_user"));
toSend.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
}
await ctx.Channel.EmbedAsync(toSend)
@@ -752,13 +752,13 @@ namespace NadekoBot.Modules.Administration
await user.KickAsync(ctx.User.ToString() + " | " + msg).ConfigureAwait(false);
var toSend = _eb.Create().WithOkColor()
.WithTitle(GetText("kicked_user"))
.AddField(GetText("username"), user.ToString(), true)
.WithTitle(GetText(strs.kicked_user))
.AddField(GetText(strs.username), user.ToString(), true)
.AddField("ID", user.Id.ToString(), true);
if (dmFailed)
{
toSend.WithFooter("⚠️ " + GetText("unable_to_dm_user"));
toSend.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
}
await ctx.Channel.EmbedAsync(toSend)

View File

@@ -71,7 +71,7 @@ namespace NadekoBot.Modules.Administration
{
if (!roles.Any())
{
text = GetText("no_vcroles");
text = GetText(strs.no_vcroles);
}
else
{
@@ -81,10 +81,10 @@ namespace NadekoBot.Modules.Administration
}
else
{
text = GetText("no_vcroles");
text = GetText(strs.no_vcroles);
}
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithTitle(GetText("vc_role_list"))
.WithTitle(GetText(strs.vc_role_list))
.WithDescription(text))
.ConfigureAwait(false);
}

View File

@@ -42,10 +42,10 @@ namespace NadekoBot.Modules.CustomReactions
var cr = await _service.AddAsync(ctx.Guild?.Id, key, message);
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithTitle(GetText("new_cust_react"))
.WithTitle(GetText(strs.new_cust_react))
.WithDescription($"#{(kwum)cr.Id}")
.AddField(GetText("trigger"), key)
.AddField(GetText("response"), message.Length > 1024 ? GetText("redacted_too_long") : message)
.AddField(GetText(strs.trigger), key)
.AddField(GetText(strs.response), message.Length > 1024 ? GetText(strs.redacted_too_long) : message)
).ConfigureAwait(false);
}
@@ -66,10 +66,10 @@ namespace NadekoBot.Modules.CustomReactions
if (cr != null)
{
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithTitle(GetText("edited_cust_react"))
.WithTitle(GetText(strs.edited_cust_react))
.WithDescription($"#{id}")
.AddField(GetText("trigger"), cr.Trigger)
.AddField(GetText("response"), message.Length > 1024 ? GetText("redacted_too_long") : message)
.AddField(GetText(strs.trigger), cr.Trigger)
.AddField(GetText(strs.response), message.Length > 1024 ? GetText(strs.redacted_too_long) : message)
).ConfigureAwait(false);
}
else
@@ -108,7 +108,7 @@ namespace NadekoBot.Modules.CustomReactions
.JoinWith('\n');
return _eb.Create().WithOkColor()
.WithTitle(GetText("custom_reactions"))
.WithTitle(GetText(strs.custom_reactions))
.WithDescription(desc);
}, customReactions.Length, 20);
@@ -148,8 +148,8 @@ namespace NadekoBot.Modules.CustomReactions
{
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithDescription($"#{id}")
.AddField(GetText("trigger"), found.Trigger.TrimTo(1024))
.AddField(GetText("response"), (found.Response + "\n```css\n" + found.Response).TrimTo(1020) + "```")
.AddField(GetText(strs.trigger), found.Trigger.TrimTo(1024))
.AddField(GetText(strs.response), (found.Response + "\n```css\n" + found.Response).TrimTo(1020) + "```")
).ConfigureAwait(false);
}
}
@@ -168,10 +168,10 @@ namespace NadekoBot.Modules.CustomReactions
if (cr != null)
{
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithTitle(GetText("deleted"))
.WithTitle(GetText(strs.deleted))
.WithDescription($"#{id}")
.AddField(GetText("trigger"), cr.Trigger.TrimTo(1024))
.AddField(GetText("response"), cr.Response.TrimTo(1024))).ConfigureAwait(false);
.AddField(GetText(strs.trigger), cr.Trigger.TrimTo(1024))
.AddField(GetText(strs.response), cr.Response.TrimTo(1024))).ConfigureAwait(false);
}
else
{

View File

@@ -45,7 +45,7 @@ namespace NadekoBot.Modules.Gambling
var ar = new AnimalRace(options, _cs, _gamesConf.Data.RaceAnimals.Shuffle());
if (!_service.AnimalRaces.TryAdd(ctx.Guild.Id, ar))
return SendErrorAsync(GetText("animal_race"), GetText("animal_race_already_started"));
return SendErrorAsync(GetText(strs.animal_race), GetText(strs.animal_race_already_started));
ar.Initialize();
@@ -76,13 +76,13 @@ namespace NadekoBot.Modules.Gambling
var winner = race.FinishedUsers[0];
if (race.FinishedUsers[0].Bet > 0)
{
return SendConfirmAsync(GetText("animal_race"),
return SendConfirmAsync(GetText(strs.animal_race),
GetText("animal_race_won_money", Format.Bold(winner.Username),
winner.Animal.Icon, (race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign));
}
else
{
return SendConfirmAsync(GetText("animal_race"),
return SendConfirmAsync(GetText(strs.animal_race),
GetText("animal_race_won", Format.Bold(winner.Username), winner.Animal.Icon));
}
}
@@ -93,16 +93,16 @@ namespace NadekoBot.Modules.Gambling
ar.OnStarted += Ar_OnStarted;
_client.MessageReceived += _client_MessageReceived;
return SendConfirmAsync(GetText("animal_race"), GetText("animal_race_starting", options.StartTime),
return SendConfirmAsync(GetText(strs.animal_race), GetText("animal_race_starting", options.StartTime),
footer: GetText("animal_race_join_instr", Prefix));
}
private Task Ar_OnStarted(AnimalRace race)
{
if (race.Users.Count == race.MaxUsers)
return SendConfirmAsync(GetText("animal_race"), GetText("animal_race_full"));
return SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_full));
else
return SendConfirmAsync(GetText("animal_race"), GetText("animal_race_starting_with_x", race.Users.Count));
return SendConfirmAsync(GetText(strs.animal_race), GetText("animal_race_starting_with_x", race.Users.Count));
}
private async Task Ar_OnStateUpdate(AnimalRace race)
@@ -123,7 +123,7 @@ namespace NadekoBot.Modules.Gambling
.ConfigureAwait(false);
else
await msg.ModifyAsync(x => x.Embed = _eb.Create()
.WithTitle(GetText("animal_race"))
.WithTitle(GetText(strs.animal_race))
.WithDescription(text)
.WithOkColor()
.Build())
@@ -171,7 +171,7 @@ namespace NadekoBot.Modules.Gambling
}
catch (AnimalRaceFullException)
{
await SendConfirmAsync(GetText("animal_race"), GetText("animal_race_full"))
await SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_full))
.ConfigureAwait(false);
}
catch (NotEnoughFundsException)

View File

@@ -136,7 +136,7 @@ namespace NadekoBot.Modules.Gambling
title = GetText("connect4_won", Format.Bold(arg.OtherPlayer.Username), Format.Bold(arg.CurrentPlayer.Username));
}
else
title = GetText("connect4_draw");
title = GetText(strs.connect4_draw);
return msg.ModifyAsync(x => x.Embed = _eb.Create()
.WithTitle(title)

View File

@@ -69,8 +69,8 @@ namespace NadekoBot.Modules.Gambling
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(GetText("heads"))
: Format.Bold(GetText("tails")));
? Format.Bold(GetText(strs.heads))
: Format.Bold(GetText(strs.tails)));
await ctx.Channel.SendFileAsync(stream, $"{count} coins.{format.FileExtensions.First()}", msg).ConfigureAwait(false);
}
}
@@ -120,7 +120,7 @@ namespace NadekoBot.Modules.Gambling
}
else
{
str = ctx.User.ToString() + " " + GetText("better_luck");
str = ctx.User.ToString() + " " + GetText(strs.better_luck);
}
await ctx.Channel.EmbedAsync(_eb.Create()

View File

@@ -65,13 +65,13 @@ namespace NadekoBot.Modules.Gambling
// [21:03] Bob Page: Kinda remids me of US economy
}
var embed = _eb.Create()
.WithTitle(GetText("economy_state"))
.AddField(GetText("currency_owned"), ((BigInteger)(ec.Cash - ec.Bot)) + CurrencySign)
.AddField(GetText("currency_one_percent"), (onePercent * 100).ToString("F2") + "%")
.AddField(GetText("currency_planted"), ((BigInteger)ec.Planted) + CurrencySign)
.AddField(GetText("owned_waifus_total"), ((BigInteger)ec.Waifus) + CurrencySign)
.AddField(GetText("bot_currency"), ec.Bot + CurrencySign)
.AddField(GetText("total"), ((BigInteger)(ec.Cash + ec.Planted + ec.Waifus)).ToString("N", _enUsCulture) + CurrencySign)
.WithTitle(GetText(strs.economy_state))
.AddField(GetText(strs.currency_owned), ((BigInteger)(ec.Cash - ec.Bot)) + CurrencySign)
.AddField(GetText(strs.currency_one_percent), (onePercent * 100).ToString("F2") + "%")
.AddField(GetText(strs.currency_planted), ((BigInteger)ec.Planted) + CurrencySign)
.AddField(GetText(strs.owned_waifus_total), ((BigInteger)ec.Waifus) + CurrencySign)
.AddField(GetText(strs.bot_currency), ec.Bot + CurrencySign)
.AddField(GetText(strs.total), ((BigInteger)(ec.Cash + ec.Planted + ec.Waifus)).ToString("N", _enUsCulture) + CurrencySign)
.WithOkColor();
// ec.Cash already contains ec.Bot as it's the total of all values in the CurrencyAmount column of the DiscordUser table
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
@@ -140,7 +140,7 @@ namespace NadekoBot.Modules.Gambling
return;
}
var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)];
await SendConfirmAsync("🎟 " + GetText("raffled_user"), $"**{usr.Username}#{usr.Discriminator}**", footer: $"ID: {usr.Id}").ConfigureAwait(false);
await SendConfirmAsync("🎟 " + GetText(strs.raffled_user), $"**{usr.Username}#{usr.Discriminator}**", footer: $"ID: {usr.Id}").ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -156,7 +156,7 @@ namespace NadekoBot.Modules.Gambling
return;
}
var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)];
await SendConfirmAsync("🎟 " + GetText("raffled_user"), $"**{usr.Username}#{usr.Discriminator}**", footer: $"ID: {usr.Id}").ConfigureAwait(false);
await SendConfirmAsync("🎟 " + GetText(strs.raffled_user), $"**{usr.Username}#{usr.Discriminator}**", footer: $"ID: {usr.Id}").ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -375,7 +375,7 @@ namespace NadekoBot.Modules.Gambling
var embed = _eb.Create()
.WithOkColor()
.WithTitle(GetText("roll_duel"));
.WithTitle(GetText(strs.roll_duel));
var description = string.Empty;
@@ -488,7 +488,7 @@ namespace NadekoBot.Modules.Gambling
}
else
{
str += GetText("better_luck");
str += GetText(strs.better_luck);
}
await SendConfirmAsync(str).ConfigureAwait(false);
@@ -549,7 +549,7 @@ namespace NadekoBot.Modules.Gambling
{
var embed = _eb.Create()
.WithOkColor()
.WithTitle(CurrencySign + " " + GetText("leaderboard"));
.WithTitle(CurrencySign + " " + GetText(strs.leaderboard));
List<DiscordUser> toSend;
if (!opts.Clean)
@@ -565,7 +565,7 @@ namespace NadekoBot.Modules.Gambling
}
if (!toSend.Any())
{
embed.WithDescription(GetText("no_user_on_this_page"));
embed.WithDescription(GetText(strs.no_user_on_this_page));
return embed;
}
@@ -651,7 +651,7 @@ namespace NadekoBot.Modules.Gambling
await _cs.AddAsync(ctx.User.Id,
"Rps-win", amount, gamble: true).ConfigureAwait(false);
embed.WithOkColor();
embed.AddField(GetText("won"), n(amount));
embed.AddField(GetText(strs.won), n(amount));
msg = GetText("rps_win", ctx.User.Mention,
getRpsPick(pick), getRpsPick(nadekoPick));
}

View File

@@ -60,7 +60,7 @@ namespace NadekoBot.Modules.Gambling
if (!theseEntries.Any())
return _eb.Create().WithErrorColor()
.WithDescription(GetText("shop_none"));
.WithDescription(GetText(strs.shop_none));
var embed = _eb.Create().WithOkColor()
.WithTitle(GetText("shop", CurrencySign));
@@ -174,9 +174,9 @@ namespace NadekoBot.Modules.Gambling
await (await ctx.User.GetOrCreateDMChannelAsync().ConfigureAwait(false))
.EmbedAsync(_eb.Create().WithOkColor()
.WithTitle(GetText("shop_purchase", ctx.Guild.Name))
.AddField(GetText("item"), item.Text, false)
.AddField(GetText("price"), entry.Price.ToString(), true)
.AddField(GetText("name"), entry.Name, true))
.AddField(GetText(strs.item), item.Text, false)
.AddField(GetText(strs.price), entry.Price.ToString(), true)
.AddField(GetText(strs.name), entry.Name, true))
.ConfigureAwait(false);
await _cs.AddAsync(entry.AuthorId,
@@ -246,7 +246,7 @@ namespace NadekoBot.Modules.Gambling
uow.SaveChanges();
}
await ctx.Channel.EmbedAsync(EntryToEmbed(entry)
.WithTitle(GetText("shop_item_add"))).ConfigureAwait(false);
.WithTitle(GetText(strs.shop_item_add))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -274,7 +274,7 @@ namespace NadekoBot.Modules.Gambling
uow.SaveChanges();
}
await ctx.Channel.EmbedAsync(EntryToEmbed(entry)
.WithTitle(GetText("shop_item_add"))).ConfigureAwait(false);
.WithTitle(GetText(strs.shop_item_add))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -345,7 +345,7 @@ namespace NadekoBot.Modules.Gambling
await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
else
await ctx.Channel.EmbedAsync(EntryToEmbed(removed)
.WithTitle(GetText("shop_item_rm"))).ConfigureAwait(false);
.WithTitle(GetText(strs.shop_item_rm))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -433,17 +433,17 @@ namespace NadekoBot.Modules.Gambling
var embed = _eb.Create().WithOkColor();
if (entry.Type == ShopEntryType.Role)
return embed.AddField(GetText("name"), GetText("shop_role", Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE")), true)
.AddField(GetText("price"), entry.Price.ToString(), true)
.AddField(GetText("type"), entry.Type.ToString(), true);
return embed.AddField(GetText(strs.name), GetText("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)
return embed.AddField(GetText("name"), entry.Name, true)
.AddField(GetText("price"), entry.Price.ToString(), true)
.AddField(GetText("type"), GetText("random_unique_item"), true);
return embed.AddField(GetText(strs.name), entry.Name, true)
.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("name"), GetText("shop_role", Format.Bold(entry.RoleName)), true)
// .AddField(GetText("price"), entry.Price.ToString(), true)
// .AddField(GetText("type"), entry.Type.ToString(), true);
// return embed.AddField(GetText(strs.name), GetText("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;
}

View File

@@ -197,7 +197,7 @@ namespace NadekoBot.Modules.Gambling
n++;
} while ((printAmount /= 10) != 0);
var msg = GetText("better_luck");
var msg = GetText(strs.better_luck);
if (result.Multiplier != 0)
{
await _cs.AddAsync(ctx.User, $"Slot Machine x{result.Multiplier}", amount * result.Multiplier, false, gamble: true).ConfigureAwait(false);
@@ -214,7 +214,7 @@ namespace NadekoBot.Modules.Gambling
using (var imgStream = bgImage.ToStream())
{
await ctx.Channel.SendFileAsync(imgStream, "result.png", ctx.User.Mention + " " + msg + $"\n`{GetText("slot_bet")}:`{amount} `{GetText("won")}:` {amount * result.Multiplier}{CurrencySign}").ConfigureAwait(false);
await ctx.Channel.SendFileAsync(imgStream, "result.png", ctx.User.Mention + " " + msg + $"\n`{GetText(strs.slot_bet)}:`{amount} `{GetText(strs.won)}:` {amount * result.Multiplier}{CurrencySign}").ConfigureAwait(false);
}
}
}

View File

@@ -26,7 +26,7 @@ namespace NadekoBot.Modules.Gambling
{
var price = _service.GetResetPrice(ctx.User);
var embed = _eb.Create()
.WithTitle(GetText("waifu_reset_confirm"))
.WithTitle(GetText(strs.waifu_reset_confirm))
.WithDescription(GetText("waifu_reset_price", Format.Bold(price + CurrencySign)));
if (!await PromptUserConfirmAsync(embed))
@@ -222,7 +222,7 @@ namespace NadekoBot.Modules.Gambling
}
var embed = _eb.Create()
.WithTitle(GetText("waifus_top_waifus"))
.WithTitle(GetText(strs.waifus_top_waifus))
.WithOkColor();
var i = 0;
@@ -261,7 +261,7 @@ namespace NadekoBot.Modules.Gambling
.ToDictionary(x => x.ItemEmoji, x => x);
var nobody = GetText("nobody");
var nobody = GetText(strs.nobody);
var itemsStr = !wi.Items.Any()
? "-"
: string.Join("\n", wi.Items
@@ -284,19 +284,19 @@ namespace NadekoBot.Modules.Gambling
var embed = _eb.Create()
.WithOkColor()
.WithTitle(GetText("waifu") + " " + (wi.FullName ?? name ?? targetId.ToString()) + " - \"the " +
.WithTitle(GetText(strs.waifu) + " " + (wi.FullName ?? name ?? targetId.ToString()) + " - \"the " +
_service.GetClaimTitle(wi.ClaimCount) + "\"")
.AddField(GetText("price"), wi.Price.ToString(), true)
.AddField(GetText("claimed_by"), wi.ClaimerName ?? nobody, true)
.AddField(GetText("likes"), wi.AffinityName ?? nobody, true)
.AddField(GetText("changes_of_heart"), $"{wi.AffinityCount} - \"the {affInfo}\"", true)
.AddField(GetText("divorces"), wi.DivorceCount.ToString(), true)
.AddField(GetText(strs.price), wi.Price.ToString(), true)
.AddField(GetText(strs.claimed_by), wi.ClaimerName ?? nobody, true)
.AddField(GetText(strs.likes), wi.AffinityName ?? nobody, true)
.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($"Waifus ({wi.ClaimCount})", wi.ClaimCount == 0
? nobody
: string.Join("\n", wi.Claims.Shuffle().Take(30)), true)
.AddField(GetText("gifts"), itemsStr, true);
.AddField(GetText(strs.gifts), itemsStr, true);
return ctx.Channel.EmbedAsync(embed);
}
@@ -313,7 +313,7 @@ namespace NadekoBot.Modules.Gambling
await ctx.SendPaginatedConfirmAsync(page, (cur) =>
{
var embed = _eb.Create()
.WithTitle(GetText("waifu_gift_shop"))
.WithTitle(GetText(strs.waifu_gift_shop))
.WithOkColor();
waifuItems

View File

@@ -81,7 +81,7 @@ namespace NadekoBot.Modules.Games
private Task Game_OnStarted(AcrophobiaGame game)
{
var embed = _eb.Create().WithOkColor()
.WithTitle(GetText("acrophobia"))
.WithTitle(GetText(strs.acrophobia))
.WithDescription(GetText("acro_started", Format.Bold(string.Join(".", game.StartingLetters))))
.WithFooter(GetText("acro_started_footer", game.Opts.SubmissionTime));
@@ -91,7 +91,7 @@ namespace NadekoBot.Modules.Games
private Task Game_OnUserVoted(string user)
{
return SendConfirmAsync(
GetText("acrophobia"),
GetText(strs.acrophobia),
GetText("acro_vote_cast", Format.Bold(user)));
}
@@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Games
{
if (submissions.Length == 0)
{
await SendErrorAsync(GetText("acrophobia"), GetText("acro_ended_no_sub")).ConfigureAwait(false);
await SendErrorAsync(GetText(strs.acrophobia), GetText(strs.acro_ended_no_sub)).ConfigureAwait(false);
return;
}
if (submissions.Length == 1)
@@ -117,12 +117,12 @@ namespace NadekoBot.Modules.Games
var i = 0;
var embed = _eb.Create()
.WithOkColor()
.WithTitle(GetText("acrophobia") + " - " + GetText("submissions_closed"))
.WithTitle(GetText(strs.acrophobia) + " - " + GetText(strs.submissions_closed))
.WithDescription(GetText("acro_nym_was", Format.Bold(string.Join(".", game.StartingLetters)) + "\n" +
$@"--
{submissions.Aggregate("", (agg, cur) => agg + $"`{++i}.` **{cur.Key.Input}**\n")}
--"))
.WithFooter(GetText("acro_vote"));
.WithFooter(GetText(strs.acro_vote));
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
@@ -131,13 +131,13 @@ $@"--
{
if (!votes.Any() || votes.All(x => x.Value == 0))
{
await SendErrorAsync(GetText("acrophobia"), GetText("acro_no_votes_cast")).ConfigureAwait(false);
await SendErrorAsync(GetText(strs.acrophobia), GetText(strs.acro_no_votes_cast)).ConfigureAwait(false);
return;
}
var table = votes.OrderByDescending(v => v.Value);
var winner = table.First();
var embed = _eb.Create().WithOkColor()
.WithTitle(GetText("acrophobia"))
.WithTitle(GetText(strs.acrophobia))
.WithDescription(GetText("acro_winner", Format.Bold(winner.Key.UserName),
Format.Bold(winner.Value.ToString())))
.WithFooter(winner.Key.Input);

View File

@@ -72,8 +72,14 @@ namespace NadekoBot.Modules.Games.Common
_moveLock = new SemaphoreSlim(1, 1);
}
private string GetText(string key, params object[] replacements)
=> _strings.GetText(key, _channel.GuildId, replacements);
private string GetText(LocStr key)
=> _strings.GetText(key, _channel.GuildId);
private string GetText<T>(LocStr<T> key, T param)
=> _strings.GetText(key, _channel.GuildId, param);
private string GetText<T1, T2>(LocStr<T1, T2> key, T1 param, T2 param2)
=> _strings.GetText(key, _channel.GuildId, param, param2);
public string GetState()
{
@@ -98,7 +104,7 @@ namespace NadekoBot.Modules.Games.Common
var embed = _eb.Create()
.WithOkColor()
.WithDescription(Environment.NewLine + GetState())
.WithAuthor(GetText("vs", _users[0], _users[1]));
.WithAuthor(GetText(strs.vs, _users[0], _users[1]));
if (!string.IsNullOrWhiteSpace(title))
embed.WithTitle(title);
@@ -106,7 +112,7 @@ namespace NadekoBot.Modules.Games.Common
if (_winner is null)
{
if (_phase == Phase.Ended)
embed.WithFooter(GetText("ttt_no_moves"));
embed.WithFooter(GetText(strs.ttt_no_moves));
else
embed.WithFooter(GetText("ttt_users_move", _users[_curUserIndex]));
}
@@ -137,12 +143,12 @@ namespace NadekoBot.Modules.Games.Common
{
if (_phase == Phase.Started || _phase == Phase.Ended)
{
await _channel.SendErrorAsync(_eb, user.Mention + GetText("ttt_already_running")).ConfigureAwait(false);
await _channel.SendErrorAsync(_eb, user.Mention + GetText(strs.ttt_already_running)).ConfigureAwait(false);
return;
}
else if (_users[0] == user)
{
await _channel.SendErrorAsync(_eb, user.Mention + GetText("ttt_against_yourself")).ConfigureAwait(false);
await _channel.SendErrorAsync(_eb, user.Mention + GetText(strs.ttt_against_yourself)).ConfigureAwait(false);
return;
}
@@ -165,7 +171,7 @@ namespace NadekoBot.Modules.Games.Common
var del = _previousMessage?.DeleteAsync();
try
{
await _channel.EmbedAsync(GetEmbed(GetText("ttt_time_expired"))).ConfigureAwait(false);
await _channel.EmbedAsync(GetEmbed(GetText(strs.ttt_time_expired))).ConfigureAwait(false);
if (del != null)
await del.ConfigureAwait(false);
}
@@ -184,7 +190,7 @@ namespace NadekoBot.Modules.Games.Common
_client.MessageReceived += Client_MessageReceived;
_previousMessage = await _channel.EmbedAsync(GetEmbed(GetText("game_started"))).ConfigureAwait(false);
_previousMessage = await _channel.EmbedAsync(GetEmbed(GetText(strs.game_started))).ConfigureAwait(false);
}
private bool IsDraw()
@@ -255,14 +261,14 @@ namespace NadekoBot.Modules.Games.Common
if (_phase == Phase.Ended) // if user won, stop receiving moves
{
reason = GetText("ttt_matched_three");
reason = GetText(strs.ttt_matched_three);
_winner = _users[_curUserIndex];
_client.MessageReceived -= Client_MessageReceived;
OnEnded?.Invoke(this);
}
else if (IsDraw())
{
reason = GetText("ttt_a_draw");
reason = GetText(strs.ttt_a_draw);
_phase = Phase.Ended;
_client.MessageReceived -= Client_MessageReceived;
OnEnded?.Invoke(this);

View File

@@ -62,8 +62,14 @@ namespace NadekoBot.Modules.Games.Common.Trivia
Channel = channel;
}
private string GetText(string key, params object[] replacements)
=> _strings.GetText(key, Channel.GuildId, replacements);
private string GetText(in LocStr key)
=> _strings.GetText(key, Channel.GuildId);
private string GetText<T>(in LocStr<T> key, T param1)
=> _strings.GetText(key, Channel.GuildId, param1);
private string GetText<T1, T2>(in LocStr<T1, T2> key, T1 param1, T2 param2)
=> _strings.GetText(key, Channel.GuildId, param1, param2);
public async Task StartGame()
{
@@ -78,7 +84,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia
CurrentQuestion = _questionPool.GetRandomQuestion(OldQuestions, _options.IsPokemon);
if (string.IsNullOrWhiteSpace(CurrentQuestion?.Answer) || string.IsNullOrWhiteSpace(CurrentQuestion.Question))
{
await Channel.SendErrorAsync(_eb, GetText("trivia_game"), GetText("failed_loading_question")).ConfigureAwait(false);
await Channel.SendErrorAsync(_eb, GetText(strs.trivia_game), GetText(strs.failed_loading_question)).ConfigureAwait(false);
return;
}
OldQuestions.Add(CurrentQuestion); //add it to exclusion list so it doesn't show up again
@@ -88,12 +94,12 @@ namespace NadekoBot.Modules.Games.Common.Trivia
try
{
questionEmbed = _eb.Create().WithOkColor()
.WithTitle(GetText("trivia_game"))
.AddField(GetText("category"), CurrentQuestion.Category)
.AddField(GetText("question"), CurrentQuestion.Question);
.WithTitle(GetText(strs.trivia_game))
.AddField(GetText(strs.category), CurrentQuestion.Category)
.AddField(GetText(strs.question), CurrentQuestion.Question);
if (showHowToQuit)
questionEmbed.WithFooter(GetText("trivia_quit", _quitCommand));
questionEmbed.WithFooter(GetText(strs.trivia_quit, _quitCommand));
if (Uri.IsWellFormedUriString(CurrentQuestion.ImageUrl, UriKind.Absolute))
questionEmbed.WithImageUrl(CurrentQuestion.ImageUrl);
@@ -152,8 +158,8 @@ namespace NadekoBot.Modules.Games.Common.Trivia
try
{
var embed = _eb.Create().WithErrorColor()
.WithTitle(GetText("trivia_game"))
.WithDescription(GetText("trivia_times_up", Format.Bold(CurrentQuestion.Answer)));
.WithTitle(GetText(strs.trivia_game))
.WithDescription(GetText(strs.trivia_times_up, Format.Bold(CurrentQuestion.Answer)));
if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute))
embed.WithImageUrl(CurrentQuestion.AnswerImageUrl);
@@ -190,8 +196,8 @@ namespace NadekoBot.Modules.Games.Common.Trivia
try
{
await Channel.SendConfirmAsync(_eb,
GetText("trivia_game"),
GetText("trivia_stopping"));
GetText(strs.trivia_game),
GetText(strs.trivia_stopping));
}
catch (Exception ex)
@@ -239,7 +245,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia
try
{
var embedS = _eb.Create().WithOkColor()
.WithTitle(GetText("trivia_game"))
.WithTitle(GetText(strs.trivia_game))
.WithDescription(GetText("trivia_win",
guildUser.Mention,
Format.Bold(CurrentQuestion.Answer)));
@@ -257,7 +263,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia
return;
}
var embed = _eb.Create().WithOkColor()
.WithTitle(GetText("trivia_game"))
.WithTitle(GetText(strs.trivia_game))
.WithDescription(GetText("trivia_guess", guildUser.Mention, Format.Bold(CurrentQuestion.Answer)));
if (Uri.IsWellFormedUriString(CurrentQuestion.AnswerImageUrl, UriKind.Absolute))
embed.WithImageUrl(CurrentQuestion.AnswerImageUrl);
@@ -271,7 +277,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia
public string GetLeaderboard()
{
if (Users.Count == 0)
return GetText("no_results");
return GetText(strs.no_results);
var sb = new StringBuilder();

View File

@@ -50,8 +50,8 @@ namespace NadekoBot.Modules.Games
var res = _service.GetEightballResponse(ctx.User.Id, question);
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithDescription(ctx.User.ToString())
.AddField("❓ " + GetText("question"), question, false)
.AddField("🎱 " + GetText("_8ball"), res, false));
.AddField("❓ " + GetText(strs.question), question, false)
.AddField("🎱 " + GetText(strs._8ball), res, false));
}
[NadekoCommand, Aliases]

View File

@@ -58,7 +58,7 @@ namespace NadekoBot.Modules.Games
try
{
await SendConfirmAsync(GetText("hangman_game_started") + $" ({hm.TermType})",
await SendConfirmAsync(GetText(strs.hangman_game_started) + $" ({hm.TermType})",
hm.ScrambledWord + "\n" + hm.GetHangman())
.ConfigureAwait(false);
}

View File

@@ -64,7 +64,7 @@ namespace NadekoBot.Modules.Games
if (!_service.ActivePolls.TryGetValue(ctx.Guild.Id, out var pr))
return;
await ctx.Channel.EmbedAsync(GetStats(pr.Poll, GetText("current_poll_results"))).ConfigureAwait(false);
await ctx.Channel.EmbedAsync(GetStats(pr.Poll, GetText(strs.current_poll_results))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -78,7 +78,7 @@ namespace NadekoBot.Modules.Games
if ((p = _service.StopPoll(ctx.Guild.Id)) is null)
return;
var embed = GetStats(p, GetText("poll_closed"));
var embed = GetStats(p, GetText(strs.poll_closed));
await ctx.Channel.EmbedAsync(embed)
.ConfigureAwait(false);
}

View File

@@ -65,7 +65,7 @@ namespace NadekoBot.Modules.Games
return;
}
await SendErrorAsync(GetText("trivia_already_running") + "\n" + trivia.CurrentQuestion)
await SendErrorAsync(GetText(strs.trivia_already_running) + "\n" + trivia.CurrentQuestion)
.ConfigureAwait(false);
}
@@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Games
{
if (_service.RunningTrivias.TryGetValue(ctx.Guild.Id, out TriviaGame trivia))
{
await SendConfirmAsync(GetText("leaderboard"), trivia.GetLeaderboard()).ConfigureAwait(false);
await SendConfirmAsync(GetText(strs.leaderboard), trivia.GetLeaderboard()).ConfigureAwait(false);
return;
}

View File

@@ -82,7 +82,7 @@ namespace NadekoBot.Modules.Help
await ctx.SendPaginatedConfirmAsync(page, cur =>
{
var embed = _eb.Create().WithOkColor()
.WithTitle(GetText("list_of_modules"));
.WithTitle(GetText(strs.list_of_modules));
var localModules = topLevelModules.Skip(12 * cur)
.Take(12)
@@ -91,7 +91,7 @@ namespace NadekoBot.Modules.Help
if (!localModules.Any())
{
embed = embed.WithOkColor()
.WithDescription(GetText("module_page_empty"));
.WithDescription(GetText(strs.module_page_empty));
return embed;
}
@@ -383,7 +383,7 @@ namespace NadekoBot.Modules.Help
// also send the file, but indented one, to chat
using var rDataStream = new MemoryStream(Encoding.ASCII.GetBytes(readableData));
await ctx.Channel.SendFileAsync(rDataStream, "cmds.json", GetText("commandlist_regen")).ConfigureAwait(false);
await ctx.Channel.SendFileAsync(rDataStream, "cmds.json", GetText(strs.commandlist_regen)).ConfigureAwait(false);
}
[NadekoCommand, Aliases]

View File

@@ -114,8 +114,8 @@ namespace NadekoBot.Modules.Music
{
var embed = _eb.Create()
.WithOkColor()
.WithAuthor(GetText("queued_song") + " #" + (index + 1), MusicIconUrl)
.WithDescription($"{trackInfo.PrettyName()}\n{GetText("queue")} ")
.WithAuthor(GetText(strs.queued_song) + " #" + (index + 1), MusicIconUrl)
.WithDescription($"{trackInfo.PrettyName()}\n{GetText(strs.queue)} ")
.WithFooter(trackInfo.Platform.ToString());
if (!string.IsNullOrWhiteSpace(trackInfo.Thumbnail))
@@ -299,16 +299,16 @@ namespace NadekoBot.Modules.Music
// add += Format.Bold(GetText("song_skips_after", TimeSpan.FromSeconds(mps).ToString("HH\\:mm\\:ss"))) + "\n";
if (repeatType == PlayerRepeatType.Track)
{
add += "🔂 " + GetText("repeating_track") + "\n";
add += "🔂 " + GetText(strs.repeating_track) + "\n";
}
else
{
// if (mp.Autoplay)
// add += "↪ " + GetText("autoplaying") + "\n";
// add += "↪ " + GetText(strs.autoplaying) + "\n";
// if (mp.FairPlay && !mp.Autoplay)
// add += " " + GetText("fairplay") + "\n";
// add += " " + GetText(strs.fairplay) + "\n";
if (repeatType == PlayerRepeatType.Queue)
add += "🔁 " + GetText("repeating_queue") + "\n";
add += "🔁 " + GetText(strs.repeating_queue) + "\n";
}
@@ -431,7 +431,7 @@ namespace NadekoBot.Modules.Music
}
var embed = _eb.Create()
.WithAuthor(GetText("removed_song") + " #" + (index), MusicIconUrl)
.WithAuthor(GetText(strs.removed_song) + " #" + (index), MusicIconUrl)
.WithDescription(song.PrettyName())
.WithFooter(song.PrettyInfo())
.WithErrorColor();
@@ -615,9 +615,9 @@ namespace NadekoBot.Modules.Music
var embed = _eb.Create()
.WithTitle(track.Title.TrimTo(65))
.WithAuthor(GetText("song_moved"), MusicIconUrl)
.AddField(GetText("from_position"), $"#{from + 1}", true)
.AddField(GetText("to_position"), $"#{to + 1}", true)
.WithAuthor(GetText(strs.song_moved), MusicIconUrl)
.AddField(GetText(strs.from_position), $"#{from + 1}", true)
.AddField(GetText(strs.to_position), $"#{to + 1}", true)
.WithOkColor();
if (Uri.IsWellFormedUriString(track.Url, UriKind.Absolute))
@@ -702,7 +702,7 @@ namespace NadekoBot.Modules.Music
return;
var embed = _eb.Create().WithOkColor()
.WithAuthor(GetText("now_playing"), MusicIconUrl)
.WithAuthor(GetText(strs.now_playing), MusicIconUrl)
.WithDescription(currentTrack.PrettyName())
.WithThumbnailUrl(currentTrack.Thumbnail)
.WithFooter($"{mp.PrettyVolume()} | {mp.PrettyTotalTime()} | {currentTrack.Platform} | {currentTrack.Queuer}");

View File

@@ -166,9 +166,9 @@ namespace NadekoBot.Modules.Music
await ctx.Channel.EmbedAsync(_eb.Create()
.WithOkColor()
.WithTitle(GetText("playlist_saved"))
.AddField(GetText("name"), name)
.AddField(GetText("id"), playlist.Id.ToString()));
.WithTitle(GetText(strs.playlist_saved))
.AddField(GetText(strs.name), name)
.AddField(GetText(strs.id), playlist.Id.ToString()));
}
@@ -239,7 +239,7 @@ namespace NadekoBot.Modules.Music
if (msg != null)
{
await msg.ModifyAsync(m => m.Content = GetText("playlist_queue_complete"));
await msg.ModifyAsync(m => m.Content = GetText(strs.playlist_queue_complete));
}
}
finally

View File

@@ -65,7 +65,7 @@ namespace NadekoBot.Modules.NSFW
await channel.EmbedAsync(_eb.Create().WithOkColor()
.WithImageUrl(img.FileUrl)
.WithDescription($"[{GetText("tag")}: {tag}]({img})"))
.WithDescription($"[{GetText(strs.tag)}: {tag}]({img})"))
.ConfigureAwait(false);
}
@@ -352,7 +352,7 @@ namespace NadekoBot.Modules.NSFW
if (string.IsNullOrWhiteSpace(tag))
{
var blTags = _service.GetBlacklistedTags(ctx.Guild.Id);
await SendConfirmAsync(GetText("blacklisted_tag_list"),
await SendConfirmAsync(GetText(strs.blacklisted_tag_list),
blTags.Any()
? string.Join(", ", blTags)
: "-").ConfigureAwait(false);
@@ -424,9 +424,9 @@ namespace NadekoBot.Modules.NSFW
.WithDescription(g.FullTitle)
.WithImageUrl(g.Thumbnail)
.WithUrl(g.Url)
.AddField(GetText("favorites"), g.Likes, true)
.AddField(GetText("pages"), g.PageCount, true)
.AddField(GetText("tags"), tagString, true)
.AddField(GetText(strs.favorites), g.Likes, true)
.AddField(GetText(strs.pages), g.PageCount, true)
.AddField(GetText(strs.tags), tagString, true)
.WithFooter(g.UploadedAt.ToString("f"))
.WithOkColor();

View File

@@ -69,7 +69,7 @@ namespace NadekoBot.Modules.Permissions
return _eb.Create()
.WithOkColor()
.WithTitle(title)
.WithDescription(GetText("empty_page"));
.WithDescription(GetText(strs.empty_page));
}
return _eb.Create()
@@ -86,7 +86,7 @@ namespace NadekoBot.Modules.Permissions
if (--page < 0)
return Task.CompletedTask;
return ListBlacklistInternal(GetText("blacklisted_users"), BlacklistType.User, page);
return ListBlacklistInternal(GetText(strs.blacklisted_users), BlacklistType.User, page);
}
[NadekoCommand, Aliases]
@@ -96,7 +96,7 @@ namespace NadekoBot.Modules.Permissions
if (--page < 0)
return Task.CompletedTask;
return ListBlacklistInternal(GetText("blacklisted_channels"), BlacklistType.Channel, page);
return ListBlacklistInternal(GetText(strs.blacklisted_channels), BlacklistType.Channel, page);
}
[NadekoCommand, Aliases]
@@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Permissions
if (--page < 0)
return Task.CompletedTask;
return ListBlacklistInternal(GetText("blacklisted_servers"), BlacklistType.Server, page);
return ListBlacklistInternal(GetText(strs.blacklisted_servers), BlacklistType.Server, page);
}
[NadekoCommand, Aliases]

View File

@@ -93,7 +93,7 @@ namespace NadekoBot.Modules.Permissions
if (!localSet.Any())
await ReplyConfirmLocalizedAsync("cmdcd_none").ConfigureAwait(false);
else
await channel.SendTableAsync("", localSet.Select(c => c.CommandName + ": " + c.Seconds + GetText("sec")), s => $"{s,-30}", 2).ConfigureAwait(false);
await channel.SendTableAsync("", localSet.Select(c => c.CommandName + ": " + c.Seconds + GetText(strs.sec)), s => $"{s,-30}", 2).ConfigureAwait(false);
}
}
}

View File

@@ -288,7 +288,7 @@ namespace NadekoBot.Modules.Permissions
await ctx.SendPaginatedConfirmAsync(page,
(curPage) => _eb.Create()
.WithTitle(GetText("filter_word_list"))
.WithTitle(GetText(strs.filter_word_list))
.WithDescription(string.Join("\n", fws.Skip(curPage * 10).Take(10)))
.WithOkColor()
, fws.Length, 10).ConfigureAwait(false);

View File

@@ -39,12 +39,12 @@ namespace NadekoBot.Modules.Permissions
var embed = _eb.Create().WithOkColor();
if (blockedModule.Any())
embed.AddField(GetText("blocked_modules")
embed.AddField(GetText(strs.blocked_modules)
, string.Join("\n", _service.BlockedModules)
, false);
if (blockedCommands.Any())
embed.AddField(GetText("blocked_commands")
embed.AddField(GetText(strs.blocked_commands)
, string.Join("\n", _service.BlockedCommands)
, false);

View File

@@ -130,7 +130,7 @@ namespace NadekoBot.Modules.Permissions
var str =
$"`{p.Index + 1}.` {Format.Bold(p.GetCommand(Prefix, (SocketGuild)ctx.Guild))}";
if (p.Index == 0)
str += $" [{GetText("uneditable")}]";
str += $" [{GetText(strs.uneditable)}]";
return str;
}));
@@ -236,13 +236,13 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("sx_enable",
Format.Code(command.Name),
GetText("of_command")).ConfigureAwait(false);
GetText(strs.of_command)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("sx_disable",
Format.Code(command.Name),
GetText("of_command")).ConfigureAwait(false);
GetText(strs.of_command)).ConfigureAwait(false);
}
}
@@ -263,13 +263,13 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("sx_enable",
Format.Code(module.Name),
GetText("of_module")).ConfigureAwait(false);
GetText(strs.of_module)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("sx_disable",
Format.Code(module.Name),
GetText("of_module")).ConfigureAwait(false);
GetText(strs.of_module)).ConfigureAwait(false);
}
}
@@ -291,14 +291,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("ux_enable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(user.ToString())).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("ux_disable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(user.ToString())).ConfigureAwait(false);
}
}
@@ -320,14 +320,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("ux_enable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(user.ToString())).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("ux_disable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(user.ToString())).ConfigureAwait(false);
}
}
@@ -353,14 +353,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("rx_enable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(role.Name)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("rx_disable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(role.Name)).ConfigureAwait(false);
}
}
@@ -386,14 +386,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("rx_enable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(role.Name)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("rx_disable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(role.Name)).ConfigureAwait(false);
}
}
@@ -416,14 +416,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("cx_enable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(chnl.Name)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("cx_disable",
Format.Code(command.Name),
GetText("of_command"),
GetText(strs.of_command),
Format.Code(chnl.Name)).ConfigureAwait(false);
}
}
@@ -445,14 +445,14 @@ namespace NadekoBot.Modules.Permissions
{
await ReplyConfirmLocalizedAsync("cx_enable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(chnl.Name)).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("cx_disable",
Format.Code(module.Name),
GetText("of_module"),
GetText(strs.of_module),
Format.Code(chnl.Name)).ConfigureAwait(false);
}
}

View File

@@ -36,9 +36,9 @@ namespace NadekoBot.Modules.Searches
.WithTitle(novelData.Title)
.WithUrl(novelData.Link)
.WithImageUrl(novelData.ImageUrl)
.AddField(GetText("authors"), string.Join("\n", novelData.Authors), true)
.AddField(GetText("status"), novelData.Status, true)
.AddField(GetText("genres"), string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" }), true)
.AddField(GetText(strs.authors), string.Join("\n", novelData.Authors), true)
.AddField(GetText(strs.status), novelData.Status, true)
.AddField(GetText(strs.genres), string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" }), true)
.WithFooter(GetText("score" + " " + novelData.Score));
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
@@ -62,7 +62,7 @@ namespace NadekoBot.Modules.Searches
var favorites = document.QuerySelectorAll("div.user-favorites > div.di-tc");
var favAnime = GetText("anime_no_fav");
var favAnime = GetText(strs.anime_no_fav);
if (favorites.Length > 0 && favorites[0].QuerySelector("p") is null)
favAnime = string.Join("\n", favorites[0].QuerySelectorAll("ul > li > div.di-tc.va-t > a")
.Shuffle()
@@ -84,13 +84,13 @@ namespace NadekoBot.Modules.Searches
var embed = _eb.Create()
.WithOkColor()
.WithTitle(GetText("mal_profile", name))
.AddField("💚 " + GetText("watching"), stats[0], true)
.AddField("💙 " + GetText("completed"), stats[1], true);
.AddField("💚 " + GetText(strs.watching), stats[0], true)
.AddField("💙 " + GetText(strs.completed), stats[1], true);
if (info.Count < 3)
embed.AddField("💛 " + GetText("on_hold"), stats[2], true);
embed.AddField("💛 " + GetText(strs.on_hold), stats[2], true);
embed
.AddField("💔 " + GetText("dropped"), stats[3], true)
.AddField("⚪ " + GetText("plan_to_watch"), stats[4], true)
.AddField("💔 " + GetText(strs.dropped), stats[3], true)
.AddField("⚪ " + GetText(strs.plan_to_watch), stats[4], true)
.AddField("🕐 " + daysAndMean[0][0], daysAndMean[0][1], true)
.AddField("📊 " + daysAndMean[1][0], daysAndMean[1][1], true)
.AddField(MalInfoToEmoji(info[0].Item1) + " " + info[0].Item1, info[0].Item2.TrimTo(20), true)
@@ -102,7 +102,7 @@ namespace NadekoBot.Modules.Searches
.WithDescription($@"
** https://myanimelist.net/animelist/{ name } **
**{GetText("top_3_fav_anime")}**
**{GetText(strs.top_3_fav_anime)}**
{favAnime}"
)
@@ -156,9 +156,9 @@ namespace NadekoBot.Modules.Searches
.WithTitle(animeData.TitleEnglish)
.WithUrl(animeData.Link)
.WithImageUrl(animeData.ImageUrlLarge)
.AddField(GetText("episodes"), animeData.TotalEpisodes.ToString(), true)
.AddField(GetText("status"), animeData.AiringStatus.ToString(), true)
.AddField(GetText("genres"), string.Join(",\n", animeData.Genres.Any() ? animeData.Genres : new[] { "none" }), true)
.AddField(GetText(strs.episodes), animeData.TotalEpisodes.ToString(), true)
.AddField(GetText(strs.status), animeData.AiringStatus.ToString(), true)
.AddField(GetText(strs.genres), string.Join(",\n", animeData.Genres.Any() ? animeData.Genres : new[] { "none" }), true)
.WithFooter(GetText("score" + " " + animeData.AverageScore + " / 100"));
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
@@ -184,9 +184,9 @@ namespace NadekoBot.Modules.Searches
.WithTitle(mangaData.TitleEnglish)
.WithUrl(mangaData.Link)
.WithImageUrl(mangaData.ImageUrlLge)
.AddField(GetText("chapters"), mangaData.TotalChapters.ToString(), true)
.AddField(GetText("status"), mangaData.PublishingStatus.ToString(), true)
.AddField(GetText("genres"), string.Join(",\n", mangaData.Genres.Any() ? mangaData.Genres : new[] { "none" }), true)
.AddField(GetText(strs.chapters), mangaData.TotalChapters.ToString(), true)
.AddField(GetText(strs.status), mangaData.PublishingStatus.ToString(), true)
.AddField(GetText(strs.genres), string.Join(",\n", mangaData.Genres.Any() ? mangaData.Genres : new[] { "none" }), true)
.WithFooter(GetText("score" + " " + mangaData.AverageScore + " / 100"));
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);

View File

@@ -23,7 +23,7 @@ namespace NadekoBot.Modules.Searches
if (nearest != null)
{
var embed = _eb.Create()
.WithTitle(GetText("crypto_not_found"))
.WithTitle(GetText(strs.crypto_not_found))
.WithDescription(GetText("did_you_mean", Format.Bold($"{nearest.Name} ({nearest.Symbol})")));
if (await PromptUserConfirmAsync(embed).ConfigureAwait(false))
@@ -51,10 +51,10 @@ namespace NadekoBot.Modules.Searches
.WithTitle($"{crypto.Name} ({crypto.Symbol})")
.WithUrl($"https://coinmarketcap.com/currencies/{crypto.Slug}/")
.WithThumbnailUrl($"https://s3.coinmarketcap.com/static/img/coins/128x128/{crypto.Id}.png")
.AddField(GetText("market_cap"), $"${crypto.Quote.Usd.Market_Cap:n0}", true)
.AddField(GetText("price"), $"${crypto.Quote.Usd.Price}", true)
.AddField(GetText("volume_24h"), $"${crypto.Quote.Usd.Volume_24h:n0}", true)
.AddField(GetText("change_7d_24h"), $"{sevenDay}% / {lastDay}%", true)
.AddField(GetText(strs.market_cap), $"${crypto.Quote.Usd.Market_Cap:n0}", true)
.AddField(GetText(strs.price), $"${crypto.Quote.Usd.Price}", true)
.AddField(GetText(strs.volume_24h), $"${crypto.Quote.Usd.Volume_24h:n0}", true)
.AddField(GetText(strs.change_7d_24h), $"{sevenDay}% / {lastDay}%", true)
.WithImageUrl($"https://s3.coinmarketcap.com/generated/sparklines/web/7d/usd/{crypto.Id}.png")).ConfigureAwait(false);
}
}

View File

@@ -73,7 +73,7 @@ namespace NadekoBot.Modules.Searches
{
await ctx.Channel.EmbedAsync(_eb.Create()
.WithOkColor()
.WithDescription(GetText("feed_no_feed")))
.WithDescription(GetText(strs.feed_no_feed)))
.ConfigureAwait(false);
return;
}

View File

@@ -60,7 +60,7 @@ namespace NadekoBot.Modules.Searches
catch
{
var embed = _eb.Create()
.WithDescription(GetText("account_not_found"))
.WithDescription(GetText(strs.account_not_found))
.WithErrorColor();
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
@@ -121,7 +121,7 @@ namespace NadekoBot.Modules.Searches
catch
{
var eembed = _eb.Create()
.WithDescription(GetText("leagues_not_found"))
.WithDescription(GetText(strs.leagues_not_found))
.WithErrorColor();
await ctx.Channel.EmbedAsync(eembed).ConfigureAwait(false);
@@ -215,7 +215,7 @@ namespace NadekoBot.Modules.Searches
catch
{
var embed = _eb.Create()
.WithDescription(GetText("ninja_not_found"))
.WithDescription(GetText(strs.ninja_not_found))
.WithErrorColor();
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);

View File

@@ -43,9 +43,9 @@ namespace NadekoBot.Modules.Searches
.WithTitle(kvp.Key.ToTitleCase())
.WithDescription(p.BaseStats.ToString())
.WithThumbnailUrl($"https://assets.pokemon.com/assets/cms2/img/pokedex/detail/{p.Id.ToString("000")}.png")
.AddField(GetText("types"), string.Join("\n", p.Types), true)
.AddField(GetText("height_weight"), GetText("height_weight_val", p.HeightM, p.WeightKg), true)
.AddField(GetText("abilities"), string.Join("\n", p.Abilities.Select(a => a.Value)), true)).ConfigureAwait(false);
.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.abilities), string.Join("\n", p.Abilities.Select(a => a.Value)), true)).ConfigureAwait(false);
return;
}
}
@@ -67,7 +67,7 @@ namespace NadekoBot.Modules.Searches
.WithDescription(string.IsNullOrWhiteSpace(kvp.Value.Desc)
? kvp.Value.ShortDesc
: kvp.Value.Desc)
.AddField(GetText("rating"), kvp.Value.Rating.ToString(_cultureInfo), true));
.AddField(GetText(strs.rating), kvp.Value.Rating.ToString(_cultureInfo), true));
return;
}
}

View File

@@ -73,7 +73,7 @@ namespace NadekoBot.Modules.Searches
if (data is null)
{
embed.WithDescription(GetText("city_not_found"))
embed.WithDescription(GetText(strs.city_not_found))
.WithErrorColor();
}
else
@@ -89,15 +89,15 @@ namespace NadekoBot.Modules.Searches
sunset = sunset.ToOffset(tz.GetUtcOffset(sunset));
var timezone = $"UTC{sunrise:zzz}";
embed.AddField("🌍 " + Format.Bold(GetText("location")), $"[{data.Name + ", " + data.Sys.Country}](https://openweathermap.org/city/{data.Id})", true)
.AddField("📏 " + Format.Bold(GetText("latlong")), $"{data.Coord.Lat}, {data.Coord.Lon}", true)
.AddField("☁ " + Format.Bold(GetText("condition")), string.Join(", ", data.Weather.Select(w => w.Main)), true)
.AddField("😓 " + Format.Bold(GetText("humidity")), $"{data.Main.Humidity}%", true)
.AddField("💨 " + Format.Bold(GetText("wind_speed")), data.Wind.Speed + " m/s", true)
.AddField("🌡 " + Format.Bold(GetText("temperature")), $"{data.Main.Temp:F1}°C / {f(data.Main.Temp):F1}°F", true)
.AddField("🔆 " + Format.Bold(GetText("min_max")), $"{data.Main.TempMin:F1}°C - {data.Main.TempMax:F1}°C\n{f(data.Main.TempMin):F1}°F - {f(data.Main.TempMax):F1}°F", true)
.AddField("🌄 " + Format.Bold(GetText("sunrise")), $"{sunrise:HH:mm} {timezone}", true)
.AddField("🌇 " + Format.Bold(GetText("sunset")), $"{sunset:HH:mm} {timezone}", true)
embed.AddField("🌍 " + Format.Bold(GetText(strs.location)), $"[{data.Name + ", " + data.Sys.Country}](https://openweathermap.org/city/{data.Id})", true)
.AddField("📏 " + Format.Bold(GetText(strs.latlong)), $"{data.Coord.Lat}, {data.Coord.Lon}", true)
.AddField("☁ " + Format.Bold(GetText(strs.condition)), string.Join(", ", data.Weather.Select(w => w.Main)), true)
.AddField("😓 " + Format.Bold(GetText(strs.humidity)), $"{data.Main.Humidity}%", true)
.AddField("💨 " + Format.Bold(GetText(strs.wind_speed)), data.Wind.Speed + " m/s", true)
.AddField("🌡 " + Format.Bold(GetText(strs.temperature)), $"{data.Main.Temp:F1}°C / {f(data.Main.Temp):F1}°F", true)
.AddField("🔆 " + Format.Bold(GetText(strs.min_max)), $"{data.Main.TempMin:F1}°C - {data.Main.TempMax:F1}°C\n{f(data.Main.TempMin):F1}°F - {f(data.Main.TempMax):F1}°F", true)
.AddField("🌄 " + Format.Bold(GetText(strs.sunrise)), $"{sunrise:HH:mm} {timezone}", true)
.AddField("🌇 " + Format.Bold(GetText(strs.sunset)), $"{sunset:HH:mm} {timezone}", true)
.WithOkColor()
.WithFooter("Powered by openweathermap.org", $"http://openweathermap.org/img/w/{data.Weather[0].Icon}.png");
}
@@ -142,10 +142,10 @@ namespace NadekoBot.Modules.Searches
var eb = _eb.Create()
.WithOkColor()
.WithTitle(GetText("time_new"))
.WithTitle(GetText(strs.time_new))
.WithDescription(Format.Code(data.Time.ToString()))
.AddField(GetText("location"), string.Join('\n', data.Address.Split(", ")), true)
.AddField(GetText("timezone"), data.TimeZoneName, true);
.AddField(GetText(strs.location), string.Join('\n', data.Address.Split(", ")), true)
.AddField(GetText(strs.timezone), data.TimeZoneName, true);
await ctx.Channel.SendMessageAsync(embed: eb.Build()).ConfigureAwait(false);
}
@@ -222,7 +222,7 @@ namespace NadekoBot.Modules.Searches
var res = await _google.GetImageAsync(oterms).ConfigureAwait(false);
var embed = _eb.Create()
.WithOkColor()
.WithAuthor(GetText("image_search_for") + " " + oterms.TrimTo(50),
.WithAuthor(GetText(strs.image_search_for) + " " + oterms.TrimTo(50),
"http://i.imgur.com/G46fm8J.png",
$"https://www.google.rs/search?q={query}&source=lnms&tbm=isch")
.WithDescription(res.Link)
@@ -252,7 +252,7 @@ namespace NadekoBot.Modules.Searches
var embed = _eb.Create()
.WithOkColor()
.WithAuthor(GetText("image_search_for") + " " + oterms.TrimTo(50),
.WithAuthor(GetText(strs.image_search_for) + " " + oterms.TrimTo(50),
"http://s.imgur.com/images/logo-1200-630.jpg?",
fullQueryLink)
.WithDescription(source)
@@ -324,8 +324,8 @@ namespace NadekoBot.Modules.Searches
await ctx.Channel.EmbedAsync(_eb.Create()
.WithOkColor()
.AddField(GetText("original_url"), $"<{query}>")
.AddField(GetText("short_url"), $"<{shortLink}>"));
.AddField(GetText(strs.original_url), $"<{query}>")
.AddField(GetText(strs.short_url), $"<{shortLink}>"));
}
[NadekoCommand, Aliases]
@@ -355,7 +355,7 @@ namespace NadekoBot.Modules.Searches
iconUrl: "http://i.imgur.com/G46fm8J.png")
.WithTitle(ctx.User.ToString())
.WithFooter(data.TotalResults)
.WithDescription($"{GetText("search_for")} **{query}**\n\n" +descStr)
.WithDescription($"{GetText(strs.search_for)} **{query}**\n\n" +descStr)
.WithOkColor();
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
@@ -386,7 +386,7 @@ namespace NadekoBot.Modules.Searches
var embed = _eb.Create()
.WithAuthor(ctx.User.ToString(),
iconUrl: "https://upload.wikimedia.org/wikipedia/en/9/90/The_DuckDuckGo_Duck.png")
.WithDescription($"{GetText("search_for")} **{query}**\n\n" + descStr)
.WithDescription($"{GetText(strs.search_for)} **{query}**\n\n" + descStr)
.WithOkColor();
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
@@ -411,9 +411,9 @@ namespace NadekoBot.Modules.Searches
.WithTitle(card.Name)
.WithDescription(card.Description)
.WithImageUrl(card.ImageUrl)
.AddField(GetText("store_url"), card.StoreUrl, true)
.AddField(GetText("cost"), card.ManaCost, true)
.AddField(GetText("types"), card.Types, true);
.AddField(GetText(strs.store_url), card.StoreUrl, true)
.AddField(GetText(strs.cost), card.ManaCost, true)
.AddField(GetText(strs.types), card.Types, true);
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
@@ -531,13 +531,13 @@ namespace NadekoBot.Modules.Searches
var data = col.Skip(page).First();
var embed = _eb.Create()
.WithDescription(ctx.User.Mention)
.AddField(GetText("word"), data.Word, true)
.AddField(GetText("_class"), data.WordType, true)
.AddField(GetText("definition"), data.Definition)
.AddField(GetText(strs.word), data.Word, true)
.AddField(GetText(strs._class), data.WordType, true)
.AddField(GetText(strs.definition), data.Definition)
.WithOkColor();
if (!string.IsNullOrWhiteSpace(data.Example))
embed.AddField(GetText("example"), data.Example);
embed.AddField(GetText(strs.example), data.Example);
return embed;
}, col.Count, 1);
@@ -559,7 +559,7 @@ namespace NadekoBot.Modules.Searches
return;
var fact = JObject.Parse(response)["fact"].ToString();
await SendConfirmAsync("🐈" + GetText("catfact"), fact).ConfigureAwait(false);
await SendConfirmAsync("🐈" + GetText(strs.catfact), fact).ConfigureAwait(false);
}
}
@@ -691,8 +691,8 @@ namespace NadekoBot.Modules.Searches
}
var url = Uri.EscapeUriString($"https://{target}.fandom.com/wiki/{title}");
var response = $@"`{GetText("title")}` {title?.SanitizeMentions()}
`{GetText("url")}:` {url}";
var response = $@"`{GetText(strs.title)}` {title?.SanitizeMentions()}
`{GetText(strs.url)}:` {url}";
await ctx.Channel.SendMessageAsync(response).ConfigureAwait(false);
}
catch
@@ -753,9 +753,9 @@ namespace NadekoBot.Modules.Searches
// .WithTitle(gameData.Name)
// .WithUrl(gameData.Link)
// .WithImageUrl(gameData.HeaderImage)
// .AddField(GetText("genres"), gameData.TotalEpisodes.ToString(), true)
// .AddField(GetText("price"), gameData.IsFree ? GetText("FREE") : game, true)
// .AddField(GetText("links"), gameData.GetGenresString(), true)
// .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));
await ctx.Channel.SendMessageAsync($"https://store.steampowered.com/app/{appId}").ConfigureAwait(false);
}
@@ -767,7 +767,7 @@ namespace NadekoBot.Modules.Searches
var imgObj = await _service.DapiSearch(tag, type, ctx.Guild?.Id).ConfigureAwait(false);
if (imgObj is null)
await SendErrorAsync(ctx.User.Mention + " " + GetText("no_results")).ConfigureAwait(false);
await SendErrorAsync(ctx.User.Mention + " " + GetText(strs.no_results)).ConfigureAwait(false);
else
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithDescription($"{ctx.User.Mention} [{tag ?? "url"}]({imgObj.FileUrl})")

View File

@@ -44,7 +44,7 @@ namespace NadekoBot.Modules.Searches
}
var embed = _service.GetEmbed(ctx.Guild.Id, data);
await ctx.Channel.EmbedAsync(embed, GetText("stream_tracked")).ConfigureAwait(false);
await ctx.Channel.EmbedAsync(embed, GetText(strs.stream_tracked)).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -118,12 +118,12 @@ namespace NadekoBot.Modules.Searches
if (elements.Count == 0)
{
return _eb.Create()
.WithDescription(GetText("streams_none"))
.WithDescription(GetText(strs.streams_none))
.WithErrorColor();
}
var eb = _eb.Create()
.WithTitle(GetText("streams_follow_title"))
.WithTitle(GetText(strs.streams_follow_title))
.WithOkColor();
for (var index = 0; index < elements.Count; index++)
{

View File

@@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Searches
{
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
var translation = await _searches.Translate(langs, text).ConfigureAwait(false);
await SendConfirmAsync(GetText("translation") + " " + langs, translation).ConfigureAwait(false);
await SendConfirmAsync(GetText(strs.translation) + " " + langs, translation).ConfigureAwait(false);
}
catch
{

View File

@@ -37,8 +37,8 @@ namespace NadekoBot.Modules.Searches
var embed = _eb.Create().WithOkColor()
.WithImageUrl(comic.ImageLink)
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{_xkcdUrl}/{comic.Num}")
.AddField(GetText("comic_number"), comic.Num.ToString(), true)
.AddField(GetText("date"), $"{comic.Month}/{comic.Year}", true);
.AddField(GetText(strs.comic_number), comic.Num.ToString(), true)
.AddField(GetText(strs.date), $"{comic.Month}/{comic.Year}", true);
var sent = await ctx.Channel.EmbedAsync(embed)
.ConfigureAwait(false);
@@ -73,8 +73,8 @@ namespace NadekoBot.Modules.Searches
.WithOkColor()
.WithImageUrl(comic.ImageLink)
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{_xkcdUrl}/{num}")
.AddField(GetText("comic_number"), comic.Num.ToString(), true)
.AddField(GetText("date"), $"{comic.Month}/{comic.Year}", true);
.AddField(GetText(strs.comic_number), comic.Num.ToString(), true)
.AddField(GetText(strs.date), $"{comic.Month}/{comic.Year}", true);
var sent = await ctx.Channel.EmbedAsync(embed)
.ConfigureAwait(false);

View File

@@ -21,9 +21,9 @@ namespace NadekoBot.Modules.Utility
expr.EvaluateParameter += Expr_EvaluateParameter;
var result = expr.Evaluate();
if (!expr.HasErrors())
await SendConfirmAsync("⚙ " + GetText("result"), result.ToString()).ConfigureAwait(false);
await SendConfirmAsync("⚙ " + GetText(strs.result), result.ToString()).ConfigureAwait(false);
else
await SendErrorAsync("⚙ " + GetText("error"), expr.Error).ConfigureAwait(false);
await SendErrorAsync("⚙ " + GetText(strs.error), expr.Error).ConfigureAwait(false);
}
private static void Expr_EvaluateParameter(string name, NCalc.ParameterArgs args)

View File

@@ -138,7 +138,7 @@ namespace NadekoBot.Modules.Utility
await ctx.SendPaginatedConfirmAsync(page, (curPage) =>
{
return _eb.Create().WithOkColor()
.WithTitle(GetText("alias_list"))
.WithTitle(GetText(strs.alias_list))
.WithDescription(string.Join("\n",
arr.Skip(curPage * 10).Take(10).Select(x => $"`{x.Key}` => `{x.Value}`")));

View File

@@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Utility
var embed = _eb.Create()
.WithErrorColor()
.WithDescription(GetText("config_not_found", Format.Code(name)))
.AddField(GetText("config_list"), string.Join("\n", configNames));
.AddField(GetText(strs.config_list), string.Join("\n", configNames));
await ctx.Channel.EmbedAsync(embed);
return;
@@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Utility
{
var embed = _eb.Create()
.WithOkColor()
.WithTitle(GetText("config_list"))
.WithTitle(GetText(strs.config_list))
.WithDescription(string.Join("\n", configNames));
await ctx.Channel.EmbedAsync(embed);
@@ -91,7 +91,7 @@ namespace NadekoBot.Modules.Utility
var embed = _eb.Create()
.WithErrorColor()
.WithDescription(GetText("config_not_found", Format.Code(name)))
.AddField(GetText("config_list"), string.Join("\n", configNames));
.AddField(GetText(strs.config_list), string.Join("\n", configNames));
await ctx.Channel.EmbedAsync(embed);
return;

View File

@@ -47,23 +47,23 @@ namespace NadekoBot.Modules.Utility
if (string.IsNullOrWhiteSpace(features))
features = "-";
var embed = _eb.Create()
.WithAuthor(GetText("server_info"))
.WithAuthor(GetText(strs.server_info))
.WithTitle(guild.Name)
.AddField(GetText("id"), guild.Id.ToString(), true)
.AddField(GetText("owner"), ownername.ToString(), true)
.AddField(GetText("members"), guild.MemberCount.ToString(), true)
.AddField(GetText("text_channels"), textchn.ToString(), true)
.AddField(GetText("voice_channels"), voicechn.ToString(), true)
.AddField(GetText("created_at"), $"{createdAt:dd.MM.yyyy HH:mm}", true)
.AddField(GetText("region"), guild.VoiceRegionId.ToString(), true)
.AddField(GetText("roles"), (guild.Roles.Count - 1).ToString(), true)
.AddField(GetText("features"), features, true)
.AddField(GetText(strs.id), guild.Id.ToString(), true)
.AddField(GetText(strs.owner), ownername.ToString(), true)
.AddField(GetText(strs.members), guild.MemberCount.ToString(), true)
.AddField(GetText(strs.text_channels), textchn.ToString(), true)
.AddField(GetText(strs.voice_channels), voicechn.ToString(), true)
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
.AddField(GetText(strs.region), guild.VoiceRegionId.ToString(), true)
.AddField(GetText(strs.roles), (guild.Roles.Count - 1).ToString(), true)
.AddField(GetText(strs.features), features, true)
.WithOkColor();
if (Uri.IsWellFormedUriString(guild.IconUrl, UriKind.Absolute))
embed.WithThumbnailUrl(guild.IconUrl);
if (guild.Emotes.Any())
{
embed.AddField(GetText("custom_emojis") + $"({guild.Emotes.Count})",
embed.AddField(GetText(strs.custom_emojis) + $"({guild.Emotes.Count})",
string.Join(" ", guild.Emotes
.Shuffle()
.Take(20)
@@ -85,9 +85,9 @@ namespace NadekoBot.Modules.Utility
var embed = _eb.Create()
.WithTitle(ch.Name)
.WithDescription(ch.Topic?.SanitizeMentions(true))
.AddField(GetText("id"), ch.Id.ToString(), true)
.AddField(GetText("created_at"), $"{createdAt:dd.MM.yyyy HH:mm}", true)
.AddField(GetText("users"), usercount.ToString(), true)
.AddField(GetText(strs.id), ch.Id.ToString(), true)
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
.AddField(GetText(strs.users), usercount.ToString(), true)
.WithOkColor();
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
@@ -102,15 +102,15 @@ namespace NadekoBot.Modules.Utility
return;
var embed = _eb.Create()
.AddField(GetText("name"), $"**{user.Username}**#{user.Discriminator}", true);
.AddField(GetText(strs.name), $"**{user.Username}**#{user.Discriminator}", true);
if (!string.IsNullOrWhiteSpace(user.Nickname))
{
embed.AddField(GetText("nickname"), user.Nickname, true);
embed.AddField(GetText(strs.nickname), user.Nickname, true);
}
embed.AddField(GetText("id"), user.Id.ToString(), true)
.AddField(GetText("joined_server"), $"{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm") ?? "?"}", true)
.AddField(GetText("joined_discord"), $"{user.CreatedAt:dd.MM.yyyy HH:mm}", true)
.AddField(GetText("roles"), $"**({user.RoleIds.Count - 1})** - {string.Join("\n", user.GetRoles().Take(10).Where(r => r.Id != r.Guild.EveryoneRole.Id).Select(r => r.Name)).SanitizeMentions(true)}", true)
embed.AddField(GetText(strs.id), user.Id.ToString(), true)
.AddField(GetText(strs.joined_server), $"{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm") ?? "?"}", true)
.AddField(GetText(strs.joined_discord), $"{user.CreatedAt:dd.MM.yyyy HH:mm}", true)
.AddField(GetText(strs.roles), $"**({user.RoleIds.Count - 1})** - {string.Join("\n", user.GetRoles().Take(10).Where(r => r.Id != r.Guild.EveryoneRole.Id).Select(r => r.Name)).SanitizeMentions(true)}", true)
.WithOkColor();
var av = user.RealAvatarUrl();

View File

@@ -56,7 +56,7 @@ namespace NadekoBot.Modules.Utility
{
return _eb.Create()
.WithErrorColor()
.WithDescription(GetText("no_invites"));
.WithDescription(GetText(strs.no_invites));
}
var embed = _eb.Create().WithOkColor();
@@ -69,8 +69,8 @@ namespace NadekoBot.Modules.Utility
var creator = inv.Inviter.ToString().TrimTo(25);
var usesString = $"{inv.Uses} / {(inv.MaxUses == 0 ? "" : inv.MaxUses?.ToString())}";
var desc = $@"`{GetText("inv_uses")}` **{usesString}**
`{GetText("inv_expire")}` **{expiryString}**
var desc = $@"`{GetText(strs.inv_uses)}` **{usesString}**
`{GetText(strs.inv_expire)}` **{expiryString}**
{inv.Url} ";
embed.AddField($"#{i++} {creator}", desc);

View File

@@ -37,11 +37,11 @@ namespace NadekoBot.Modules.Utility
var rem = (_service.Interval - (DateTime.UtcNow - _service.LastUpdate));
var helpcmd = Format.Code(Prefix + "donate");
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithDescription(GetText("clpa_obsolete"))
.AddField(GetText("clpa_fail_already_title"), GetText("clpa_fail_already"))
.AddField(GetText("clpa_fail_wait_title"), GetText("clpa_fail_wait"))
.AddField(GetText("clpa_fail_conn_title"), GetText("clpa_fail_conn"))
.AddField(GetText("clpa_fail_sup_title"), GetText("clpa_fail_sup", helpcmd))
.WithDescription(GetText(strs.clpa_obsolete))
.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)));
}
}

View File

@@ -114,9 +114,9 @@ namespace NadekoBot.Modules.Utility
await ctx.Channel.EmbedAsync(_eb.Create(ctx)
.WithOkColor()
.WithTitle(GetText("quote_id", $"#{data.Id}"))
.AddField(GetText("trigger"), data.Keyword)
.AddField(GetText("response"), data.Text.Length > 1000
? GetText("redacted_too_long")
.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})"))
).ConfigureAwait(false);
@@ -164,7 +164,7 @@ namespace NadekoBot.Modules.Utility
if (quote is null || quote.GuildId != ctx.Guild.Id)
{
await SendErrorAsync(GetText("quotes_notfound")).ConfigureAwait(false);
await SendErrorAsync(GetText(strs.quotes_notfound)).ConfigureAwait(false);
return;
}
@@ -215,7 +215,7 @@ namespace NadekoBot.Modules.Utility
if ((q?.GuildId != ctx.Guild.Id) || (!isAdmin && q.AuthorId != ctx.Message.Author.Id))
{
response = GetText("quotes_remove_none");
response = GetText(strs.quotes_remove_none);
}
else
{

View File

@@ -88,7 +88,7 @@ namespace NadekoBot.Modules.Utility
var embed = _eb.Create()
.WithOkColor()
.WithTitle(GetText("reminder_list"));
.WithTitle(GetText(strs.reminder_list));
List<Reminder> rems;
using (var uow = _db.GetDbContext())
@@ -113,7 +113,7 @@ namespace NadekoBot.Modules.Utility
}
else
{
embed.WithDescription(GetText("reminders_none"));
embed.WithDescription(GetText(strs.reminders_none));
}
embed.AddPaginatedFooter(page + 1, null);

View File

@@ -146,7 +146,7 @@ namespace NadekoBot.Modules.Utility
var description = GetRepeaterInfoString(runner);
await ctx.Channel.EmbedAsync(_eb.Create()
.WithOkColor()
.WithTitle(GetText("repeater_created"))
.WithTitle(GetText(strs.repeater_created))
.WithDescription(description));
}
@@ -163,7 +163,7 @@ namespace NadekoBot.Modules.Utility
}
var embed = _eb.Create()
.WithTitle(GetText("list_of_repeaters"))
.WithTitle(GetText(strs.list_of_repeaters))
.WithOkColor();
var i = 0;
@@ -190,13 +190,13 @@ namespace NadekoBot.Modules.Utility
string description = "";
if (_service.IsNoRedundant(runner.Repeater.Id))
{
description = Format.Underline(Format.Bold(GetText("no_redundant"))) + "\n\n";
description = Format.Underline(Format.Bold(GetText(strs.no_redundant))) + "\n\n";
}
description += $"<#{runner.Repeater.ChannelId}>\n" +
$"`{GetText("Comment")}` {intervalString}\n" +
$"`{GetText("executes_in_colon")}` {executesInString}\n" +
$"`{GetText("message_colon")}` {message}";
$"`{GetText(strs.interval_colon)}` {intervalString}\n" +
$"`{GetText(strs.executes_in_colon)}` {executesInString}\n" +
$"`{GetText(strs.message_colon)}` {message}";
return description;
}

View File

@@ -21,7 +21,7 @@ namespace NadekoBot.Modules.Utility
var units = _service.Units;
var embed = _eb.Create()
.WithTitle(GetText("convertlist"))
.WithTitle(GetText(strs.convertlist))
.WithOkColor();

View File

@@ -114,7 +114,7 @@ namespace NadekoBot.Modules.Utility
.ToList();
if (pageUsers.Count == 0)
return _eb.Create().WithOkColor().WithDescription(GetText("no_user_on_this_page"));
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}")
@@ -234,7 +234,7 @@ namespace NadekoBot.Modules.Utility
if (string.IsNullOrWhiteSpace(topic))
await ReplyErrorLocalizedAsync("no_topic_set").ConfigureAwait(false);
else
await SendConfirmAsync(GetText("channel_topic"), topic).ConfigureAwait(false);
await SendConfirmAsync(GetText(strs.channel_topic), topic).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -249,16 +249,16 @@ namespace NadekoBot.Modules.Utility
.WithAuthor($"NadekoBot v{StatsService.BotVersion}",
"https://nadeko-pictures.nyc3.digitaloceanspaces.com/other/avatar.png",
"https://nadekobot.readthedocs.io/en/latest/")
.AddField(GetText(Strs.author), _stats.Author, true)
.AddField(GetText("botid"), _client.CurrentUser.Id.ToString(), true)
.AddField(GetText("shard"), $"#{_client.ShardId} / {_creds.TotalShards}", true)
.AddField(GetText("commands_ran"), _stats.CommandsRan.ToString(), true)
.AddField(GetText("messages"), $"{_stats.MessageCounter} ({_stats.MessagesPerSecond:F2}/sec)",
.AddField(GetText(strs.author), _stats.Author, true)
.AddField(GetText(strs.botid), _client.CurrentUser.Id.ToString(), true)
.AddField(GetText(strs.shard), $"#{_client.ShardId} / {_creds.TotalShards}", true)
.AddField(GetText(strs.commands_ran), _stats.CommandsRan.ToString(), true)
.AddField(GetText(strs.messages), $"{_stats.MessageCounter} ({_stats.MessagesPerSecond:F2}/sec)",
true)
.AddField(GetText("memory"), $"{_stats.Heap} MB", true)
.AddField(GetText("owner_ids"), ownerIds, true)
.AddField(GetText("uptime"), _stats.GetUptimeString("\n"), true)
.AddField(GetText("presence"),
.AddField(GetText(strs.memory), $"{_stats.Heap} MB", true)
.AddField(GetText(strs.owner_ids), ownerIds, true)
.AddField(GetText(strs.uptime), _stats.GetUptimeString("\n"), true)
.AddField(GetText(strs.presence),
GetText("presence_txt",
_coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels), true))
.ConfigureAwait(false);

View File

@@ -139,11 +139,11 @@ namespace NadekoBot.Modules.Xp
.WithOkColor()
.WithTitle($"{club.ToString()}")
.WithDescription(GetText("level_x", lvl.Level) + $" ({club.Xp} xp)")
.AddField(GetText("desc"), string.IsNullOrWhiteSpace(club.Description) ? "-" : club.Description,
.AddField(GetText(strs.desc), string.IsNullOrWhiteSpace(club.Description) ? "-" : club.Description,
false)
.AddField(GetText("owner"), club.Owner.ToString(), true)
.AddField(GetText("level_req"), club.MinimumLevelReq.ToString(), true)
.AddField(GetText("members"), string.Join("\n", users
.AddField(GetText(strs.owner), club.Owner.ToString(), true)
.AddField(GetText(strs.level_req), club.MinimumLevelReq.ToString(), true)
.AddField(GetText(strs.members), string.Join("\n", users
.Skip(page * 10)
.Take(10)
.Select(x =>

View File

@@ -23,8 +23,8 @@ namespace NadekoBot.Modules.Xp
public async Task XpReset(ulong userId)
{
var embed = _eb.Create()
.WithTitle(GetText("reset"))
.WithDescription(GetText("reset_user_confirm"));
.WithTitle(GetText(strs.reset))
.WithDescription(GetText(strs.reset_user_confirm));
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
return;
@@ -40,8 +40,8 @@ namespace NadekoBot.Modules.Xp
public async Task XpReset()
{
var embed = _eb.Create()
.WithTitle(GetText("reset"))
.WithDescription(GetText("reset_server_confirm"));
.WithTitle(GetText(strs.reset))
.WithDescription(GetText(strs.reset_server_confirm));
if (!await PromptUserConfirmAsync(embed).ConfigureAwait(false))
return;

View File

@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Xp
{
var reply = await PromptUserConfirmAsync(_eb.Create()
.WithPendingColor()
.WithDescription(GetText("xprewsreset_confirm")));
.WithDescription(GetText(strs.xprewsreset_confirm)));
if (!reply)
return;
@@ -92,7 +92,7 @@ namespace NadekoBot.Modules.Xp
return Context.SendPaginatedConfirmAsync(page, cur =>
{
var embed = _eb.Create()
.WithTitle(GetText("level_up_rewards"))
.WithTitle(GetText(strs.level_up_rewards))
.WithOkColor();
var localRewards = allRewards
@@ -101,7 +101,7 @@ namespace NadekoBot.Modules.Xp
.ToList();
if (!localRewards.Any())
return embed.WithDescription(GetText("no_level_up_rewards"));
return embed.WithDescription(GetText(strs.no_level_up_rewards));
foreach (var reward in localRewards)
{
@@ -182,15 +182,15 @@ namespace NadekoBot.Modules.Xp
{
if (loc == XpNotificationLocation.Channel)
{
return GetText("xpn_notif_channel");
return GetText(strs.xpn_notif_channel);
}
if (loc == XpNotificationLocation.Dm)
{
return GetText("xpn_notif_dm");
return GetText(strs.xpn_notif_dm);
}
return GetText("xpn_notif_disabled");
return GetText(strs.xpn_notif_disabled);
}
[NadekoCommand, Aliases]
@@ -202,8 +202,8 @@ namespace NadekoBot.Modules.Xp
var embed = _eb.Create()
.WithOkColor()
.AddField(GetText("xpn_setting_global"), GetNotifLocationString(globalSetting))
.AddField(GetText("xpn_setting_server"), GetNotifLocationString(serverSetting));
.AddField(GetText(strs.xpn_setting_global), GetNotifLocationString(globalSetting))
.AddField(GetText(strs.xpn_setting_server), GetNotifLocationString(serverSetting));
await ctx.Channel.EmbedAsync(embed);
}
@@ -280,8 +280,8 @@ namespace NadekoBot.Modules.Xp
var rolesStr = roles.Any() ? string.Join("\n", roles) + "\n" : string.Empty;
var chansStr = chans.Count > 0 ? string.Join("\n", chans) + "\n" : string.Empty;
var desc = Format.Code(serverExcluded
? GetText("server_is_excluded")
: GetText("server_is_not_excluded"));
? GetText(strs.server_is_excluded)
: GetText(strs.server_is_not_excluded));
desc += "\n\n" + rolesStr + chansStr;
@@ -289,7 +289,7 @@ namespace NadekoBot.Modules.Xp
await ctx.SendPaginatedConfirmAsync(0, curpage =>
{
var embed = _eb.Create()
.WithTitle(GetText("exclusion_list"))
.WithTitle(GetText(strs.exclusion_list))
.WithDescription(string.Join('\n', lines.Skip(15 * curpage).Take(15)))
.WithOkColor();
@@ -332,7 +332,7 @@ namespace NadekoBot.Modules.Xp
await ctx.SendPaginatedConfirmAsync(page, (curPage) =>
{
var embed = _eb.Create()
.WithTitle(GetText("server_leaderboard"))
.WithTitle(GetText(strs.server_leaderboard))
.WithOkColor();
List<UserXpStats> users;
@@ -380,7 +380,7 @@ namespace NadekoBot.Modules.Xp
var users = _service.GetUserXps(page);
var embed = _eb.Create()
.WithTitle(GetText("global_leaderboard"))
.WithTitle(GetText(strs.global_leaderboard))
.WithOkColor();
if (!users.Any())

View File

@@ -16,6 +16,7 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
@@ -375,5 +376,22 @@ 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)
=> strings.GetText(str.Key, culture);
public static string GetText<T>(this IBotStrings strings, LocStr<T> str, ulong? guildId, T obj1)
=> strings.GetText(str.Key, guildId, obj1);
public static string GetText<T>(this IBotStrings strings, LocStr<T> str, CultureInfo culture, T obj1)
=> strings.GetText(str.Key, culture, obj1);
public static string GetText<T1, T2>(this IBotStrings strings, LocStr<T1, T2> str, ulong? guildId, T1 obj1, T2 obj2)
=> strings.GetText(str.Key, guildId, obj1, obj2);
public static string GetText<T1, T2>(this IBotStrings strings, LocStr<T1, T2> str, CultureInfo culture, T1 obj1, T2 obj2)
=> strings.GetText(str.Key, culture, obj1, obj2);
}
}