mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
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:
@@ -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);
|
||||
}
|
||||
|
@@ -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))
|
||||
|
@@ -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()}")));
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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()
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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))),
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user