Changed (almost) all responses to make them use the new system instead of raw strings

- Fixed many invalid string keys
This commit is contained in:
Kwoth
2021-07-30 22:42:10 +02:00
parent 4484732f5d
commit 919bedeae6
80 changed files with 883 additions and 859 deletions

View File

@@ -87,12 +87,12 @@ namespace NadekoBot.Modules.Administration
if (_service.ToggleDeleteMessageOnCommand(ctx.Guild.Id))
{
_service.DeleteMessagesOnCommand.Add(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync("delmsg_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.delmsg_on).ConfigureAwait(false);
}
else
{
_service.DeleteMessagesOnCommand.TryRemove(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync("delmsg_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.delmsg_off).ConfigureAwait(false);
}
}
@@ -131,15 +131,15 @@ namespace NadekoBot.Modules.Administration
if (s == State.Disable)
{
await ReplyConfirmLocalizedAsync("delmsg_channel_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_off).ConfigureAwait(false);
}
else if (s == State.Enable)
{
await ReplyConfirmLocalizedAsync("delmsg_channel_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_on).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("delmsg_channel_inherit").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_inherit).ConfigureAwait(false);
}
}
@@ -150,7 +150,7 @@ namespace NadekoBot.Modules.Administration
public async Task Deafen(params IGuildUser[] users)
{
await _service.DeafenUsers(true, users).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("deafen").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.deafen).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -160,7 +160,7 @@ namespace NadekoBot.Modules.Administration
public async Task UnDeafen(params IGuildUser[] users)
{
await _service.DeafenUsers(false, users).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("undeafen").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.undeafen).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -170,7 +170,7 @@ namespace NadekoBot.Modules.Administration
public async Task DelVoiChanl([Leftover] IVoiceChannel voiceChannel)
{
await voiceChannel.DeleteAsync().ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("delvoich", Format.Bold(voiceChannel.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.delvoich(Format.Bold(voiceChannel.Name))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -180,7 +180,7 @@ namespace NadekoBot.Modules.Administration
public async Task CreatVoiChanl([Leftover] string channelName)
{
var ch = await ctx.Guild.CreateVoiceChannelAsync(channelName).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("createvoich", Format.Bold(ch.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.createvoich(Format.Bold(ch.Name))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -190,7 +190,7 @@ namespace NadekoBot.Modules.Administration
public async Task DelTxtChanl([Leftover] ITextChannel toDelete)
{
await toDelete.DeleteAsync().ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("deltextchan", Format.Bold(toDelete.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.deltextchan(Format.Bold(toDelete.Name))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -200,7 +200,7 @@ namespace NadekoBot.Modules.Administration
public async Task CreaTxtChanl([Leftover] string channelName)
{
var txtCh = await ctx.Guild.CreateTextChannelAsync(channelName).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("createtextchan", Format.Bold(txtCh.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.createtextchan(Format.Bold(txtCh.Name))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -212,7 +212,7 @@ namespace NadekoBot.Modules.Administration
var channel = (ITextChannel) ctx.Channel;
topic = topic ?? "";
await channel.ModifyAsync(c => c.Topic = topic).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("set_topic").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.set_topic).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -223,7 +223,7 @@ namespace NadekoBot.Modules.Administration
{
var channel = (ITextChannel) ctx.Channel;
await channel.ModifyAsync(c => c.Name = name).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("set_channel_name").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.set_channel_name).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -238,9 +238,9 @@ namespace NadekoBot.Modules.Administration
await channel.ModifyAsync(c => c.IsNsfw = !isEnabled).ConfigureAwait(false);
if (isEnabled)
await ReplyConfirmLocalizedAsync("nsfw_set_false").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.nsfw_set_false).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("nsfw_set_true").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.nsfw_set_true).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -259,13 +259,13 @@ namespace NadekoBot.Modules.Administration
var botPerms = ((SocketGuild) ctx.Guild).CurrentUser.GetPermissions(channel);
if (!userPerms.Has(ChannelPermission.ManageMessages))
{
await ReplyErrorLocalizedAsync("insuf_perms_u").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuf_perms_u).ConfigureAwait(false);
return;
}
if (!botPerms.Has(ChannelPermission.ViewChannel))
{
await ReplyErrorLocalizedAsync("insuf_perms_i").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuf_perms_i).ConfigureAwait(false);
return;
}
@@ -293,13 +293,13 @@ namespace NadekoBot.Modules.Administration
var botPerms = ((SocketGuild) ctx.Guild).CurrentUser.GetPermissions(channel);
if (!userPerms.Has(ChannelPermission.ManageMessages))
{
await ReplyErrorLocalizedAsync("insuf_perms_u").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuf_perms_u).ConfigureAwait(false);
return;
}
if (!botPerms.Has(ChannelPermission.ManageMessages))
{
await ReplyErrorLocalizedAsync("insuf_perms_i").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuf_perms_i).ConfigureAwait(false);
return;
}
@@ -307,7 +307,7 @@ namespace NadekoBot.Modules.Administration
var msg = await channel.GetMessageAsync(messageId).ConfigureAwait(false);
if (msg is null)
{
await ReplyErrorLocalizedAsync("msg_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.msg_not_found).ConfigureAwait(false);
return;
}
@@ -325,7 +325,7 @@ namespace NadekoBot.Modules.Administration
}
else
{
await ReplyErrorLocalizedAsync("time_too_long").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.time_too_long).ConfigureAwait(false);
return;
}

View File

@@ -25,14 +25,14 @@ namespace NadekoBot.Modules.Administration
// the user can't aar the role which is higher or equal to his highest role
if (ctx.User.Id != guser.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= role.Position)
{
await ReplyErrorLocalizedAsync("hierarchy");
await ReplyErrorLocalizedAsync(strs.hierarchy);
return;
}
var roles = await _service.ToggleAarAsync(ctx.Guild.Id, role.Id);
if (roles.Count == 0)
{
await ReplyConfirmLocalizedAsync("aar_disabled");
await ReplyConfirmLocalizedAsync(strs.aar_disabled);
}
else if (roles.Contains(role.Id))
{
@@ -40,7 +40,7 @@ namespace NadekoBot.Modules.Administration
}
else
{
await ReplyConfirmLocalizedAsync("aar_role_removed", Format.Bold(role.ToString()));
await ReplyConfirmLocalizedAsync(strs.aar_role_removed(Format.Bold(role.ToString())));
}
}
@@ -51,7 +51,7 @@ namespace NadekoBot.Modules.Administration
{
if (!_service.TryGetRoles(ctx.Guild.Id, out var roles))
{
await ReplyConfirmLocalizedAsync("aar_none");
await ReplyConfirmLocalizedAsync(strs.aar_none);
return;
}
@@ -63,9 +63,9 @@ namespace NadekoBot.Modules.Administration
await _service.SetAarRolesAsync(ctx.Guild.Id, existing.Select(x => x.Id));
}
await ReplyConfirmLocalizedAsync("aar_roles",
await ReplyConfirmLocalizedAsync(strs.aar_roles(
'\n' + existing.Select(x => Format.Bold(x.ToString()))
.JoinWith(",\n"));
.JoinWith(",\n")));
}
}
}

View File

@@ -24,16 +24,16 @@ namespace NadekoBot.Modules.Administration
if (perms is null || perms.Length == 0)
{
await _service.RemoveOverride(ctx.Guild.Id, cmd.Name);
await ReplyConfirmLocalizedAsync("perm_override_reset");
await ReplyConfirmLocalizedAsync(strs.perm_override_reset);
return;
}
var aggregatePerms = perms.Aggregate((acc, seed) => seed | acc);
await _service.AddOverride(ctx.Guild.Id, cmd.Name, aggregatePerms);
await ReplyConfirmLocalizedAsync("perm_override",
await ReplyConfirmLocalizedAsync(strs.perm_override(
Format.Bold(aggregatePerms.ToString()),
Format.Code(cmd.Name));
Format.Code(cmd.Name)));
}
[NadekoCommand, Aliases]
@@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Administration
return;
await _service.ClearAllOverrides(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync("perm_override_all");
await ReplyConfirmLocalizedAsync(strs.perm_override_all);
}
[NadekoCommand, Aliases]

View File

@@ -21,19 +21,19 @@ namespace NadekoBot.Modules.Administration
if (vch is null)
{
await ReplyErrorLocalizedAsync("not_in_voice").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_in_voice).ConfigureAwait(false);
return;
}
var id = _service.ToggleGameVoiceChannel(ctx.Guild.Id, vch.Id);
if (id is null)
{
await ReplyConfirmLocalizedAsync("gvc_disabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.gvc_disabled).ConfigureAwait(false);
}
else
{
_service.GameVoiceChannels.Add(vch.Id);
await ReplyConfirmLocalizedAsync("gvc_enabled", Format.Bold(vch.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.gvc_enabled(Format.Bold(vch.Name))).ConfigureAwait(false);
}
}
}

View File

@@ -51,9 +51,9 @@ namespace NadekoBot.Modules.Administration
[Priority(0)]
public async Task LanguageSet()
{
await ReplyConfirmLocalizedAsync("lang_set_show", Format.Bold(_cultureInfo.ToString()),
Format.Bold(_cultureInfo.NativeName))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.lang_set_show(
Format.Bold(_cultureInfo.ToString()),
Format.Bold(_cultureInfo.NativeName)));
}
[NadekoCommand, Aliases]
@@ -76,12 +76,12 @@ namespace NadekoBot.Modules.Administration
Localization.SetGuildCulture(ctx.Guild, ci);
}
await ReplyConfirmLocalizedAsync("lang_set", Format.Bold(ci.ToString()), Format.Bold(ci.NativeName))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.lang_set(Format.Bold(ci.ToString()),
Format.Bold(ci.NativeName)));
}
catch (Exception)
{
await ReplyErrorLocalizedAsync("lang_set_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.lang_set_fail).ConfigureAwait(false);
}
}
@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Administration
public async Task LanguageSetDefault()
{
var cul = Localization.DefaultCultureInfo;
await ReplyConfirmLocalizedAsync("lang_set_bot_show", cul, cul.NativeName).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.lang_set_bot_show(cul, cul.NativeName));
}
[NadekoCommand, Aliases]
@@ -110,12 +110,12 @@ namespace NadekoBot.Modules.Administration
Localization.SetDefaultCulture(ci);
}
await ReplyConfirmLocalizedAsync("lang_set_bot", Format.Bold(ci.ToString()),
Format.Bold(ci.NativeName)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.lang_set_bot(Format.Bold(ci.ToString()),
Format.Bold(ci.NativeName)));
}
catch (Exception)
{
await ReplyErrorLocalizedAsync("lang_set_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.lang_set_fail).ConfigureAwait(false);
}
}

View File

@@ -32,9 +32,9 @@ namespace NadekoBot.Modules.Administration
{
await _service.LogServer(ctx.Guild.Id, ctx.Channel.Id, action.Value).ConfigureAwait(false);
if (action.Value)
await ReplyConfirmLocalizedAsync("log_all").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.log_all).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("log_disabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.log_disabled).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -48,9 +48,9 @@ namespace NadekoBot.Modules.Administration
var removed = _service.LogIgnore(ctx.Guild.Id, ctx.Channel.Id);
if (!removed)
await ReplyConfirmLocalizedAsync("log_ignore", Format.Bold(channel.Mention + "(" + channel.Id + ")")).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.log_ignore(Format.Bold(channel.Mention + "(" + channel.Id + ")"))).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("log_not_ignore", Format.Bold(channel.Mention + "(" + channel.Id + ")")).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.log_not_ignore(Format.Bold(channel.Mention + "(" + channel.Id + ")"))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -122,9 +122,9 @@ namespace NadekoBot.Modules.Administration
var val = _service.Log(ctx.Guild.Id, ctx.Channel.Id, type);
if (val)
await ReplyConfirmLocalizedAsync("log", Format.Bold(type.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.log(Format.Bold(type.ToString()))).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("log_stop", Format.Bold(type.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.log_stop(Format.Bold(type.ToString()))).ConfigureAwait(false);
}
}
}

View File

@@ -24,7 +24,7 @@ namespace NadekoBot.Modules.Administration
if (runnerUser.Id != ctx.Guild.OwnerId &&
runnerUserRoles.Max(x => x.Position) <= targetUserRoles.Max(x => x.Position))
{
await ReplyErrorLocalizedAsync("mute_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_perms).ConfigureAwait(false);
return false;
}
@@ -39,20 +39,20 @@ namespace NadekoBot.Modules.Administration
if (role is null)
{
var muteRole = await _service.GetMuteRole(ctx.Guild).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("mute_role", Format.Code(muteRole.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.mute_role(Format.Code(muteRole.Name))).ConfigureAwait(false);
return;
}
if (ctx.User.Id != ctx.Guild.OwnerId &&
role.Position >= ((SocketGuildUser) ctx.User).Roles.Max(x => x.Position))
{
await ReplyErrorLocalizedAsync("insuf_perms_u").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuf_perms_u).ConfigureAwait(false);
return;
}
await _service.SetMuteRoleAsync(ctx.Guild.Id, role.Name).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("mute_role_set").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.mute_role_set).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -67,12 +67,12 @@ namespace NadekoBot.Modules.Administration
return;
await _service.MuteUser(target, ctx.User, reason: reason).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_muted", Format.Bold(target.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.user_muted(Format.Bold(target.ToString()))).ConfigureAwait(false);
}
catch (Exception ex)
{
Log.Warning(ex.ToString());
await ReplyErrorLocalizedAsync("mute_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
}
}
@@ -90,12 +90,12 @@ namespace NadekoBot.Modules.Administration
return;
await _service.TimedMute(user, ctx.User, time.Time, reason: reason).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_muted_time", Format.Bold(user.ToString()), (int)time.Time.TotalMinutes).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.user_muted_time(Format.Bold(user.ToString()), (int)time.Time.TotalMinutes));
}
catch (Exception ex)
{
Log.Warning(ex, "Error in mute command");
await ReplyErrorLocalizedAsync("mute_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
}
}
@@ -107,11 +107,11 @@ namespace NadekoBot.Modules.Administration
try
{
await _service.UnmuteUser(user.GuildId, user.Id, ctx.User, reason: reason).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_unmuted", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.user_unmuted(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
catch
{
await ReplyErrorLocalizedAsync("mute_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
}
}
@@ -127,12 +127,12 @@ namespace NadekoBot.Modules.Administration
return;
await _service.MuteUser(user, ctx.User, MuteType.Chat, reason: reason).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_chat_mute", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.user_chat_mute(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
catch (Exception ex)
{
Log.Warning(ex.ToString());
await ReplyErrorLocalizedAsync("mute_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
}
}
@@ -150,12 +150,12 @@ namespace NadekoBot.Modules.Administration
return;
await _service.TimedMute(user, ctx.User, time.Time, MuteType.Chat, reason: reason).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_chat_mute_time", Format.Bold(user.ToString()), (int)time.Time.TotalMinutes).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.user_chat_mute_time(Format.Bold(user.ToString()), (int)time.Time.TotalMinutes));
}
catch (Exception ex)
{
Log.Warning(ex.ToString());
await ReplyErrorLocalizedAsync("mute_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
}
}
@@ -167,11 +167,11 @@ namespace NadekoBot.Modules.Administration
try
{
await _service.UnmuteUser(user.Guild.Id, user.Id, ctx.User, MuteType.Chat, reason: reason).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_chat_unmute", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.user_chat_unmute(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
catch
{
await ReplyErrorLocalizedAsync("mute_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
}
}
@@ -187,11 +187,11 @@ namespace NadekoBot.Modules.Administration
return;
await _service.MuteUser(user, ctx.User, MuteType.Voice, reason: reason).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_voice_mute", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.user_voice_mute(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
catch
{
await ReplyErrorLocalizedAsync("mute_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
}
}
@@ -209,11 +209,11 @@ namespace NadekoBot.Modules.Administration
return;
await _service.TimedMute(user, ctx.User, time.Time, MuteType.Voice, reason: reason).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_voice_mute_time", Format.Bold(user.ToString()), (int)time.Time.TotalMinutes).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.user_voice_mute_time(Format.Bold(user.ToString()), (int)time.Time.TotalMinutes));
}
catch
{
await ReplyErrorLocalizedAsync("mute_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
}
}
@@ -225,11 +225,11 @@ namespace NadekoBot.Modules.Administration
try
{
await _service.UnmuteUser(user.GuildId, user.Id, ctx.User, MuteType.Voice, reason: reason).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_voice_unmute", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.user_voice_unmute(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
catch
{
await ReplyErrorLocalizedAsync("mute_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mute_error).ConfigureAwait(false);
}
}
}

View File

@@ -17,9 +17,9 @@ namespace NadekoBot.Modules.Administration
public async Task RotatePlaying()
{
if (_service.ToggleRotatePlaying())
await ReplyConfirmLocalizedAsync("ropl_enabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.ropl_enabled).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("ropl_disabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.ropl_disabled).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -28,7 +28,7 @@ namespace NadekoBot.Modules.Administration
{
await _service.AddPlaying(t, status).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("ropl_added").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.ropl_added).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -39,14 +39,13 @@ namespace NadekoBot.Modules.Administration
if (!statuses.Any())
{
await ReplyErrorLocalizedAsync("ropl_not_set").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.ropl_not_set).ConfigureAwait(false);
}
else
{
var i = 1;
await ReplyConfirmLocalizedAsync("ropl_list",
string.Join("\n\t", statuses.Select(rs => $"`{i++}.` *{rs.Type}* {rs.Status}")))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.ropl_list(
string.Join("\n\t", statuses.Select(rs => $"`{i++}.` *{rs.Type}* {rs.Status}"))));
}
}
@@ -62,7 +61,7 @@ namespace NadekoBot.Modules.Administration
if (msg is null)
return;
await ReplyConfirmLocalizedAsync("reprm", msg).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.reprm(msg));
}
}
}

View File

@@ -14,7 +14,7 @@ namespace NadekoBot.Modules.Administration
[Priority(1)]
public async Task PrefixCommand()
{
await ReplyConfirmLocalizedAsync("prefix_current", Format.Code(CmdHandler.GetPrefix(ctx.Guild))).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.prefix_current(Format.Code(CmdHandler.GetPrefix(ctx.Guild)))).ConfigureAwait(false);
}
public enum Set
@@ -41,7 +41,7 @@ namespace NadekoBot.Modules.Administration
var oldPrefix = base.Prefix;
var newPrefix = CmdHandler.SetPrefix(ctx.Guild, prefix);
await ReplyConfirmLocalizedAsync("prefix_new", Format.Code(oldPrefix), Format.Code(newPrefix)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.prefix_new(Format.Code(oldPrefix), Format.Code(newPrefix))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -50,14 +50,14 @@ namespace NadekoBot.Modules.Administration
{
if (string.IsNullOrWhiteSpace(prefix))
{
await ReplyConfirmLocalizedAsync("defprefix_current", CmdHandler.GetPrefix()).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.defprefix_current(CmdHandler.GetPrefix())).ConfigureAwait(false);
return;
}
var oldPrefix = CmdHandler.GetPrefix();
var newPrefix = CmdHandler.SetDefaultPrefix(prefix);
await ReplyConfirmLocalizedAsync("defprefix_new", Format.Code(oldPrefix), Format.Code(newPrefix)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.defprefix_new(Format.Code(oldPrefix), Format.Code(newPrefix))).ConfigureAwait(false);
}
}
}

View File

@@ -24,11 +24,11 @@ namespace NadekoBot.Modules.Administration
{
if (await _service.TryStopAntiAlt(ctx.Guild.Id))
{
await ReplyConfirmLocalizedAsync("prot_disable", "Anti-Alt");
await ReplyErrorLocalizedAsync(strs.prot_disable("Anti-Alt"));
return;
}
await ReplyErrorLocalizedAsync("protection_not_running", "Anti-Alt");
await ReplyErrorLocalizedAsync(strs.protection_not_running("Anti-Alt"));
}
[NadekoCommand, Aliases]
@@ -69,11 +69,11 @@ namespace NadekoBot.Modules.Administration
{
if (_service.TryStopAntiRaid(ctx.Guild.Id))
{
return ReplyConfirmLocalizedAsync("prot_disable", "Anti-Raid");
return ReplyErrorLocalizedAsync(strs.prot_disable("Anti-Raid"));
}
else
{
return ReplyErrorLocalizedAsync("protection_not_running", "Anti-Raid");
return ReplyErrorLocalizedAsync(strs.protection_not_running("Anti-Raid"));
}
}
@@ -97,19 +97,19 @@ namespace NadekoBot.Modules.Administration
{
if (action == PunishmentAction.AddRole)
{
await ReplyErrorLocalizedAsync("punishment_unsupported", action);
await ReplyErrorLocalizedAsync(strs.punishment_unsupported(action));
return;
}
if (userThreshold < 2 || userThreshold > 30)
{
await ReplyErrorLocalizedAsync("raid_cnt", 2, 30).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.raid_cnt(2, 30));
return;
}
if (seconds < 2 || seconds > 300)
{
await ReplyErrorLocalizedAsync("raid_time", 2, 300).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.raid_time(2, 300));
return;
}
@@ -117,7 +117,7 @@ namespace NadekoBot.Modules.Administration
{
if (!_service.IsDurationAllowed(action))
{
await ReplyErrorLocalizedAsync("prot_cant_use_time");
await ReplyErrorLocalizedAsync(strs.prot_cant_use_time);
}
}
@@ -145,11 +145,11 @@ namespace NadekoBot.Modules.Administration
{
if (_service.TryStopAntiSpam(ctx.Guild.Id))
{
return ReplyConfirmLocalizedAsync("prot_disable", "Anti-Spam");
return ReplyErrorLocalizedAsync(strs.prot_disable("Anti-Spam"));
}
else
{
return ReplyErrorLocalizedAsync("protection_not_running", "Anti-Spam");
return ReplyErrorLocalizedAsync(strs.protection_not_running("Anti-Spam"));
}
}
@@ -189,7 +189,7 @@ namespace NadekoBot.Modules.Administration
{
if (!_service.IsDurationAllowed(action))
{
await ReplyErrorLocalizedAsync("prot_cant_use_time");
await ReplyErrorLocalizedAsync(strs.prot_cant_use_time);
}
}
@@ -212,11 +212,14 @@ namespace NadekoBot.Modules.Administration
if(added is null)
{
await ReplyErrorLocalizedAsync("protection_not_running", "Anti-Spam").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.protection_not_running("Anti-Spam"));
return;
}
await ReplyConfirmLocalizedAsync(added.Value ? "spam_ignore" : "spam_not_ignore", "Anti-Spam").ConfigureAwait(false);
if (added.Value)
await ReplyConfirmLocalizedAsync(strs.spam_ignore("Anti-Spam"));
else
await ReplyConfirmLocalizedAsync(strs.spam_not_ignore("Anti-Spam"));
}
[NadekoCommand, Aliases]
@@ -227,7 +230,7 @@ namespace NadekoBot.Modules.Administration
if (spam is null && raid is null && alt is null)
{
await ReplyConfirmLocalizedAsync("prot_none").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.prot_none).ConfigureAwait(false);
return;
}

View File

@@ -76,7 +76,7 @@ namespace NadekoBot.Modules.Administration
}
catch (Discord.Net.HttpException ex) when(ex.HttpCode == HttpStatusCode.BadRequest)
{
await ReplyErrorLocalizedAsync("reaction_cant_access", Format.Code(x.emote.ToString()));
await ReplyErrorLocalizedAsync(strs.reaction_cant_access(Format.Code(x.emote.ToString())));
return;
}
@@ -102,7 +102,7 @@ namespace NadekoBot.Modules.Administration
}
else
{
await ReplyErrorLocalizedAsync("reaction_roles_full").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.reaction_roles_full).ConfigureAwait(false);
}
}
@@ -171,7 +171,7 @@ namespace NadekoBot.Modules.Administration
index--;
var rr = rrs[index];
_service.Remove(ctx.Guild.Id, index);
await ReplyConfirmLocalizedAsync("reaction_role_removed", index + 1).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.reaction_role_removed(index + 1));
}
[NadekoCommand, Aliases]
@@ -188,13 +188,14 @@ namespace NadekoBot.Modules.Administration
{
await targetUser.AddRoleAsync(roleToAdd).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("setrole", Format.Bold(roleToAdd.Name), Format.Bold(targetUser.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(
strs.setrole(Format.Bold(roleToAdd.Name),
Format.Bold(targetUser.ToString())));
}
catch (Exception ex)
{
Log.Warning(ex, "Error in setrole command");
await ReplyErrorLocalizedAsync("setrole_err").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.setrole_err).ConfigureAwait(false);
}
}
@@ -210,11 +211,11 @@ namespace NadekoBot.Modules.Administration
try
{
await targetUser.RemoveRoleAsync(roleToRemove).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("remrole", Format.Bold(roleToRemove.Name), Format.Bold(targetUser.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.remrole(Format.Bold(roleToRemove.Name), Format.Bold(targetUser.ToString()))).ConfigureAwait(false);
}
catch
{
await ReplyErrorLocalizedAsync("remrole_err").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.remrole_err).ConfigureAwait(false);
}
}
@@ -231,15 +232,15 @@ namespace NadekoBot.Modules.Administration
{
if (roleToEdit.Position > (await ctx.Guild.GetCurrentUserAsync().ConfigureAwait(false)).GetRoles().Max(r => r.Position))
{
await ReplyErrorLocalizedAsync("renrole_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.renrole_perms).ConfigureAwait(false);
return;
}
await roleToEdit.ModifyAsync(g => g.Name = newname).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("renrole").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.renrole).ConfigureAwait(false);
}
catch (Exception)
{
await ReplyErrorLocalizedAsync("renrole_err").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.renrole_err).ConfigureAwait(false);
}
}
@@ -260,11 +261,11 @@ namespace NadekoBot.Modules.Administration
try
{
await user.RemoveRolesAsync(userRoles).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("rar", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.rar(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
catch (Exception)
{
await ReplyErrorLocalizedAsync("rar_err").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.rar_err).ConfigureAwait(false);
}
}
@@ -278,7 +279,7 @@ namespace NadekoBot.Modules.Administration
return;
var r = await ctx.Guild.CreateRoleAsync(roleName, isMentionable: false).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("cr", Format.Bold(r.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.cr(Format.Bold(r.Name))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -293,7 +294,7 @@ namespace NadekoBot.Modules.Administration
return;
await role.DeleteAsync().ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("dr", Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.dr(Format.Bold(role.Name))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -306,11 +307,11 @@ namespace NadekoBot.Modules.Administration
await role.ModifyAsync(r => r.Hoist = newHoisted).ConfigureAwait(false);
if (newHoisted)
{
await ReplyConfirmLocalizedAsync("rolehoist_enabled", Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.rolehoist_enabled(Format.Bold(role.Name))).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("rolehoist_disabled", Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.rolehoist_disabled(Format.Bold(role.Name))).ConfigureAwait(false);
}
}
@@ -333,11 +334,11 @@ namespace NadekoBot.Modules.Administration
{
var rgba32 = color.ToPixel<Rgba32>();
await role.ModifyAsync(r => r.Color = new Color(rgba32.R, rgba32.G, rgba32.B)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("rc", Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.rc(Format.Bold(role.Name))).ConfigureAwait(false);
}
catch (Exception)
{
await ReplyErrorLocalizedAsync("rc_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.rc_perms).ConfigureAwait(false);
}
}
}

View File

@@ -24,11 +24,11 @@ namespace NadekoBot.Modules.Administration
if (newVal)
{
await ReplyConfirmLocalizedAsync("adsarm_enable", Prefix).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.adsarm_enable(Prefix));
}
else
{
await ReplyConfirmLocalizedAsync("adsarm_disable", Prefix).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.adsarm_disable(Prefix));
}
}
@@ -55,11 +55,11 @@ namespace NadekoBot.Modules.Administration
if (succ)
{
await ReplyConfirmLocalizedAsync("role_added", Format.Bold(role.Name), Format.Bold(group.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.role_added(Format.Bold(role.Name), Format.Bold(group.ToString()))).ConfigureAwait(false);
}
else
{
await ReplyErrorLocalizedAsync("role_in_list", Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.role_in_list(Format.Bold(role.Name))).ConfigureAwait(false);
}
}
@@ -76,11 +76,11 @@ namespace NadekoBot.Modules.Administration
if (set)
{
await ReplyConfirmLocalizedAsync("group_name_added", Format.Bold(group.ToString()), Format.Bold(name.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.group_name_added(Format.Bold(group.ToString()), Format.Bold(name.ToString()))).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("group_name_removed", Format.Bold(group.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.group_name_removed(Format.Bold(group.ToString()))).ConfigureAwait(false);
}
}
@@ -96,11 +96,11 @@ namespace NadekoBot.Modules.Administration
bool success = _service.RemoveSar(role.Guild.Id, role.Id);
if (!success)
{
await ReplyErrorLocalizedAsync("self_assign_not").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.self_assign_not).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("self_assign_rem", Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.self_assign_rem(Format.Bold(role.Name))).ConfigureAwait(false);
}
}
@@ -171,9 +171,9 @@ namespace NadekoBot.Modules.Administration
{
bool areExclusive = _service.ToggleEsar(ctx.Guild.Id);
if (areExclusive)
await ReplyConfirmLocalizedAsync("self_assign_excl").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.self_assign_excl).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("self_assign_no_excl").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.self_assign_no_excl).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -189,13 +189,13 @@ namespace NadekoBot.Modules.Administration
if (!succ)
{
await ReplyErrorLocalizedAsync("self_assign_not").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.self_assign_not).ConfigureAwait(false);
return;
}
await ReplyConfirmLocalizedAsync("self_assign_level_req",
await ReplyConfirmLocalizedAsync(strs.self_assign_level_req(
Format.Bold(role.Name),
Format.Bold(level.ToString())).ConfigureAwait(false);
Format.Bold(level.ToString())));
}
[NadekoCommand, Aliases]
@@ -209,23 +209,23 @@ namespace NadekoBot.Modules.Administration
IUserMessage msg;
if (result == SelfAssignedRolesService.AssignResult.Err_Not_Assignable)
{
msg = await ReplyErrorLocalizedAsync("self_assign_not").ConfigureAwait(false);
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not).ConfigureAwait(false);
}
else if (result == SelfAssignedRolesService.AssignResult.Err_Lvl_Req)
{
msg = await ReplyErrorLocalizedAsync("self_assign_not_level", Format.Bold(extra.ToString())).ConfigureAwait(false);
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not_level(Format.Bold(extra.ToString()))).ConfigureAwait(false);
}
else if (result == SelfAssignedRolesService.AssignResult.Err_Already_Have)
{
msg = await ReplyErrorLocalizedAsync("self_assign_already", Format.Bold(role.Name)).ConfigureAwait(false);
msg = await ReplyErrorLocalizedAsync(strs.self_assign_already(Format.Bold(role.Name))).ConfigureAwait(false);
}
else if (result == SelfAssignedRolesService.AssignResult.Err_Not_Perms)
{
msg = await ReplyErrorLocalizedAsync("self_assign_perms").ConfigureAwait(false);
msg = await ReplyErrorLocalizedAsync(strs.self_assign_perms).ConfigureAwait(false);
}
else
{
msg = await ReplyConfirmLocalizedAsync("self_assign_success", Format.Bold(role.Name)).ConfigureAwait(false);
msg = await ReplyConfirmLocalizedAsync(strs.self_assign_success(Format.Bold(role.Name))).ConfigureAwait(false);
}
if (autoDelete)
@@ -246,19 +246,19 @@ namespace NadekoBot.Modules.Administration
IUserMessage msg;
if (result == SelfAssignedRolesService.RemoveResult.Err_Not_Assignable)
{
msg = await ReplyErrorLocalizedAsync("self_assign_not").ConfigureAwait(false);
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not).ConfigureAwait(false);
}
else if (result == SelfAssignedRolesService.RemoveResult.Err_Not_Have)
{
msg = await ReplyErrorLocalizedAsync("self_assign_not_have", Format.Bold(role.Name)).ConfigureAwait(false);
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not_have(Format.Bold(role.Name))).ConfigureAwait(false);
}
else if (result == SelfAssignedRolesService.RemoveResult.Err_Not_Perms)
{
msg = await ReplyErrorLocalizedAsync("self_assign_perms").ConfigureAwait(false);
msg = await ReplyErrorLocalizedAsync(strs.self_assign_perms).ConfigureAwait(false);
}
else
{
msg = await ReplyConfirmLocalizedAsync("self_assign_remove", Format.Bold(role.Name)).ConfigureAwait(false);
msg = await ReplyConfirmLocalizedAsync(strs.self_assign_remove(Format.Bold(role.Name))).ConfigureAwait(false);
}
if (autoDelete)

View File

@@ -88,7 +88,7 @@ namespace NadekoBot.Modules.Administration
};
_service.AddNewAutoCommand(cmd);
await ReplyConfirmLocalizedAsync("autocmd_add", Format.Code(Format.Sanitize(cmdText)), cmd.Interval).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.autocmd_add(Format.Code(Format.Sanitize(cmdText)), cmd.Interval));
}
[NadekoCommand, Aliases]
@@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Administration
if (scmds.Count == 0)
{
await ReplyErrorLocalizedAsync("startcmdlist_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.startcmdlist_none).ConfigureAwait(false);
}
else
{
@@ -138,7 +138,7 @@ namespace NadekoBot.Modules.Administration
.ToList();
if (!scmds.Any())
{
await ReplyErrorLocalizedAsync("autocmdlist_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.autocmdlist_none).ConfigureAwait(false);
}
else
{
@@ -188,7 +188,7 @@ namespace NadekoBot.Modules.Administration
{
if (!_service.RemoveAutoCommand(--index, out _))
{
await ReplyErrorLocalizedAsync("acrm_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.acrm_fail).ConfigureAwait(false);
return;
}
@@ -201,9 +201,9 @@ namespace NadekoBot.Modules.Administration
public async Task StartupCommandRemove([Leftover] int index)
{
if (!_service.RemoveStartupCommand(--index, out _))
await ReplyErrorLocalizedAsync("scrm_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.scrm_fail).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("scrm").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.scrm).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -214,7 +214,7 @@ namespace NadekoBot.Modules.Administration
{
_service.ClearStartupCommands();
await ReplyConfirmLocalizedAsync("startcmds_cleared").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.startcmds_cleared).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -224,9 +224,9 @@ namespace NadekoBot.Modules.Administration
var enabled = _service.ForwardMessages();
if (enabled)
await ReplyConfirmLocalizedAsync("fwdm_start").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.fwdm_start).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("fwdm_stop").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.fwdm_stop).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -236,9 +236,9 @@ namespace NadekoBot.Modules.Administration
var enabled = _service.ForwardToAll();
if (enabled)
await ReplyConfirmLocalizedAsync("fwall_start").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.fwall_start).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("fwall_stop").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.fwall_stop).ConfigureAwait(false);
}
@@ -300,11 +300,11 @@ namespace NadekoBot.Modules.Administration
var success = _coord.RestartShard(shardId);
if (success)
{
await ReplyConfirmLocalizedAsync("shard_reconnecting", Format.Bold("#" + shardId)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.shard_reconnecting(Format.Bold("#" + shardId))).ConfigureAwait(false);
}
else
{
await ReplyErrorLocalizedAsync("no_shard_id").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_shard_id).ConfigureAwait(false);
}
}
@@ -322,7 +322,7 @@ namespace NadekoBot.Modules.Administration
{
try
{
await ReplyConfirmLocalizedAsync("shutting_down").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.shutting_down).ConfigureAwait(false);
}
catch
{
@@ -339,11 +339,11 @@ namespace NadekoBot.Modules.Administration
bool success = _coord.RestartBot();
if (!success)
{
await ReplyErrorLocalizedAsync("restart_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.restart_fail).ConfigureAwait(false);
return;
}
try { await ReplyConfirmLocalizedAsync("restarting").ConfigureAwait(false); } catch { }
try { await ReplyConfirmLocalizedAsync(strs.restarting).ConfigureAwait(false); } catch { }
}
[NadekoCommand, Aliases]
@@ -362,7 +362,7 @@ namespace NadekoBot.Modules.Administration
Log.Warning("You've been ratelimited. Wait 2 hours to change your name");
}
await ReplyConfirmLocalizedAsync("bot_name", Format.Bold(newName)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.bot_name(Format.Bold(newName))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -376,7 +376,7 @@ namespace NadekoBot.Modules.Administration
var curUser = await ctx.Guild.GetCurrentUserAsync().ConfigureAwait(false);
await curUser.ModifyAsync(u => u.Nickname = newNick).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("bot_nick", Format.Bold(newNick) ?? "-").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.bot_nick(Format.Bold(newNick) ?? "-"));
}
[NadekoCommand, Aliases]
@@ -389,13 +389,13 @@ namespace NadekoBot.Modules.Administration
if (sg.OwnerId == gu.Id ||
gu.GetRoles().Max(r => r.Position) >= sg.CurrentUser.GetRoles().Max(r => r.Position))
{
await ReplyErrorLocalizedAsync("insuf_perms_i");
await ReplyErrorLocalizedAsync(strs.insuf_perms_i);
return;
}
await gu.ModifyAsync(u => u.Nickname = newNick).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("user_nick", Format.Bold(gu.ToString()), Format.Bold(newNick) ?? "-").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.user_nick(Format.Bold(gu.ToString()), Format.Bold(newNick) ?? "-"));
}
[NadekoCommand, Aliases]
@@ -404,7 +404,7 @@ namespace NadekoBot.Modules.Administration
{
await _client.SetStatusAsync(SettableUserStatusToUserStatus(status)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("bot_status", Format.Bold(status.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.bot_status(Format.Bold(status.ToString()))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -415,7 +415,7 @@ namespace NadekoBot.Modules.Administration
if (success)
{
await ReplyConfirmLocalizedAsync("set_avatar").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.set_avatar).ConfigureAwait(false);
}
}
@@ -429,7 +429,7 @@ namespace NadekoBot.Modules.Administration
await _service.SetGameAsync(game is null ? game : rep.Replace(game), type).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("set_game").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.set_game).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -440,7 +440,7 @@ namespace NadekoBot.Modules.Administration
await _service.SetStreamAsync(name, url).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("set_stream").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.set_stream).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -484,11 +484,11 @@ namespace NadekoBot.Modules.Administration
}
else
{
await ReplyErrorLocalizedAsync("invalid_format").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.invalid_format).ConfigureAwait(false);
return;
}
await ReplyConfirmLocalizedAsync("message_sent").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.message_sent).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -496,7 +496,7 @@ namespace NadekoBot.Modules.Administration
public async Task ImagesReload()
{
await _service.ReloadImagesAsync();
await ReplyConfirmLocalizedAsync("images_loading", 0).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.images_loading);
}
[NadekoCommand, Aliases]
@@ -504,7 +504,7 @@ namespace NadekoBot.Modules.Administration
public async Task StringsReload()
{
_strings.Reload();
await ReplyConfirmLocalizedAsync("bot_strings_reloaded").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.bot_strings_reloaded).ConfigureAwait(false);
}
private static UserStatus SettableUserStatusToUserStatus(SettableUserStatus sus)

View File

@@ -23,9 +23,9 @@ namespace NadekoBot.Modules.Administration
await _service.SetGreetDel(ctx.Guild.Id, timer).ConfigureAwait(false);
if (timer > 0)
await ReplyConfirmLocalizedAsync("greetdel_on", timer).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.greetdel_on(timer));
else
await ReplyConfirmLocalizedAsync("greetdel_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.greetdel_off).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -36,9 +36,9 @@ namespace NadekoBot.Modules.Administration
var enabled = await _service.SetGreet(ctx.Guild.Id, ctx.Channel.Id).ConfigureAwait(false);
if (enabled)
await ReplyConfirmLocalizedAsync("greet_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.greet_on).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("greet_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.greet_off).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -47,7 +47,7 @@ namespace NadekoBot.Modules.Administration
public Task GreetMsg()
{
string greetMsg = _service.GetGreetMsg(ctx.Guild.Id);
return ReplyConfirmLocalizedAsync("greetmsg_cur", greetMsg?.SanitizeMentions());
return ReplyErrorLocalizedAsync(strs.greetmsg_cur(greetMsg?.SanitizeMentions()));
}
[NadekoCommand, Aliases]
@@ -63,9 +63,9 @@ namespace NadekoBot.Modules.Administration
var sendGreetEnabled = _service.SetGreetMessage(ctx.Guild.Id, ref text);
await ReplyConfirmLocalizedAsync("greetmsg_new").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.greetmsg_new).ConfigureAwait(false);
if (!sendGreetEnabled)
await ReplyConfirmLocalizedAsync("greetmsg_enable", $"`{Prefix}greet`").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.greetmsg_enable($"`{Prefix}greet`"));
}
[NadekoCommand, Aliases]
@@ -76,9 +76,9 @@ namespace NadekoBot.Modules.Administration
var enabled = await _service.SetGreetDm(ctx.Guild.Id).ConfigureAwait(false);
if (enabled)
await ReplyConfirmLocalizedAsync("greetdm_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.greetdm_on).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("greetdm_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.greetdm_off).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -87,7 +87,7 @@ namespace NadekoBot.Modules.Administration
public Task GreetDmMsg()
{
var dmGreetMsg = _service.GetDmGreetMsg(ctx.Guild.Id);
return ReplyConfirmLocalizedAsync("greetdmmsg_cur", dmGreetMsg?.SanitizeMentions());
return ReplyErrorLocalizedAsync(strs.greetdmmsg_cur(dmGreetMsg?.SanitizeMentions()));
}
[NadekoCommand, Aliases]
@@ -103,9 +103,9 @@ namespace NadekoBot.Modules.Administration
var sendGreetEnabled = _service.SetGreetDmMessage(ctx.Guild.Id, ref text);
await ReplyConfirmLocalizedAsync("greetdmmsg_new").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.greetdmmsg_new).ConfigureAwait(false);
if (!sendGreetEnabled)
await ReplyConfirmLocalizedAsync("greetdmmsg_enable", $"`{Prefix}greetdm`").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.greetdmmsg_enable($"`{Prefix}greetdm`"));
}
[NadekoCommand, Aliases]
@@ -116,9 +116,9 @@ namespace NadekoBot.Modules.Administration
var enabled = await _service.SetBye(ctx.Guild.Id, ctx.Channel.Id).ConfigureAwait(false);
if (enabled)
await ReplyConfirmLocalizedAsync("bye_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.bye_on).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("bye_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.bye_off).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -127,7 +127,7 @@ namespace NadekoBot.Modules.Administration
public Task ByeMsg()
{
var byeMsg = _service.GetByeMessage(ctx.Guild.Id);
return ReplyConfirmLocalizedAsync("byemsg_cur", byeMsg?.SanitizeMentions());
return ReplyErrorLocalizedAsync(strs.byemsg_cur(byeMsg?.SanitizeMentions()));
}
[NadekoCommand, Aliases]
@@ -143,9 +143,9 @@ namespace NadekoBot.Modules.Administration
var sendByeEnabled = _service.SetByeMessage(ctx.Guild.Id, ref text);
await ReplyConfirmLocalizedAsync("byemsg_new").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.byemsg_new).ConfigureAwait(false);
if (!sendByeEnabled)
await ReplyConfirmLocalizedAsync("byemsg_enable", $"`{Prefix}bye`").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`"));
}
[NadekoCommand, Aliases]
@@ -156,9 +156,9 @@ namespace NadekoBot.Modules.Administration
await _service.SetByeDel(ctx.Guild.Id, timer).ConfigureAwait(false);
if (timer > 0)
await ReplyConfirmLocalizedAsync("byedel_on", timer).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.byedel_on(timer));
else
await ReplyConfirmLocalizedAsync("byedel_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.byedel_off).ConfigureAwait(false);
}
@@ -174,7 +174,7 @@ namespace NadekoBot.Modules.Administration
var enabled = _service.GetByeEnabled(ctx.Guild.Id);
if (!enabled)
{
await ReplyConfirmLocalizedAsync("byemsg_enable", $"`{Prefix}bye`").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`"));
}
}
@@ -190,7 +190,7 @@ namespace NadekoBot.Modules.Administration
var enabled = _service.GetGreetEnabled(ctx.Guild.Id);
if (!enabled)
{
await ReplyConfirmLocalizedAsync("greetmsg_enable", $"`{Prefix}greet`").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.greetmsg_enable($"`{Prefix}greet`"));
}
}
@@ -210,7 +210,7 @@ namespace NadekoBot.Modules.Administration
await ctx.WarningAsync();
var enabled = _service.GetGreetDmEnabled(ctx.Guild.Id);
if (!enabled)
await ReplyConfirmLocalizedAsync("greetdmmsg_enable", $"`{Prefix}greetdm`").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.greetdmmsg_enable($"`{Prefix}greetdm`"));
}
}
}

View File

@@ -115,7 +115,7 @@ namespace NadekoBot.Modules.Administration.Services
return Task.CompletedTask;
if (PresenceUpdates.TryRemove(key, out var msgs))
{
var title = GetText(key.Guild, "presence_updates");
var title = GetText(key.Guild, strs.presence_updates);
var desc = string.Join(Environment.NewLine, msgs);
return key.SendConfirmAsync(_eb, title, desc.TrimTo(2048));
}
@@ -186,10 +186,9 @@ namespace NadekoBot.Modules.Administration.Services
return removed > 0;
}
private string GetText(IGuild guild, string key, params object[] replacements) =>
_strings.GetText(key, guild.Id, replacements);
private string GetText(IGuild guild, LocStr str) =>
_strings.GetText(str, guild.Id);
private string PrettyCurrentTime(IGuild g)
{
@@ -260,7 +259,7 @@ namespace NadekoBot.Modules.Administration.Services
if (before.Username != after.Username)
{
embed.WithTitle("👥 " + GetText(g, "username_changed"))
embed.WithTitle("👥 " + GetText(g, strs.username_changed))
.WithDescription($"{before.Username}#{before.Discriminator} | {before.Id}")
.AddField("Old Name", $"{before.Username}", true)
.AddField("New Name", $"{after.Username}", true)
@@ -269,7 +268,7 @@ namespace NadekoBot.Modules.Administration.Services
}
else if (before.AvatarId != after.AvatarId)
{
embed.WithTitle("👥" + GetText(g, "avatar_changed"))
embed.WithTitle("👥" + GetText(g, strs.avatar_changed))
.WithDescription($"{before.Username}#{before.Discriminator} | {before.Id}")
.WithFooter(CurrentTime(g))
.WithOkColor();
@@ -391,15 +390,15 @@ namespace NadekoBot.Modules.Administration.Services
var str = "";
if (beforeVch?.Guild == afterVch?.Guild)
{
str = GetText(logChannel.Guild, "log_vc_moved", usr.Username, beforeVch?.Name, afterVch?.Name);
str = GetText(logChannel.Guild, strs.log_vc_moved(usr.Username, beforeVch?.Name, afterVch?.Name));
}
else if (beforeVch is null)
{
str = GetText(logChannel.Guild, "log_vc_joined", usr.Username, afterVch.Name);
str = GetText(logChannel.Guild, strs.log_vc_joined(usr.Username, afterVch.Name));
}
else if (afterVch is null)
{
str = GetText(logChannel.Guild, "log_vc_left", usr.Username, beforeVch.Name);
str = GetText(logChannel.Guild, strs.log_vc_left(usr.Username, beforeVch.Name));
}
var toDelete = await logChannel.SendMessageAsync(str, true).ConfigureAwait(false);
@@ -428,18 +427,18 @@ namespace NadekoBot.Modules.Administration.Services
.ConfigureAwait(false)) is null)
return;
var mutes = "";
var mutedLocalized = GetText(logChannel.Guild, "muted_sn");
var mutedLocalized = GetText(logChannel.Guild, strs.muted_sn);
switch (muteType)
{
case MuteType.Voice:
mutes = "🔇 " + GetText(logChannel.Guild, "xmuted_voice", mutedLocalized, mod.ToString());
mutes = "🔇 " + GetText(logChannel.Guild, strs.xmuted_voice(mutedLocalized, mod.ToString()));
break;
case MuteType.Chat:
mutes = "🔇 " + GetText(logChannel.Guild, "xmuted_text", mutedLocalized, mod.ToString());
mutes = "🔇 " + GetText(logChannel.Guild, strs.xmuted_text(mutedLocalized, mod.ToString()));
break;
case MuteType.All:
mutes = "🔇 " + GetText(logChannel.Guild, "xmuted_text_and_voice", mutedLocalized,
mod.ToString());
mutes = "🔇 " + GetText(logChannel.Guild, strs.xmuted_text_and_voice(mutedLocalized,
mod.ToString()));
break;
}
@@ -473,18 +472,18 @@ namespace NadekoBot.Modules.Administration.Services
return;
var mutes = "";
var unmutedLocalized = GetText(logChannel.Guild, "unmuted_sn");
var unmutedLocalized = GetText(logChannel.Guild, strs.unmuted_sn);
switch (muteType)
{
case MuteType.Voice:
mutes = "🔊 " + GetText(logChannel.Guild, "xmuted_voice", unmutedLocalized, mod.ToString());
mutes = "🔊 " + GetText(logChannel.Guild, strs.xmuted_voice(unmutedLocalized, mod.ToString()));
break;
case MuteType.Chat:
mutes = "🔊 " + GetText(logChannel.Guild, "xmuted_text", unmutedLocalized, mod.ToString());
mutes = "🔊 " + GetText(logChannel.Guild, strs.xmuted_text(unmutedLocalized, mod.ToString()));
break;
case MuteType.All:
mutes = "🔊 " + GetText(logChannel.Guild, "xmuted_text_and_voice", unmutedLocalized,
mod.ToString());
mutes = "🔊 " + GetText(logChannel.Guild, strs.xmuted_text_and_voice(unmutedLocalized,
mod.ToString()));
break;
}
@@ -527,24 +526,24 @@ namespace NadekoBot.Modules.Administration.Services
switch (action)
{
case PunishmentAction.Mute:
punishment = "🔇 " + GetText(logChannel.Guild, "muted_pl").ToUpperInvariant();
punishment = "🔇 " + GetText(logChannel.Guild, strs.muted_pl).ToUpperInvariant();
break;
case PunishmentAction.Kick:
punishment = "👢 " + GetText(logChannel.Guild, "kicked_pl").ToUpperInvariant();
punishment = "👢 " + GetText(logChannel.Guild, strs.kicked_pl).ToUpperInvariant();
break;
case PunishmentAction.Softban:
punishment = "☣ " + GetText(logChannel.Guild, "soft_banned_pl").ToUpperInvariant();
punishment = "☣ " + GetText(logChannel.Guild, strs.soft_banned_pl).ToUpperInvariant();
break;
case PunishmentAction.Ban:
punishment = "⛔️ " + GetText(logChannel.Guild, "banned_pl").ToUpperInvariant();
punishment = "⛔️ " + GetText(logChannel.Guild, strs.banned_pl).ToUpperInvariant();
break;
case PunishmentAction.RemoveRoles:
punishment = "⛔️ " + GetText(logChannel.Guild, "remove_roles_pl").ToUpperInvariant();
punishment = "⛔️ " + GetText(logChannel.Guild, strs.remove_roles_pl).ToUpperInvariant();
break;
}
var embed = _eb.Create().WithAuthor($"🛡 Anti-{protection}")
.WithTitle(GetText(logChannel.Guild, "users") + " " + punishment)
.WithTitle(GetText(logChannel.Guild, strs.users) + " " + punishment)
.WithDescription(string.Join("\n", users.Select(u => u.ToString())))
.WithFooter(CurrentTime(logChannel.Guild))
.WithOkColor();
@@ -596,10 +595,10 @@ namespace NadekoBot.Modules.Administration.Services
.WithTitle($"{before.Username}#{before.Discriminator} | {before.Id}");
if (before.Nickname != after.Nickname)
{
embed.WithAuthor("👥 " + GetText(logChannel.Guild, "nick_change"))
.AddField(GetText(logChannel.Guild, "old_nick")
embed.WithAuthor("👥 " + GetText(logChannel.Guild, strs.nick_change))
.AddField(GetText(logChannel.Guild, strs.old_nick)
, $"{before.Nickname}#{before.Discriminator}")
.AddField(GetText(logChannel.Guild, "new_nick")
.AddField(GetText(logChannel.Guild, strs.new_nick)
, $"{after.Nickname}#{after.Discriminator}");
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
@@ -609,7 +608,7 @@ namespace NadekoBot.Modules.Administration.Services
if (before.Roles.Count < after.Roles.Count)
{
var diffRoles = after.Roles.Where(r => !before.Roles.Contains(r)).Select(r => r.Name);
embed.WithAuthor("⚔ " + GetText(logChannel.Guild, "user_role_add"))
embed.WithAuthor("⚔ " + GetText(logChannel.Guild, strs.user_role_add))
.WithDescription(string.Join(", ", diffRoles).SanitizeMentions());
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
@@ -624,7 +623,7 @@ namespace NadekoBot.Modules.Administration.Services
if (diffRoles.Any())
{
embed.WithAuthor("⚔ " + GetText(logChannel.Guild, "user_role_rem"))
embed.WithAuthor("⚔ " + GetText(logChannel.Guild, strs.user_role_rem))
.WithDescription(string.Join(", ", diffRoles).SanitizeMentions());
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
@@ -641,9 +640,9 @@ namespace NadekoBot.Modules.Administration.Services
if (before.Status != after.Status)
{
var str = "🎭" + Format.Code(PrettyCurrentTime(after.Guild)) +
GetText(logChannel.Guild, "user_status_change",
GetText(logChannel.Guild, strs.user_status_change(
"👤" + Format.Bold(after.Username),
Format.Bold(after.Status.ToString()));
Format.Bold(after.Status.ToString())));
PresenceUpdates.AddOrUpdate(logChannel,
new List<string>() {str}, (id, list) =>
{
@@ -701,16 +700,16 @@ namespace NadekoBot.Modules.Administration.Services
if (before.Name != after.Name)
{
embed.WithTitle(" " + GetText(logChannel.Guild, "ch_name_change"))
embed.WithTitle(" " + GetText(logChannel.Guild, strs.ch_name_change))
.WithDescription($"{after} | {after.Id}")
.AddField(GetText(logChannel.Guild, "ch_old_name"), before.Name);
.AddField(GetText(logChannel.Guild, strs.ch_old_name), before.Name);
}
else if (beforeTextChannel?.Topic != afterTextChannel?.Topic)
{
embed.WithTitle(" " + GetText(logChannel.Guild, "ch_topic_change"))
embed.WithTitle(" " + GetText(logChannel.Guild, strs.ch_topic_change))
.WithDescription($"{after} | {after.Id}")
.AddField(GetText(logChannel.Guild, "old_topic") , beforeTextChannel?.Topic ?? "-")
.AddField(GetText(logChannel.Guild, "new_topic"), afterTextChannel?.Topic ?? "-");
.AddField(GetText(logChannel.Guild, strs.old_topic) , beforeTextChannel?.Topic ?? "-")
.AddField(GetText(logChannel.Guild, strs.new_topic), afterTextChannel?.Topic ?? "-");
}
else
return;
@@ -746,10 +745,10 @@ namespace NadekoBot.Modules.Administration.Services
string title;
if (ch is IVoiceChannel)
{
title = GetText(logChannel.Guild, "voice_chan_destroyed");
title = GetText(logChannel.Guild, strs.voice_chan_destroyed);
}
else
title = GetText(logChannel.Guild, "text_chan_destroyed");
title = GetText(logChannel.Guild, strs.text_chan_destroyed);
await logChannel.EmbedAsync(_eb.Create()
.WithOkColor()
@@ -785,10 +784,10 @@ namespace NadekoBot.Modules.Administration.Services
string title;
if (ch is IVoiceChannel)
{
title = GetText(logChannel.Guild, "voice_chan_created");
title = GetText(logChannel.Guild, strs.voice_chan_created);
}
else
title = GetText(logChannel.Guild, "text_chan_created");
title = GetText(logChannel.Guild, strs.text_chan_created);
await logChannel.EmbedAsync(_eb.Create()
.WithOkColor()
@@ -832,22 +831,22 @@ namespace NadekoBot.Modules.Administration.Services
if (beforeVch?.Guild == afterVch?.Guild)
{
str = "🎙" + Format.Code(PrettyCurrentTime(usr.Guild)) + GetText(logChannel.Guild,
"user_vmoved",
strs.user_vmoved(
"👤" + Format.Bold(usr.Username + "#" + usr.Discriminator),
Format.Bold(beforeVch?.Name ?? ""), Format.Bold(afterVch?.Name ?? ""));
Format.Bold(beforeVch?.Name ?? ""), Format.Bold(afterVch?.Name ?? "")));
}
else if (beforeVch is null)
{
str = "🎙" + Format.Code(PrettyCurrentTime(usr.Guild)) + GetText(logChannel.Guild,
"user_vjoined",
"👤" + Format.Bold(usr.Username + "#" + usr.Discriminator),
Format.Bold(afterVch.Name ?? ""));
strs.user_vjoined(
"👤" + Format.Bold(usr.Username + "#" + usr.Discriminator),
Format.Bold(afterVch.Name ?? "")));
}
else if (afterVch is null)
{
str = "🎙" + Format.Code(PrettyCurrentTime(usr.Guild)) + GetText(logChannel.Guild, "user_vleft",
"👤" + Format.Bold(usr.Username + "#" + usr.Discriminator),
Format.Bold(beforeVch.Name ?? ""));
str = "🎙" + Format.Code(PrettyCurrentTime(usr.Guild)) + GetText(logChannel.Guild,
strs.user_vleft("👤" + Format.Bold(usr.Username + "#" + usr.Discriminator),
Format.Bold(beforeVch.Name ?? "")));
}
if (!string.IsNullOrWhiteSpace(str))
@@ -887,7 +886,7 @@ namespace NadekoBot.Modules.Administration.Services
// string str = "";
// if (before.Status != after.Status)
// str = "🎭" + Format.Code(PrettyCurrentTime(g)) +
// GetText(logChannel.Guild, "user_status_change",
// GetText(logChannel.Guild, strs.user_status_change(,
// "👤" + Format.Bold(usr.Username),
// Format.Bold(after.Status.ToString()));
@@ -924,7 +923,7 @@ namespace NadekoBot.Modules.Administration.Services
return;
var embed = _eb.Create()
.WithOkColor()
.WithTitle("❌ " + GetText(logChannel.Guild, "user_left"))
.WithTitle("❌ " + GetText(logChannel.Guild, strs.user_left))
.WithDescription(usr.ToString())
.AddField("Id", usr.Id.ToString())
.WithFooter(CurrentTime(usr.Guild));
@@ -959,13 +958,13 @@ namespace NadekoBot.Modules.Administration.Services
var embed = _eb.Create()
.WithOkColor()
.WithTitle("✅ " + GetText(logChannel.Guild, "user_joined"))
.WithTitle("✅ " + GetText(logChannel.Guild, strs.user_joined))
.WithDescription($"{usr.Mention} `{usr}`")
.AddField("Id", usr.Id.ToString())
.AddField(GetText(logChannel.Guild, "joined_server"),
.AddField(GetText(logChannel.Guild, strs.joined_server),
$"{usr.JoinedAt?.ToString("dd.MM.yyyy HH:mm" ?? "?")}",
true)
.AddField(GetText(logChannel.Guild, "joined_discord"),
.AddField(GetText(logChannel.Guild, strs.joined_discord),
$"{usr.CreatedAt:dd.MM.yyyy HH:mm}",
true)
.WithFooter(CurrentTime(usr.Guild));
@@ -999,7 +998,7 @@ namespace NadekoBot.Modules.Administration.Services
return;
var embed = _eb.Create()
.WithOkColor()
.WithTitle("♻️ " + GetText(logChannel.Guild, "user_unbanned"))
.WithTitle("♻️ " + GetText(logChannel.Guild, strs.user_unbanned))
.WithDescription(usr.ToString())
.AddField("Id", usr.Id.ToString())
.WithFooter(CurrentTime(guild));
@@ -1034,7 +1033,7 @@ namespace NadekoBot.Modules.Administration.Services
return;
var embed = _eb.Create()
.WithOkColor()
.WithTitle("🚫 " + GetText(logChannel.Guild, "user_banned"))
.WithTitle("🚫 " + GetText(logChannel.Guild, strs.user_banned))
.WithDescription(usr.ToString())
.AddField("Id", usr.Id.ToString())
.WithFooter(CurrentTime(guild));
@@ -1083,15 +1082,15 @@ namespace NadekoBot.Modules.Administration.Services
var resolvedMessage = msg.Resolve(userHandling: TagHandling.FullName);
var embed = _eb.Create()
.WithOkColor()
.WithTitle("🗑 " + GetText(logChannel.Guild, "msg_del", ((ITextChannel) msg.Channel).Name))
.WithTitle("🗑 " + GetText(logChannel.Guild, strs.msg_del(((ITextChannel) msg.Channel).Name)))
.WithDescription(msg.Author.ToString())
.AddField(GetText(logChannel.Guild, "content"),
.AddField(GetText(logChannel.Guild, strs.content),
string.IsNullOrWhiteSpace(resolvedMessage) ? "-" : resolvedMessage,
false)
.AddField("Id", msg.Id.ToString(), false)
.WithFooter(CurrentTime(channel.Guild));
if (msg.Attachments.Any())
embed.AddField(GetText(logChannel.Guild, "attachments"),
embed.AddField(GetText(logChannel.Guild, strs.attachments),
string.Join(", ", msg.Attachments.Select(a => a.Url)),
false);
@@ -1140,15 +1139,15 @@ namespace NadekoBot.Modules.Administration.Services
var embed = _eb.Create()
.WithOkColor()
.WithTitle("📝 " + GetText(logChannel.Guild, "msg_update", ((ITextChannel)after.Channel).Name))
.WithTitle("📝 " + GetText(logChannel.Guild, strs.msg_update(((ITextChannel)after.Channel).Name)))
.WithDescription(after.Author.ToString())
.AddField(GetText(logChannel.Guild, "old_msg"),
.AddField(GetText(logChannel.Guild, strs.old_msg),
string.IsNullOrWhiteSpace(before.Content)
? "-"
: before.Resolve(userHandling: TagHandling.FullName),
false)
.AddField(
GetText(logChannel.Guild, "new_msg"),
GetText(logChannel.Guild, strs.new_msg),
string.IsNullOrWhiteSpace(after.Content)
? "-"
: after.Resolve(userHandling: TagHandling.FullName),

View File

@@ -64,7 +64,7 @@ namespace NadekoBot.Modules.Administration
[RequireContext(ContextType.Guild)]
public async Task Timezone()
{
await ReplyConfirmLocalizedAsync("timezone_guild", _service.GetTimeZoneOrUtc(ctx.Guild.Id)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.timezone_guild(_service.GetTimeZoneOrUtc(ctx.Guild.Id))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -78,7 +78,7 @@ namespace NadekoBot.Modules.Administration
if (tz is null)
{
await ReplyErrorLocalizedAsync("timezone_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.timezone_not_found).ConfigureAwait(false);
return;
}
_service.SetTimeZone(ctx.Guild.Id, tz);

View File

@@ -42,7 +42,7 @@ namespace NadekoBot.Modules.Administration
// otherwise, moderator has to have a higher role
if ((botMaxRole <= targetMaxRole || (ctx.User.Id != ownerId && targetMaxRole >= modMaxRole)) || target.Id == ownerId)
{
await ReplyErrorLocalizedAsync("hierarchy");
await ReplyErrorLocalizedAsync(strs.hierarchy);
return false;
}
@@ -132,9 +132,9 @@ namespace NadekoBot.Modules.Administration
var expireDays = await _service.GetWarnExpire(ctx.Guild.Id);
if (expireDays == 0)
await ReplyConfirmLocalizedAsync("warns_dont_expire");
await ReplyConfirmLocalizedAsync(strs.warns_dont_expire);
else
await ReplyConfirmLocalizedAsync("warns_expire_in", expireDays);
await ReplyErrorLocalizedAsync(strs.warns_expire_in(expireDays));
}
[NadekoCommand, Aliases]
@@ -154,17 +154,17 @@ namespace NadekoBot.Modules.Administration
await _service.WarnExpireAsync(ctx.Guild.Id, days, opts.Delete).ConfigureAwait(false);
if(days == 0)
{
await ReplyConfirmLocalizedAsync("warn_expire_reset").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.warn_expire_reset).ConfigureAwait(false);
return;
}
if (opts.Delete)
{
await ReplyConfirmLocalizedAsync("warn_expire_set_delete", Format.Bold(days.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.warn_expire_set_delete(Format.Bold(days.ToString()))).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("warn_expire_set_clear", Format.Bold(days.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.warn_expire_set_clear(Format.Bold(days.ToString()))).ConfigureAwait(false);
}
}
@@ -294,18 +294,17 @@ namespace NadekoBot.Modules.Administration
var userStr = Format.Bold((ctx.Guild as SocketGuild)?.GetUser(userId)?.ToString() ?? userId.ToString());
if (index == 0)
{
await ReplyConfirmLocalizedAsync("warnings_cleared", userStr).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.warnings_cleared(userStr));
}
else
{
if (success)
{
await ReplyConfirmLocalizedAsync("warning_cleared", Format.Bold(index.ToString()), userStr)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.warning_cleared(Format.Bold(index.ToString()), userStr));
}
else
{
await ReplyErrorLocalizedAsync("warning_clear_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.warning_clear_fail).ConfigureAwait(false);
}
}
}
@@ -326,7 +325,7 @@ namespace NadekoBot.Modules.Administration
if (ctx.Guild.OwnerId != ctx.User.Id &&
role.Position >= ((IGuildUser)ctx.User).GetRoles().Max(x => x.Position))
{
await ReplyErrorLocalizedAsync("role_too_high");
await ReplyErrorLocalizedAsync(strs.role_too_high);
return;
}
@@ -337,16 +336,16 @@ namespace NadekoBot.Modules.Administration
if (time is null)
{
await ReplyConfirmLocalizedAsync("warn_punish_set",
await ReplyConfirmLocalizedAsync(strs.warn_punish_set(
Format.Bold(punish.ToString()),
Format.Bold(number.ToString())).ConfigureAwait(false);
Format.Bold(number.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync("warn_punish_set_timed",
await ReplyConfirmLocalizedAsync(strs.warn_punish_set_timed(
Format.Bold(punish.ToString()),
Format.Bold(number.ToString()),
Format.Bold(time.Input)).ConfigureAwait(false);
Format.Bold(time.Input)));
}
}
@@ -366,16 +365,16 @@ namespace NadekoBot.Modules.Administration
if (time is null)
{
await ReplyConfirmLocalizedAsync("warn_punish_set",
await ReplyConfirmLocalizedAsync(strs.warn_punish_set(
Format.Bold(punish.ToString()),
Format.Bold(number.ToString())).ConfigureAwait(false);
Format.Bold(number.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync("warn_punish_set_timed",
await ReplyConfirmLocalizedAsync(strs.warn_punish_set_timed(
Format.Bold(punish.ToString()),
Format.Bold(number.ToString()),
Format.Bold(time.Input)).ConfigureAwait(false);
Format.Bold(time.Input)));
}
}
@@ -389,8 +388,8 @@ namespace NadekoBot.Modules.Administration
return;
}
await ReplyConfirmLocalizedAsync("warn_punish_rem",
Format.Bold(number.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.warn_punish_rem(
Format.Bold(number.ToString())));
}
[NadekoCommand, Aliases]
@@ -542,7 +541,7 @@ namespace NadekoBot.Modules.Administration
var template = _service.GetBanTemplate(ctx.Guild.Id);
if (template is null)
{
await ReplyConfirmLocalizedAsync("banmsg_default");
await ReplyConfirmLocalizedAsync(strs.banmsg_default);
return;
}
@@ -592,7 +591,7 @@ namespace NadekoBot.Modules.Administration
if (embed is null)
{
await ConfirmLocalizedAsync("bandm_disabled");
await ConfirmLocalizedAsync(strs.banmsg_disabled);
}
else
{
@@ -602,7 +601,7 @@ namespace NadekoBot.Modules.Administration
}
catch (Exception)
{
await ReplyErrorLocalizedAsync("unable_to_dm_user");
await ReplyErrorLocalizedAsync(strs.unable_to_dm_user);
return;
}
@@ -622,7 +621,7 @@ namespace NadekoBot.Modules.Administration
if (bun is null)
{
await ReplyErrorLocalizedAsync("user_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.user_not_found).ConfigureAwait(false);
return;
}
@@ -641,7 +640,7 @@ namespace NadekoBot.Modules.Administration
if (bun is null)
{
await ReplyErrorLocalizedAsync("user_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.user_not_found).ConfigureAwait(false);
return;
}
@@ -652,7 +651,7 @@ namespace NadekoBot.Modules.Administration
{
await ctx.Guild.RemoveBanAsync(user).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("unbanned_user", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.unbanned_user(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]

View File

@@ -23,11 +23,11 @@ namespace NadekoBot.Modules.Administration
{
if (_service.RemoveVcRole(ctx.Guild.Id, vcId))
{
await ReplyConfirmLocalizedAsync("vcrole_removed", Format.Bold(vcId.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.vcrole_removed(Format.Bold(vcId.ToString()))).ConfigureAwait(false);
}
else
{
await ReplyErrorLocalizedAsync("vcrole_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.vcrole_not_found).ConfigureAwait(false);
}
}
@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Administration
if (vc is null || vc.GuildId != user.GuildId)
{
await ReplyErrorLocalizedAsync("must_be_in_voice").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.must_be_in_voice).ConfigureAwait(false);
return;
}
@@ -51,13 +51,13 @@ namespace NadekoBot.Modules.Administration
{
if (_service.RemoveVcRole(ctx.Guild.Id, vc.Id))
{
await ReplyConfirmLocalizedAsync("vcrole_removed", Format.Bold(vc.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.vcrole_removed(Format.Bold(vc.Name))).ConfigureAwait(false);
}
}
else
{
_service.AddVcRole(ctx.Guild.Id, role, vc.Id);
await ReplyConfirmLocalizedAsync("vcrole_added", Format.Bold(vc.Name), Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.vcrole_added(Format.Bold(vc.Name), Format.Bold(role.Name))).ConfigureAwait(false);
}
}