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

@@ -28,17 +28,10 @@ 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 data) =>
Strings.GetText(data, _cultureInfo);
protected string GetText(string key, params object[] args) =>
Strings.GetText(key, _cultureInfo, args);
public Task<IUserMessage> SendErrorAsync(string error)
=> ctx.Channel.SendErrorAsync(_eb, error);
@@ -54,34 +47,23 @@ namespace NadekoBot.Modules
public Task<IUserMessage> SendPendingAsync(string text)
=> ctx.Channel.SendPendingAsync(_eb, text);
public Task<IUserMessage> ErrorLocalizedAsync(string textKey, params object[] args)
{
var text = GetText(textKey, args);
return SendErrorAsync(text);
}
public Task<IUserMessage> ErrorLocalizedAsync(LocStr str)
=> SendErrorAsync(GetText(str));
public Task<IUserMessage> ReplyErrorLocalizedAsync(string textKey, params object[] args)
{
var text = GetText(textKey, args);
return SendErrorAsync(Format.Bold(ctx.User.ToString()) + " " + text);
}
public Task<IUserMessage> ReplyPendingLocalizedAsync(string textKey, params object[] args)
{
var text = GetText(textKey, args);
return SendPendingAsync(Format.Bold(ctx.User.ToString()) + " " + text);
}
public Task<IUserMessage> PendingLocalizedAsync(LocStr str)
=> SendPendingAsync(GetText(str));
public Task<IUserMessage> ConfirmLocalizedAsync(LocStr str)
=> SendConfirmAsync(GetText(str));
public Task<IUserMessage> ConfirmLocalizedAsync(string textKey, params object[] args)
{
var text = GetText(textKey, args);
return SendConfirmAsync(text);
}
public Task<IUserMessage> ReplyErrorLocalizedAsync(LocStr str)
=> SendErrorAsync($"{Format.Bold(ctx.User.ToString())} {GetText(str)}");
public Task<IUserMessage> ReplyConfirmLocalizedAsync(string textKey, params object[] args)
{
var text = GetText(textKey, args);
return SendConfirmAsync(Format.Bold(ctx.User.ToString()) + " " + text);
}
public Task<IUserMessage> ReplyPendingLocalizedAsync(LocStr str)
=> SendPendingAsync($"{Format.Bold(ctx.User.ToString())} {GetText(str)}");
public Task<IUserMessage> ReplyConfirmLocalizedAsync(LocStr str)
=> SendConfirmAsync($"{Format.Bold(ctx.User.ToString())} {GetText(str)}");
public async Task<bool> PromptUserConfirmAsync(IEmbedBuilder embed)
{

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);
}
}

View File

@@ -35,7 +35,7 @@ namespace NadekoBot.Modules.CustomReactions
if (!AdminInGuildOrOwnerInDm())
{
await ReplyErrorLocalizedAsync("insuff_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuff_perms).ConfigureAwait(false);
return;
}
@@ -58,7 +58,7 @@ namespace NadekoBot.Modules.CustomReactions
if ((channel is null && !_creds.IsOwner(ctx.User)) || (channel != null && !((IGuildUser)ctx.User).GuildPermissions.Administrator))
{
await ReplyErrorLocalizedAsync("insuff_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuff_perms).ConfigureAwait(false);
return;
}
@@ -74,7 +74,7 @@ namespace NadekoBot.Modules.CustomReactions
}
else
{
await ReplyErrorLocalizedAsync("edit_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.edit_fail).ConfigureAwait(false);
}
}
@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.CustomReactions
if (customReactions is null || !customReactions.Any())
{
await ReplyErrorLocalizedAsync("no_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_found).ConfigureAwait(false);
return;
}
@@ -123,14 +123,14 @@ namespace NadekoBot.Modules.CustomReactions
[Priority(0)]
public async Task ListCustReact(All _)
{
await ReplyPendingLocalizedAsync("obsolete_use", Format.Code($"{Prefix}crsexport"));
await ReplyPendingLocalizedAsync(strs.obsolete_use(Format.Code($"{Prefix}crsexport")));
await CrsExport();
}
[NadekoCommand, Aliases]
public async Task ListCustReactG(int page = 1)
{
await ReplyPendingLocalizedAsync("obsolete_use", Format.Code($"{Prefix}crsexport"));
await ReplyPendingLocalizedAsync(strs.obsolete_use(Format.Code($"{Prefix}crsexport")));
await CrsExport();
}
@@ -141,7 +141,7 @@ namespace NadekoBot.Modules.CustomReactions
if (found is null)
{
await ReplyErrorLocalizedAsync("no_found_id").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_found_id).ConfigureAwait(false);
return;
}
else
@@ -159,7 +159,7 @@ namespace NadekoBot.Modules.CustomReactions
{
if (!AdminInGuildOrOwnerInDm())
{
await ReplyErrorLocalizedAsync("insuff_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuff_perms).ConfigureAwait(false);
return;
}
@@ -175,7 +175,7 @@ namespace NadekoBot.Modules.CustomReactions
}
else
{
await ReplyErrorLocalizedAsync("no_found_id").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_found_id).ConfigureAwait(false);
}
}
@@ -184,21 +184,21 @@ namespace NadekoBot.Modules.CustomReactions
{
if (!AdminInGuildOrOwnerInDm())
{
await ReplyErrorLocalizedAsync("insuff_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuff_perms).ConfigureAwait(false);
return;
}
var cr = _service.GetCustomReaction(ctx.Guild?.Id, id);
if (cr is null)
{
await ReplyErrorLocalizedAsync("no_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_found).ConfigureAwait(false);
return;
}
if (emojiStrs.Length == 0)
{
await _service.ResetCrReactions(ctx.Guild?.Id, id);
await ReplyConfirmLocalizedAsync("crr_reset", Format.Bold(id.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.crr_reset(Format.Bold(id.ToString()))).ConfigureAwait(false);
return;
}
@@ -223,14 +223,14 @@ namespace NadekoBot.Modules.CustomReactions
if(succ.Count == 0)
{
await ReplyErrorLocalizedAsync("invalid_emojis").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.invalid_emojis).ConfigureAwait(false);
return;
}
await _service.SetCrReactions(ctx.Guild?.Id, id, succ);
await ReplyConfirmLocalizedAsync("crr_set", Format.Bold(id.ToString()), string.Join(", ", succ.Select(x => x.ToString()))).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.crr_set(Format.Bold(id.ToString()), string.Join(", ", succ.Select(x => x.ToString())))).ConfigureAwait(false);
}
@@ -264,23 +264,23 @@ namespace NadekoBot.Modules.CustomReactions
var cr = _service.GetCustomReaction(ctx.Guild?.Id, id);
if (!AdminInGuildOrOwnerInDm())
{
await ReplyErrorLocalizedAsync("insuff_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuff_perms).ConfigureAwait(false);
return;
}
var (success, newVal) = await _service.ToggleCrOptionAsync(id, option).ConfigureAwait(false);
if (!success)
{
await ReplyErrorLocalizedAsync("no_found_id").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_found_id).ConfigureAwait(false);
return;
}
if (newVal)
{
await ReplyConfirmLocalizedAsync("option_enabled", Format.Code(option.ToString()), Format.Code(id.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.option_enabled(Format.Code(option.ToString()), Format.Code(id.ToString()))).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("option_disabled", Format.Code(option.ToString()), Format.Code(id.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.option_disabled(Format.Code(option.ToString()), Format.Code(id.ToString()))).ConfigureAwait(false);
}
}
@@ -294,7 +294,7 @@ namespace NadekoBot.Modules.CustomReactions
.WithDescription("This will delete all custom reactions on this server.")).ConfigureAwait(false))
{
var count = _service.DeleteAllCustomReactions(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync("cleared", count).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.cleared(count));
}
}
@@ -303,7 +303,7 @@ namespace NadekoBot.Modules.CustomReactions
{
if (!AdminInGuildOrOwnerInDm())
{
await ReplyErrorLocalizedAsync("insuff_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuff_perms).ConfigureAwait(false);
return;
}
@@ -322,7 +322,7 @@ namespace NadekoBot.Modules.CustomReactions
{
if (!AdminInGuildOrOwnerInDm())
{
await ReplyErrorLocalizedAsync("insuff_perms").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.insuff_perms).ConfigureAwait(false);
return;
}
@@ -335,7 +335,7 @@ namespace NadekoBot.Modules.CustomReactions
var attachment = ctx.Message.Attachments.FirstOrDefault();
if (attachment is null)
{
await ReplyErrorLocalizedAsync("expr_import_no_input");
await ReplyErrorLocalizedAsync(strs.expr_import_no_input);
return;
}
@@ -344,7 +344,7 @@ namespace NadekoBot.Modules.CustomReactions
if (string.IsNullOrWhiteSpace(input))
{
await ReplyErrorLocalizedAsync("expr_import_no_input");
await ReplyErrorLocalizedAsync(strs.expr_import_no_input);
return;
}
}
@@ -352,7 +352,7 @@ namespace NadekoBot.Modules.CustomReactions
var succ = await _service.ImportCrsAsync(ctx.Guild?.Id, input);
if (!succ)
{
await ReplyErrorLocalizedAsync("expr_import_invalid_data");
await ReplyErrorLocalizedAsync(strs.expr_import_invalid_data);
return;
}

View File

@@ -135,7 +135,7 @@ namespace NadekoBot.Modules.Gambling
private Task Ar_OnStartingFailed(AnimalRace race)
{
_service.AnimalRaces.TryRemove(ctx.Guild.Id, out _);
return ReplyErrorLocalizedAsync("animal_race_failed");
return ReplyErrorLocalizedAsync(strs.animal_race_failed);
}
[NadekoCommand, Aliases]
@@ -147,7 +147,7 @@ namespace NadekoBot.Modules.Gambling
if (!_service.AnimalRaces.TryGetValue(ctx.Guild.Id, out var ar))
{
await ReplyErrorLocalizedAsync("race_not_exist").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.race_not_exist).ConfigureAwait(false);
return;
}
try

View File

@@ -49,19 +49,19 @@ namespace NadekoBot.Modules.Gambling
if (!await bj.Join(ctx.User, amount).ConfigureAwait(false))
{
_service.Games.TryRemove(ctx.Channel.Id, out _);
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
bj.StateUpdated += Bj_StateUpdated;
bj.GameEnded += Bj_GameEnded;
bj.Start();
await ReplyConfirmLocalizedAsync("bj_created").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.bj_created).ConfigureAwait(false);
}
else
{
if (await bj.Join(ctx.User, amount).ConfigureAwait(false))
await ReplyConfirmLocalizedAsync("bj_joined").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.bj_joined).ConfigureAwait(false);
else
{
Log.Information($"{ctx.User} can't join a blackjack game as it's in " + bj.State.ToString() + " state already.");
@@ -182,7 +182,7 @@ namespace NadekoBot.Modules.Gambling
{
if (!await bj.Double(ctx.User).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
}
}

View File

@@ -27,14 +27,14 @@ namespace NadekoBot.Modules.Gambling.Common
}
if (amount < _config.MinBet)
{
await ReplyErrorLocalizedAsync("min_bet_limit",
Format.Bold(_config.MinBet.ToString()) + CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.min_bet_limit(
Format.Bold(_config.MinBet.ToString()) + CurrencySign));
return false;
}
if (_config.MaxBet > 0 && amount > _config.MaxBet)
{
await ReplyErrorLocalizedAsync("max_bet_limit",
Format.Bold(_config.MaxBet.ToString()) + CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.max_bet_limit(
Format.Bold(_config.MaxBet.ToString()) + CurrencySign));
return false;
}
return true;

View File

@@ -56,7 +56,7 @@ namespace NadekoBot.Modules.Gambling
{
if (!await _cs.RemoveAsync(ctx.User.Id, "Connect4-bet", options.Bet, true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
_service.Connect4Games.TryRemove(ctx.Channel.Id, out _);
game.Dispose();
return;
@@ -71,11 +71,11 @@ namespace NadekoBot.Modules.Gambling
game.Initialize();
if (options.Bet == 0)
{
await ReplyConfirmLocalizedAsync("connect4_created").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.connect4_created).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("connect4_created_bet", options.Bet + CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.connect4_created_bet(options.Bet + CurrencySign));
}
Task _client_MessageReceived(SocketMessage arg)
@@ -115,7 +115,7 @@ namespace NadekoBot.Modules.Gambling
_client.MessageReceived -= _client_MessageReceived;
toDispose.Dispose();
}
return ErrorLocalizedAsync("connect4_failed_to_start");
return ErrorLocalizedAsync(strs.connect4_failed_to_start);
}
Task Game_OnGameEnded(Connect4Game arg, Connect4Game.Result result)

View File

@@ -40,7 +40,7 @@ namespace NadekoBot.Modules.Gambling
GetEmbed
).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("start_event_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.start_event_fail).ConfigureAwait(false);
return;
}
}

View File

@@ -50,9 +50,9 @@ namespace NadekoBot.Modules.Gambling
else
{
if (res.Item2 == CurrencyRaffleService.JoinErrorType.AlreadyJoinedOrInvalidAmount)
await ReplyErrorLocalizedAsync("rafflecur_already_joined").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.rafflecur_already_joined).ConfigureAwait(false);
else if (res.Item2 == CurrencyRaffleService.JoinErrorType.NotEnoughCurrency)
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
}
}
}

View File

@@ -84,7 +84,7 @@ namespace NadekoBot.Modules.Gambling
{
if (num < 1 || num > 30)
{
await ReplyErrorLocalizedAsync("dice_invalid_number", 1, 30).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.dice_invalid_number(1, 30));
return;
}
@@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Gambling
var sum = arr.Sum();
var embed = _eb.Create().WithOkColor()
.WithDescription(ctx.User.Mention + " " + GetText(strs.dice_rolled_num(n1) + $"`1 - {n2}`"))
.WithDescription(ctx.User.Mention + " " + GetText(strs.dice_rolled_num(n1 + $"`1 - {n2}`")))
.AddField(Format.Bold("Rolls"), string.Join(" ",
(ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x =>
Format.Code(x.ToString()))))
@@ -200,7 +200,7 @@ namespace NadekoBot.Modules.Gambling
.ToArray();
if (arr[0] > arr[1])
{
await ReplyErrorLocalizedAsync("second_larger_than_first").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.second_larger_than_first).ConfigureAwait(false);
return;
}
rolled = new NadekoRandom().Next(arr[0], arr[1] + 1);
@@ -210,7 +210,7 @@ namespace NadekoBot.Modules.Gambling
rolled = new NadekoRandom().Next(0, int.Parse(range) + 1);
}
await ReplyConfirmLocalizedAsync("dice_rolled", Format.Bold(rolled.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.dice_rolled(Format.Bold(rolled.ToString()))).ConfigureAwait(false);
}
private Image<Rgba32> GetDice(int num)

View File

@@ -42,7 +42,7 @@ namespace NadekoBot.Modules.Gambling
{
try
{
await ReplyErrorLocalizedAsync("no_more_cards").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_more_cards).ConfigureAwait(false);
}
catch
{
@@ -117,7 +117,7 @@ namespace NadekoBot.Modules.Gambling
return c;
});
await ReplyConfirmLocalizedAsync("deck_reshuffled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.deck_reshuffled).ConfigureAwait(false);
}
}
}

View File

@@ -38,7 +38,7 @@ namespace NadekoBot.Modules.Gambling
{
if (count > 10 || count < 1)
{
await ReplyErrorLocalizedAsync("flip_invalid", 10).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.flip_invalid(10));
return;
}
var headCount = 0;
@@ -94,7 +94,7 @@ namespace NadekoBot.Modules.Gambling
var removed = await _cs.RemoveAsync(ctx.User, "Betflip Gamble", amount, false, gamble: true).ConfigureAwait(false);
if (!removed)
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
BetFlipGuess result;

View File

@@ -84,20 +84,20 @@ namespace NadekoBot.Modules.Gambling
var period = _config.Timely.Cooldown;
if (val <= 0 || period <= 0)
{
await ReplyErrorLocalizedAsync("timely_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.timely_none).ConfigureAwait(false);
return;
}
TimeSpan? rem;
if ((rem = _cache.AddTimelyClaim(ctx.User.Id, period)) != null)
{
await ReplyErrorLocalizedAsync("timely_already_claimed", rem?.ToString(@"dd\d\ hh\h\ mm\m\ ss\s")).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.timely_already_claimed(rem?.ToString(@"dd\d\ hh\h\ mm\m\ ss\s"))).ConfigureAwait(false);
return;
}
await _cs.AddAsync(ctx.User.Id, "Timely claim", val).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("timely", n(val) + CurrencySign, period).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.timely(n(val) + CurrencySign, period));
}
[NadekoCommand, Aliases]
@@ -105,7 +105,7 @@ namespace NadekoBot.Modules.Gambling
public async Task TimelyReset()
{
_cache.RemoveAllTimelyClaims();
await ReplyConfirmLocalizedAsync("timely_reset").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.timely_reset).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -122,9 +122,9 @@ namespace NadekoBot.Modules.Gambling
});
if (amount == 0)
await ReplyConfirmLocalizedAsync("timely_set_none").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.timely_set_none).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("timely_set", Format.Bold(n(amount) + CurrencySign), Format.Bold(period.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.timely_set(Format.Bold(n(amount) + CurrencySign), Format.Bold(period.ToString()))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -164,7 +164,7 @@ namespace NadekoBot.Modules.Gambling
public async Task Cash([Leftover] IUser user = null)
{
user = user ?? ctx.User;
await ConfirmLocalizedAsync("has", Format.Bold(user.ToString()), $"{GetCurrency(user.Id)} {CurrencySign}").ConfigureAwait(false);
await ConfirmLocalizedAsync(strs.has(Format.Bold(user.ToString()), $"{GetCurrency(user.Id)} {CurrencySign}"));
}
[NadekoCommand, Aliases]
@@ -217,7 +217,7 @@ namespace NadekoBot.Modules.Gambling
[Priority(0)]
public async Task Cash(ulong userId)
{
await ReplyConfirmLocalizedAsync("has", Format.Code(userId.ToString()), $"{GetCurrency(userId)} {CurrencySign}").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.has(Format.Code(userId.ToString()), $"{GetCurrency(userId)} {CurrencySign}"));
}
[NadekoCommand, Aliases]
@@ -230,12 +230,11 @@ namespace NadekoBot.Modules.Gambling
var success = await _cs.RemoveAsync((IGuildUser)ctx.User, $"Gift to {receiver.Username} ({receiver.Id}).", amount, false).ConfigureAwait(false);
if (!success)
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
await _cs.AddAsync(receiver, $"Gift from {ctx.User.Username} ({ctx.User.Id}) - {msg}.", amount, true).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("gifted", n(amount) + CurrencySign, Format.Bold(receiver.ToString()), msg)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.gifted(n(amount) + CurrencySign, Format.Bold(receiver.ToString())));
}
[NadekoCommand, Aliases]
@@ -270,7 +269,7 @@ namespace NadekoBot.Modules.Gambling
$"Awarded by bot owner. ({ctx.User.Username}/{ctx.User.Id}) {(msg ?? "")}",
amount,
gamble: (ctx.Client.CurrentUser.Id != usrId)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("awarded", n(amount) + CurrencySign, $"<@{usrId}>").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.awarded(n(amount) + CurrencySign, $"<@{usrId}>"));
}
[NadekoCommand, Aliases]
@@ -289,10 +288,10 @@ namespace NadekoBot.Modules.Gambling
gamble: true)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("mass_award",
await ReplyConfirmLocalizedAsync(strs.mass_award(
n(amount) + CurrencySign,
Format.Bold(users.Count.ToString()),
Format.Bold(role.Name)).ConfigureAwait(false);
Format.Bold(role.Name)));
}
[NadekoCommand, Aliases]
@@ -309,10 +308,10 @@ namespace NadekoBot.Modules.Gambling
gamble: true)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("mass_take",
await ReplyConfirmLocalizedAsync(strs.mass_take(
n(amount) + CurrencySign,
Format.Bold(users.Count.ToString()),
Format.Bold(role.Name)).ConfigureAwait(false);
Format.Bold(role.Name)));
}
[NadekoCommand, Aliases]
@@ -326,9 +325,9 @@ namespace NadekoBot.Modules.Gambling
if (await _cs.RemoveAsync(user, $"Taken by bot owner.({ctx.User.Username}/{ctx.User.Id})", amount,
gamble: (ctx.Client.CurrentUser.Id != user.Id)).ConfigureAwait(false))
await ReplyConfirmLocalizedAsync("take", n(amount) + CurrencySign, Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.take(n(amount) + CurrencySign, Format.Bold(user.ToString()))).ConfigureAwait(false);
else
await ReplyErrorLocalizedAsync("take_fail", n(amount) + CurrencySign, Format.Bold(user.ToString()), CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.take_fail(n(amount) + CurrencySign, Format.Bold(user.ToString()), CurrencySign));
}
@@ -341,9 +340,9 @@ namespace NadekoBot.Modules.Gambling
if (await _cs.RemoveAsync(usrId, $"Taken by bot owner.({ctx.User.Username}/{ctx.User.Id})", amount,
gamble: (ctx.Client.CurrentUser.Id != usrId)).ConfigureAwait(false))
await ReplyConfirmLocalizedAsync("take", amount + CurrencySign, $"<@{usrId}>").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.take(amount + CurrencySign, $"<@{usrId}>"));
else
await ReplyErrorLocalizedAsync("take_fail", amount + CurrencySign, Format.Code(usrId.ToString()), CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.take_fail(amount + CurrencySign, Format.Code(usrId.ToString()), CurrencySign));
}
private IUserMessage rdMsg = null;
@@ -385,7 +384,7 @@ namespace NadekoBot.Modules.Gambling
{
if (other.Amount != amount)
{
await ReplyErrorLocalizedAsync("roll_duel_already_challenged").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.roll_duel_already_challenged).ConfigureAwait(false);
}
else
{
@@ -398,11 +397,10 @@ namespace NadekoBot.Modules.Gambling
game.OnGameTick += Game_OnGameTick;
game.OnEnded += Game_OnEnded;
await ReplyConfirmLocalizedAsync("roll_duel_challenge",
await ReplyConfirmLocalizedAsync(strs.roll_duel_challenge(
Format.Bold(ctx.User.ToString()),
Format.Bold(u.ToString()),
Format.Bold(amount + CurrencySign))
.ConfigureAwait(false);
Format.Bold(amount + CurrencySign)));
}
async Task Game_OnGameTick(RollDuelGame arg)
@@ -446,11 +444,11 @@ namespace NadekoBot.Modules.Gambling
}
else if (reason == RollDuelGame.Reason.Timeout)
{
await ReplyErrorLocalizedAsync("roll_duel_timeout").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.roll_duel_timeout).ConfigureAwait(false);
}
else if (reason == RollDuelGame.Reason.NoFunds)
{
await ReplyErrorLocalizedAsync("roll_duel_no_funds").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.roll_duel_no_funds).ConfigureAwait(false);
}
}
finally
@@ -467,7 +465,7 @@ namespace NadekoBot.Modules.Gambling
if (!await _cs.RemoveAsync(ctx.User, "Betroll Gamble", amount, false, gamble: true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
@@ -630,7 +628,7 @@ namespace NadekoBot.Modules.Gambling
if (!await _cs.RemoveAsync(ctx.User.Id,
"Rps-bet", amount, gamble: true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
}

View File

@@ -70,8 +70,8 @@ namespace NadekoBot.Modules.Gambling.Services
}
}
private string GetText(ulong gid, string key, params object[] rep)
=> _strings.GetText(key, gid, rep);
private string GetText(ulong gid, LocStr str)
=> _strings.GetText(str, gid);
public bool ToggleCurrencyGeneration(ulong gid, ulong cid)
{
@@ -214,10 +214,10 @@ namespace NadekoBot.Modules.Gambling.Services
{
var prefix = _cmdHandler.GetPrefix(channel.Guild.Id);
var toSend = dropAmount == 1
? GetText(channel.GuildId, "curgen_sn", config.Currency.Sign)
+ " " + GetText(channel.GuildId, "pick_sn", prefix)
: GetText(channel.GuildId, "curgen_pl", dropAmount, config.Currency.Sign)
+ " " + GetText(channel.GuildId, "pick_pl", prefix);
? GetText(channel.GuildId, strs.curgen_sn(config.Currency.Sign))
+ " " + GetText(channel.GuildId, strs.pick_sn(prefix))
: GetText(channel.GuildId, strs.curgen_pl(dropAmount, config.Currency.Sign))
+ " " + GetText(channel.GuildId, strs.pick_pl(prefix));
var pw = config.Generation.HasPassword ? GenerateCurrencyPassword().ToUpperInvariant() : null;
@@ -311,15 +311,14 @@ namespace NadekoBot.Modules.Gambling.Services
// get the text
var prefix = _cmdHandler.GetPrefix(gid);
var msgToSend = GetText(gid,
"planted",
Format.Bold(user),
amount + _gss.Data.Currency.Sign,
prefix);
strs.planted(
Format.Bold(user),
amount + _gss.Data.Currency.Sign));
if (amount > 1)
msgToSend += " " + GetText(gid, "pick_pl", prefix);
msgToSend += " " + GetText(gid, strs.pick_pl(prefix));
else
msgToSend += " " + GetText(gid, "pick_sn", prefix);
msgToSend += " " + GetText(gid, strs.pick_sn(prefix));
//get the image
using (var stream = GetRandomCurrencyImage(pass, out var ext))

View File

@@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Gambling
if (entry is null)
{
await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_item_not_found).ConfigureAwait(false);
return;
}
@@ -117,13 +117,13 @@ namespace NadekoBot.Modules.Gambling
if (role is null)
{
await ReplyErrorLocalizedAsync("shop_role_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_role_not_found).ConfigureAwait(false);
return;
}
if (guser.RoleIds.Any(id => id == role.Id))
{
await ReplyErrorLocalizedAsync("shop_role_already_bought").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_role_already_bought).ConfigureAwait(false);
return;
}
@@ -137,18 +137,18 @@ namespace NadekoBot.Modules.Gambling
{
Log.Warning(ex, "Error adding shop role");
await _cs.AddAsync(ctx.User.Id, $"Shop error refund", entry.Price).ConfigureAwait(false);
await ReplyErrorLocalizedAsync("shop_role_purchase_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_role_purchase_error).ConfigureAwait(false);
return;
}
var profit = GetProfitAmount(entry.Price);
await _cs.AddAsync(entry.AuthorId, $"Shop sell item - {entry.Type}", profit).ConfigureAwait(false);
await _cs.AddAsync(ctx.Client.CurrentUser.Id, $"Shop sell item - cut", entry.Price - profit).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("shop_role_purchase", Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.shop_role_purchase(Format.Bold(role.Name))).ConfigureAwait(false);
return;
}
else
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
}
@@ -156,7 +156,7 @@ namespace NadekoBot.Modules.Gambling
{
if (entry.Items.Count == 0)
{
await ReplyErrorLocalizedAsync("out_of_stock").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.out_of_stock).ConfigureAwait(false);
return;
}
@@ -202,14 +202,14 @@ namespace NadekoBot.Modules.Gambling
}
}
}
await ReplyErrorLocalizedAsync("shop_buy_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_buy_error).ConfigureAwait(false);
return;
}
await ReplyConfirmLocalizedAsync("shop_item_purchase").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.shop_item_purchase).ConfigureAwait(false);
}
else
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
}
@@ -307,13 +307,13 @@ namespace NadekoBot.Modules.Gambling
}
}
if (entry is null)
await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_item_not_found).ConfigureAwait(false);
else if (!rightType)
await ReplyErrorLocalizedAsync("shop_item_wrong_type").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_item_wrong_type).ConfigureAwait(false);
else if (added == false)
await ReplyErrorLocalizedAsync("shop_list_item_not_unique").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_list_item_not_unique).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("shop_list_item_added").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.shop_list_item_added).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -342,7 +342,7 @@ namespace NadekoBot.Modules.Gambling
}
if (removed is null)
await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.shop_item_not_found).ConfigureAwait(false);
else
await ctx.Channel.EmbedAsync(EntryToEmbed(removed)
.WithTitle(GetText(strs.shop_item_rm))).ConfigureAwait(false);

View File

@@ -149,13 +149,13 @@ namespace NadekoBot.Modules.Gambling
const int maxAmount = 9999;
if (amount > maxAmount)
{
await ReplyErrorLocalizedAsync("max_bet_limit", maxAmount + CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.max_bet_limit(maxAmount + CurrencySign));
return;
}
if (!await _cs.RemoveAsync(ctx.User, "Slot Machine", amount, false, gamble: true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
Interlocked.Add(ref _totalBet, amount.Value);

View File

@@ -34,10 +34,10 @@ namespace NadekoBot.Modules.Gambling
if (await _service.TryReset(ctx.User))
{
await ReplyConfirmLocalizedAsync("waifu_reset");
await ReplyConfirmLocalizedAsync(strs.waifu_reset);
return;
}
await ReplyErrorLocalizedAsync("waifu_reset_fail");
await ReplyErrorLocalizedAsync(strs.waifu_reset_fail);
}
[NadekoCommand, Aliases]
@@ -46,13 +46,13 @@ namespace NadekoBot.Modules.Gambling
{
if (amount < _config.Waifu.MinPrice)
{
await ReplyErrorLocalizedAsync("waifu_isnt_cheap", _config.Waifu.MinPrice + CurrencySign);
await ReplyErrorLocalizedAsync(strs.waifu_isnt_cheap(_config.Waifu.MinPrice + CurrencySign));
return;
}
if (target.Id == ctx.User.Id)
{
await ReplyErrorLocalizedAsync("waifu_not_yourself");
await ReplyErrorLocalizedAsync(strs.waifu_not_yourself);
return;
}
@@ -60,12 +60,12 @@ namespace NadekoBot.Modules.Gambling
if (result == WaifuClaimResult.InsufficientAmount)
{
await ReplyErrorLocalizedAsync("waifu_not_enough", Math.Ceiling(w.Price * (isAffinity ? 0.88f : 1.1f)));
await ReplyErrorLocalizedAsync(strs.waifu_not_enough(Math.Ceiling(w.Price * (isAffinity ? 0.88f : 1.1f))));
return;
}
if (result == WaifuClaimResult.NotEnoughFunds)
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}
var msg = GetText(strs.waifu_claimed(
@@ -86,14 +86,14 @@ namespace NadekoBot.Modules.Gambling
if (!await _service.WaifuTransfer(ctx.User, waifuId, newOwner)
)
{
await ReplyErrorLocalizedAsync("waifu_transfer_fail");
await ReplyErrorLocalizedAsync(strs.waifu_transfer_fail);
return;
}
await ReplyConfirmLocalizedAsync("waifu_transfer_success",
await ReplyConfirmLocalizedAsync(strs.waifu_transfer_success(
Format.Bold(waifuId.ToString()),
Format.Bold(ctx.User.ToString()),
Format.Bold(newOwner.ToString()));
Format.Bold(newOwner.ToString())));
}
[NadekoCommand, Aliases]
@@ -103,14 +103,14 @@ namespace NadekoBot.Modules.Gambling
{
if (!await _service.WaifuTransfer(ctx.User, waifu.Id, newOwner))
{
await ReplyErrorLocalizedAsync("waifu_transfer_fail");
await ReplyErrorLocalizedAsync(strs.waifu_transfer_fail);
return;
}
await ReplyConfirmLocalizedAsync("waifu_transfer_success",
await ReplyConfirmLocalizedAsync(strs.waifu_transfer_success(
Format.Bold(waifu.ToString()),
Format.Bold(ctx.User.ToString()),
Format.Bold(newOwner.ToString()));
Format.Bold(newOwner.ToString())));
}
[NadekoCommand, Aliases]
@@ -121,7 +121,7 @@ namespace NadekoBot.Modules.Gambling
var waifuUserId = _service.GetWaifuUserId(ctx.User.Id, target);
if (waifuUserId == default)
{
return ReplyErrorLocalizedAsync("waifu_not_yours");
return ReplyErrorLocalizedAsync(strs.waifu_not_yours);
}
return Divorce(waifuUserId);
@@ -145,21 +145,21 @@ namespace NadekoBot.Modules.Gambling
if (result == DivorceResult.SucessWithPenalty)
{
await ReplyConfirmLocalizedAsync("waifu_divorced_like", Format.Bold(w.Waifu.ToString()), amount + CurrencySign);
await ReplyErrorLocalizedAsync(strs.waifu_divorced_like(Format.Bold(w.Waifu.ToString()), amount + CurrencySign));
}
else if (result == DivorceResult.Success)
{
await ReplyConfirmLocalizedAsync("waifu_divorced_notlike", amount + CurrencySign);
await ReplyErrorLocalizedAsync(strs.waifu_divorced_notlike(amount + CurrencySign));
}
else if (result == DivorceResult.NotYourWife)
{
await ReplyErrorLocalizedAsync("waifu_not_yours");
await ReplyErrorLocalizedAsync(strs.waifu_not_yours);
}
else
{
await ReplyErrorLocalizedAsync("waifu_recent_divorce",
await ReplyErrorLocalizedAsync(strs.waifu_recent_divorce(
Format.Bold(((int)remaining?.TotalHours).ToString()),
Format.Bold(remaining?.Minutes.ToString()));
Format.Bold(remaining?.Minutes.ToString())));
}
}
@@ -169,7 +169,7 @@ namespace NadekoBot.Modules.Gambling
{
if (u?.Id == ctx.User.Id)
{
await ReplyErrorLocalizedAsync("waifu_egomaniac");
await ReplyErrorLocalizedAsync(strs.waifu_egomaniac);
return;
}
var (oldAff, sucess, remaining) = await _service.ChangeAffinityAsync(ctx.User, u);
@@ -177,27 +177,27 @@ namespace NadekoBot.Modules.Gambling
{
if (remaining != null)
{
await ReplyErrorLocalizedAsync("waifu_affinity_cooldown",
await ReplyErrorLocalizedAsync(strs.waifu_affinity_cooldown(
Format.Bold(((int)remaining?.TotalHours).ToString()),
Format.Bold(remaining?.Minutes.ToString()));
Format.Bold(remaining?.Minutes.ToString())));
}
else
{
await ReplyErrorLocalizedAsync("waifu_affinity_already");
await ReplyErrorLocalizedAsync(strs.waifu_affinity_already);
}
return;
}
if (u is null)
{
await ReplyConfirmLocalizedAsync("waifu_affinity_reset");
await ReplyConfirmLocalizedAsync(strs.waifu_affinity_reset);
}
else if (oldAff is null)
{
await ReplyConfirmLocalizedAsync("waifu_affinity_set", Format.Bold(u.ToString()));
await ReplyConfirmLocalizedAsync(strs.waifu_affinity_set(Format.Bold(u.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync("waifu_affinity_changed", Format.Bold(oldAff.ToString()), Format.Bold(u.ToString()));
await ReplyConfirmLocalizedAsync(strs.waifu_affinity_changed(Format.Bold(oldAff.ToString()), Format.Bold(u.ToString())));
}
}
@@ -217,7 +217,7 @@ namespace NadekoBot.Modules.Gambling
if (waifus.Count() == 0)
{
await ReplyConfirmLocalizedAsync("waifus_none");
await ReplyConfirmLocalizedAsync(strs.waifus_none);
return;
}
@@ -338,20 +338,20 @@ namespace NadekoBot.Modules.Gambling
var item = allItems.FirstOrDefault(x => x.Name.ToLowerInvariant() == itemName.ToLowerInvariant());
if (item is null)
{
await ReplyErrorLocalizedAsync("waifu_gift_not_exist");
await ReplyErrorLocalizedAsync(strs.waifu_gift_not_exist);
return;
}
var sucess = await _service.GiftWaifuAsync(ctx.User, waifu, item);
if (sucess)
{
await ReplyConfirmLocalizedAsync("waifu_gift",
await ReplyConfirmLocalizedAsync(strs.waifu_gift(
Format.Bold(item.ToString() + " " + item.ItemEmoji),
Format.Bold(waifu.ToString()));
Format.Bold(waifu.ToString())));
}
else
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
}
}
}

View File

@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Gambling
if (!await _cs.RemoveAsync(ctx.User.Id, "Wheel Of Fortune - bet", amount, gamble: true).ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
return;
}

View File

@@ -54,7 +54,7 @@ namespace NadekoBot.Modules.Games
}
else
{
await ReplyErrorLocalizedAsync("acro_running").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.acro_running).ConfigureAwait(false);
}
Task _client_MessageReceived(SocketMessage msg)
@@ -116,10 +116,10 @@ namespace NadekoBot.Modules.Games
var embed = _eb.Create()
.WithOkColor()
.WithTitle(GetText(strs.acrophobia) + " - " + GetText(strs.submissions_closed))
.WithDescription(GetText(strs.acro_nym_was(Format.Bold(string.Join(".", game.StartingLetters))) + "\n" +
.WithDescription(GetText(strs.acro_nym_was(Format.Bold(string.Join(".", game.StartingLetters)) + "\n" +
$@"--
{submissions.Aggregate("", (agg, cur) => agg + $"`{++i}.` **{cur.Key.Input}**\n")}
--"))
--")))
.WithFooter(GetText(strs.acro_vote));
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);

View File

@@ -37,7 +37,7 @@ namespace NadekoBot.Modules.Games
uow.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, false);
await uow.SaveChangesAsync();
}
await ReplyConfirmLocalizedAsync("cleverbot_disabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.cleverbot_disabled).ConfigureAwait(false);
return;
}
@@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Games
await uow.SaveChangesAsync();
}
await ReplyConfirmLocalizedAsync("cleverbot_enabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.cleverbot_enabled).ConfigureAwait(false);
}
}

View File

@@ -63,7 +63,7 @@ namespace NadekoBot.Modules.Games
if (originalStream is null)
{
await ReplyErrorLocalizedAsync("something_went_wrong").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.something_went_wrong).ConfigureAwait(false);
return;
}

View File

@@ -47,7 +47,7 @@ namespace NadekoBot.Modules.Games
if (!_service.HangmanGames.TryAdd(ctx.Channel.Id, hm))
{
hm.Dispose();
await ReplyErrorLocalizedAsync("hangman_running").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.hangman_running).ConfigureAwait(false);
return;
}
hm.OnGameEnded += Hm_OnGameEnded;
@@ -136,7 +136,7 @@ namespace NadekoBot.Modules.Games
if (_service.HangmanGames.TryRemove(ctx.Channel.Id, out var removed))
{
await removed.Stop().ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("hangman_stopped").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.hangman_stopped).ConfigureAwait(false);
}
}
}

View File

@@ -39,12 +39,12 @@ namespace NadekoBot.Modules.Games
return;
}
await ReplyConfirmLocalizedAsync("nunchi_joined", nunchi.ParticipantCount).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.nunchi_joined(nunchi.ParticipantCount));
return;
}
try { await ConfirmLocalizedAsync("nunchi_created").ConfigureAwait(false); } catch { }
try { await ConfirmLocalizedAsync(strs.nunchi_created); } catch { }
nunchi.OnGameEnded += Nunchi_OnGameEnded;
//nunchi.OnGameStarted += Nunchi_OnGameStarted;
@@ -58,7 +58,7 @@ namespace NadekoBot.Modules.Games
{
if (_service.NunchiGames.TryRemove(ctx.Guild.Id, out var game))
game.Dispose();
await ConfirmLocalizedAsync("nunchi_failed_to_start").ConfigureAwait(false);
await ConfirmLocalizedAsync(strs.nunchi_failed_to_start).ConfigureAwait(false);
}
Task _client_MessageReceived(SocketMessage arg)
@@ -90,36 +90,36 @@ namespace NadekoBot.Modules.Games
}
if (arg2 is null)
return ConfirmLocalizedAsync("nunchi_ended_no_winner", Format.Bold(arg2));
return ConfirmLocalizedAsync(strs.nunchi_ended_no_winner);
else
return ConfirmLocalizedAsync("nunchi_ended", Format.Bold(arg2));
return ConfirmLocalizedAsync(strs.nunchi_ended(Format.Bold(arg2)));
}
}
private Task Nunchi_OnRoundStarted(NunchiGame arg, int cur)
{
return ConfirmLocalizedAsync("nunchi_round_started",
return ConfirmLocalizedAsync(strs.nunchi_round_started(
Format.Bold(arg.ParticipantCount.ToString()),
Format.Bold(cur.ToString()));
Format.Bold(cur.ToString())));
}
private Task Nunchi_OnUserGuessed(NunchiGame arg)
{
return ConfirmLocalizedAsync("nunchi_next_number", Format.Bold(arg.CurrentNumber.ToString()));
return ConfirmLocalizedAsync(strs.nunchi_next_number(Format.Bold(arg.CurrentNumber.ToString())));
}
private Task Nunchi_OnRoundEnded(NunchiGame arg1, (ulong Id, string Name)? arg2)
{
if(arg2.HasValue)
return ConfirmLocalizedAsync("nunchi_round_ended", Format.Bold(arg2.Value.Name));
return ConfirmLocalizedAsync(strs.nunchi_round_ended(Format.Bold(arg2.Value.Name)));
else
return ConfirmLocalizedAsync("nunchi_round_ended_boot",
Format.Bold("\n" + string.Join("\n, ", arg1.Participants.Select(x => x.Name)))); // this won't work if there are too many users
return ConfirmLocalizedAsync(strs.nunchi_round_ended_boot(
Format.Bold("\n" + string.Join("\n, ", arg1.Participants.Select(x => x.Name))))); // this won't work if there are too many users
}
private Task Nunchi_OnGameStarted(NunchiGame arg)
{
return ConfirmLocalizedAsync("nunchi_started", Format.Bold(arg.ParticipantCount.ToString()));
return ConfirmLocalizedAsync(strs.nunchi_started(Format.Bold(arg.ParticipantCount.ToString())));
}
}
}

View File

@@ -36,8 +36,7 @@ namespace NadekoBot.Modules.Games
if (picked > 0)
{
var msg = await ReplyConfirmLocalizedAsync("picked", picked + CurrencySign)
.ConfigureAwait(false);
var msg = await ReplyConfirmLocalizedAsync(strs.picked(picked + CurrencySign));
msg.DeleteAfter(10);
}
@@ -67,7 +66,7 @@ namespace NadekoBot.Modules.Games
var success = await _service.PlantAsync(ctx.Guild.Id, ctx.Channel, ctx.User.Id, ctx.User.ToString(), amount, pass);
if (!success)
{
await ReplyErrorLocalizedAsync("not_enough", CurrencySign).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_enough( CurrencySign));
return;
}
@@ -89,11 +88,11 @@ namespace NadekoBot.Modules.Games
bool enabled = _service.ToggleCurrencyGeneration(ctx.Guild.Id, ctx.Channel.Id);
if (enabled)
{
await ReplyConfirmLocalizedAsync("curgen_enabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.curgen_enabled).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("curgen_disabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.curgen_disabled).ConfigureAwait(false);
}
}

View File

@@ -35,7 +35,7 @@ namespace NadekoBot.Modules.Games
ctx.Channel.Id, arg);
if(poll is null)
{
await ReplyErrorLocalizedAsync("poll_invalid_input").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.poll_invalid_input).ConfigureAwait(false);
return;
}
if (_service.StartPoll(poll))
@@ -52,7 +52,7 @@ namespace NadekoBot.Modules.Games
}
else
{
await ReplyErrorLocalizedAsync("poll_already_running").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.poll_already_running).ConfigureAwait(false);
}
}

View File

@@ -44,7 +44,7 @@ namespace NadekoBot.Modules.Games
}
game = new TicTacToe(base.Strings, this._client, channel, (IGuildUser)ctx.User, options, _eb);
_service.TicTacToeGames.Add(channel.Id, game);
await ReplyConfirmLocalizedAsync("ttt_created").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.ttt_created).ConfigureAwait(false);
game.OnEnded += (g) =>
{

View File

@@ -79,7 +79,7 @@ namespace NadekoBot.Modules.Games
return;
}
await ReplyErrorLocalizedAsync("trivia_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.trivia_none).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -94,7 +94,7 @@ namespace NadekoBot.Modules.Games
return;
}
await ReplyErrorLocalizedAsync("trivia_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.trivia_none).ConfigureAwait(false);
}
}
}

View File

@@ -98,7 +98,7 @@ namespace NadekoBot.Modules.Help
localModules
.OrderBy(module => module.Name)
.ForEach(module => embed.AddField($"{GetModuleEmoji(module.Name)} {module.Name}",
GetText($"module_description_{module.Name.ToLowerInvariant()}") + "\n" +
GetText(GetModuleLocStr(module.Name)) + "\n" +
Format.Code(GetText(strs.module_footer(Prefix, module.Name.ToLowerInvariant()))),
true));
@@ -106,6 +106,37 @@ namespace NadekoBot.Modules.Help
}, topLevelModules.Count(), 12, false);
}
private LocStr GetModuleLocStr(string moduleName)
{
switch (moduleName.ToLowerInvariant())
{
case "help":
return strs.module_description_help;
case "administration":
return strs.module_description_administration;
case "customreactions":
return strs.module_description_customreactions;
case "searches":
return strs.module_description_searches;
case "utility":
return strs.module_description_utility;
case "games":
return strs.module_description_games;
case "gambling":
return strs.module_description_gambling;
case "music":
return strs.module_description_music;
case "nsfw":
return strs.module_description_nsfw;
case "permissions":
return strs.module_description_permissions;
case "xp":
return strs.module_description_xp;
default:
return strs.module_description_missing;
}
}
private string GetModuleEmoji(string moduleName)
{
moduleName = moduleName.ToLowerInvariant();
@@ -190,9 +221,9 @@ namespace NadekoBot.Modules.Help
if (!cmds.Any())
{
if (opts.View != CommandsOptions.ViewType.Hide)
await ReplyErrorLocalizedAsync("module_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.module_not_found).ConfigureAwait(false);
else
await ReplyErrorLocalizedAsync("module_not_found_or_cant_exec").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.module_not_found_or_cant_exec).ConfigureAwait(false);
return;
}
var i = 0;
@@ -245,7 +276,7 @@ namespace NadekoBot.Modules.Help
return;
}
await ReplyErrorLocalizedAsync("command_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.command_not_found).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -269,7 +300,7 @@ namespace NadekoBot.Modules.Help
}
catch (Exception)
{
await ReplyErrorLocalizedAsync("cant_dm").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.cant_dm).ConfigureAwait(false);
}
return;
}
@@ -389,15 +420,15 @@ namespace NadekoBot.Modules.Help
[NadekoCommand, Aliases]
public async Task Guide()
{
await ConfirmLocalizedAsync("guide",
await ConfirmLocalizedAsync(strs.guide(
"https://nadeko.bot/commands",
"http://nadekobot.readthedocs.io/en/latest/").ConfigureAwait(false);
"http://nadekobot.readthedocs.io/en/latest/"));
}
[NadekoCommand, Aliases]
public async Task Donate()
{
await ReplyConfirmLocalizedAsync("donate", PatreonUrl, PaypalUrl).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.donate(PatreonUrl, PaypalUrl));
}
}

View File

@@ -32,14 +32,14 @@ namespace NadekoBot.Modules.Music
if (userVoiceChannelId is null)
{
await ReplyErrorLocalizedAsync("must_be_in_voice");
await ReplyErrorLocalizedAsync(strs.must_be_in_voice);
return false;
}
var currentUser = await ctx.Guild.GetCurrentUserAsync();
if (currentUser.VoiceChannel?.Id != userVoiceChannelId)
{
await ReplyErrorLocalizedAsync("not_with_bot_in_voice");
await ReplyErrorLocalizedAsync(strs.not_with_bot_in_voice);
return false;
}
@@ -69,7 +69,7 @@ namespace NadekoBot.Modules.Music
if (voiceChannelId is null)
{
await ReplyErrorLocalizedAsync("must_be_in_voice");
await ReplyErrorLocalizedAsync(strs.must_be_in_voice);
return false;
}
@@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Music
if (botUser.VoiceChannel?.Id != voiceChannelId)
{
await ReplyErrorLocalizedAsync("not_with_bot_in_voice");
await ReplyErrorLocalizedAsync(strs.not_with_bot_in_voice);
return false;
}
@@ -96,7 +96,7 @@ namespace NadekoBot.Modules.Music
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
if (mp is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Music
forcePlatform);
if (trackInfo is null)
{
await ReplyErrorLocalizedAsync("song_not_found");
await ReplyErrorLocalizedAsync(strs.song_not_found);
return;
}
@@ -125,7 +125,7 @@ namespace NadekoBot.Modules.Music
queuedMessage?.DeleteAfter(10, _logService);
if (mp.IsStopped)
{
var msg = await ReplyErrorLocalizedAsync("queue_stopped", Format.Code(Prefix + "play"));
var msg = await ReplyErrorLocalizedAsync(strs.queue_stopped(Format.Code(Prefix + "play")));
msg.DeleteAfter(10, _logService);
}
}
@@ -147,7 +147,7 @@ namespace NadekoBot.Modules.Music
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
if (mp is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -165,7 +165,7 @@ namespace NadekoBot.Modules.Music
if (voiceChannelId is null)
{
await ReplyErrorLocalizedAsync("must_be_in_voice");
await ReplyErrorLocalizedAsync(strs.must_be_in_voice);
return;
}
@@ -221,7 +221,7 @@ namespace NadekoBot.Modules.Music
{
if (vol < 0 || vol > 100)
{
await ReplyErrorLocalizedAsync("volume_input_invalid");
await ReplyErrorLocalizedAsync(strs.volume_input_invalid);
return;
}
@@ -230,7 +230,7 @@ namespace NadekoBot.Modules.Music
return;
await _service.SetVolumeAsync(ctx.Guild.Id, vol);
await ReplyConfirmLocalizedAsync("volume_set", vol);
await ReplyErrorLocalizedAsync(strs.volume_set(vol));
}
[NadekoCommand, Aliases]
@@ -244,7 +244,7 @@ namespace NadekoBot.Modules.Music
var success = await _service.PlayAsync(ctx.Guild.Id, ((IGuildUser)ctx.User).VoiceChannel.Id);
if (!success)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
}
@@ -259,7 +259,7 @@ namespace NadekoBot.Modules.Music
// show page with the current song
if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp))
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -277,7 +277,7 @@ namespace NadekoBot.Modules.Music
IReadOnlyCollection<IQueuedTrackInfo> tracks;
if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp) || (tracks = mp.GetQueuedTracks()).Count == 0)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -357,7 +357,7 @@ namespace NadekoBot.Modules.Music
if (videos is null || videos.Count == 0)
{
await ReplyErrorLocalizedAsync("song_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.song_not_found).ConfigureAwait(false);
return;
}
@@ -410,7 +410,7 @@ namespace NadekoBot.Modules.Music
{
if (index < 1)
{
await ReplyErrorLocalizedAsync("removed_song_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.removed_song_error).ConfigureAwait(false);
return;
}
@@ -420,13 +420,13 @@ namespace NadekoBot.Modules.Music
if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp))
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
if (!mp.TryRemoveTrackAt(index - 1, out var song))
{
await ReplyErrorLocalizedAsync("removed_song_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.removed_song_error).ConfigureAwait(false);
return;
}
@@ -451,12 +451,12 @@ namespace NadekoBot.Modules.Music
if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp))
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
mp.Clear();
await ReplyConfirmLocalizedAsync("queue_cleared").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.queue_cleared).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -469,7 +469,7 @@ namespace NadekoBot.Modules.Music
if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp))
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -502,18 +502,18 @@ namespace NadekoBot.Modules.Music
await _service.SetRepeatAsync(ctx.Guild.Id, InputToDbType(type));
if (type == InputRepeatType.None)
await ReplyConfirmLocalizedAsync("repeating_none");
await ReplyConfirmLocalizedAsync(strs.repeating_none);
else if (type == InputRepeatType.Queue)
await ReplyConfirmLocalizedAsync("repeating_queue");
await ReplyConfirmLocalizedAsync(strs.repeating_queue);
else
await ReplyConfirmLocalizedAsync("repeating_track");
await ReplyConfirmLocalizedAsync(strs.repeating_track);
}
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]
public async Task ReptCurSong()
{
await ReplyPendingLocalizedAsync("obsolete_use", $"`{Prefix}qrp song`");
await ReplyPendingLocalizedAsync(strs.obsolete_use($"`{Prefix}qrp song`"));
await QueueRepeat(InputRepeatType.Song);
}
@@ -527,7 +527,7 @@ namespace NadekoBot.Modules.Music
if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp) || mp.GetCurrentTrack(out _) is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -558,7 +558,7 @@ namespace NadekoBot.Modules.Music
if (voiceChannelId is null)
{
await ReplyErrorLocalizedAsync("must_be_in_voice");
await ReplyErrorLocalizedAsync(strs.must_be_in_voice);
return;
}
@@ -569,20 +569,20 @@ namespace NadekoBot.Modules.Music
if (botUser.VoiceChannel?.Id != voiceChannelId)
{
await ReplyErrorLocalizedAsync("not_with_bot_in_voice");
await ReplyErrorLocalizedAsync(strs.not_with_bot_in_voice);
return;
}
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
if (mp is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
await _service.EnqueueDirectoryAsync(mp, dirPath, ctx.User.ToString());
await ReplyConfirmLocalizedAsync("dir_queue_complete").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.dir_queue_complete).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -591,7 +591,7 @@ namespace NadekoBot.Modules.Music
{
if (--from < 0 || --to < 0 || from == to)
{
await ReplyErrorLocalizedAsync("invalid_input").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.invalid_input).ConfigureAwait(false);
return;
}
@@ -602,14 +602,14 @@ namespace NadekoBot.Modules.Music
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
if (mp is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
var track = mp.MoveTrack(from, to);
if (track is null)
{
await ReplyErrorLocalizedAsync("invalid_input").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.invalid_input).ConfigureAwait(false);
return;
}
@@ -645,7 +645,7 @@ namespace NadekoBot.Modules.Music
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
if (mp is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -670,7 +670,7 @@ namespace NadekoBot.Modules.Music
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
if (mp is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -680,7 +680,7 @@ namespace NadekoBot.Modules.Music
var queuedCount = await _service.EnqueueYoutubePlaylistAsync(mp, playlistQuery, ctx.User.ToString());
if (queuedCount == 0)
{
await ReplyErrorLocalizedAsync("no_search_results").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_search_results).ConfigureAwait(false);
return;
}
await ctx.OkAsync();
@@ -693,7 +693,7 @@ namespace NadekoBot.Modules.Music
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
if (mp is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -721,12 +721,12 @@ namespace NadekoBot.Modules.Music
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
if (mp is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
mp.ShuffleQueue();
await ReplyConfirmLocalizedAsync("queue_shuffled");
await ReplyConfirmLocalizedAsync(strs.queue_shuffled);
}
[NadekoCommand, Aliases]
@@ -736,7 +736,7 @@ namespace NadekoBot.Modules.Music
{
await _service.SetMusicChannelAsync(ctx.Guild.Id, ctx.Channel.Id);
await ReplyConfirmLocalizedAsync("set_music_channel");
await ReplyConfirmLocalizedAsync(strs.set_music_channel);
}
[NadekoCommand, Aliases]
@@ -746,7 +746,7 @@ namespace NadekoBot.Modules.Music
{
await _service.SetMusicChannelAsync(ctx.Guild.Id, null);
await ReplyConfirmLocalizedAsync("unset_music_channel");
await ReplyConfirmLocalizedAsync(strs.unset_music_channel);
}
[NadekoCommand, Aliases]
@@ -756,9 +756,9 @@ namespace NadekoBot.Modules.Music
var newState = await _service.ToggleAutoDisconnectAsync(ctx.Guild.Id);
if(newState)
await ReplyConfirmLocalizedAsync("autodc_enable");
await ReplyConfirmLocalizedAsync(strs.autodc_enable);
else
await ReplyConfirmLocalizedAsync("autodc_disable");
await ReplyConfirmLocalizedAsync(strs.autodc_disable);
}
[NadekoCommand, Aliases]
@@ -767,7 +767,7 @@ namespace NadekoBot.Modules.Music
public async Task MusicQuality()
{
var quality = await _service.GetMusicQualityAsync(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync("current_music_quality", Format.Bold(quality.ToString()));
await ReplyConfirmLocalizedAsync(strs.current_music_quality(Format.Bold(quality.ToString())));
}
[NadekoCommand, Aliases]
@@ -776,7 +776,7 @@ namespace NadekoBot.Modules.Music
public async Task MusicQuality(QualityPreset preset)
{
await _service.SetMusicQualityAsync(ctx.Guild.Id, preset);
await ReplyConfirmLocalizedAsync("music_quality_set", Format.Bold(preset.ToString()));
await ReplyConfirmLocalizedAsync(strs.music_quality_set(Format.Bold(preset.ToString())));
}
}
}

View File

@@ -99,9 +99,9 @@ namespace NadekoBot.Modules.Music
}
if (!success)
await ReplyErrorLocalizedAsync("playlist_delete_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.playlist_delete_fail).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("playlist_deleted").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.playlist_deleted).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -137,7 +137,7 @@ namespace NadekoBot.Modules.Music
{
if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp))
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -187,7 +187,7 @@ namespace NadekoBot.Modules.Music
if (voiceChannelId is null)
{
await ReplyErrorLocalizedAsync("must_be_in_voice");
await ReplyErrorLocalizedAsync(strs.must_be_in_voice);
return;
}
@@ -198,14 +198,14 @@ namespace NadekoBot.Modules.Music
if (botUser.VoiceChannel?.Id != voiceChannelId)
{
await ReplyErrorLocalizedAsync("not_with_bot_in_voice");
await ReplyErrorLocalizedAsync(strs.not_with_bot_in_voice);
return;
}
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel) ctx.Channel);
if (mp is null)
{
await ReplyErrorLocalizedAsync("no_player");
await ReplyErrorLocalizedAsync(strs.no_player);
return;
}
@@ -217,7 +217,7 @@ namespace NadekoBot.Modules.Music
if (mpl is null)
{
await ReplyErrorLocalizedAsync("playlist_id_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.playlist_id_not_found).ConfigureAwait(false);
return;
}

View File

@@ -208,7 +208,7 @@ namespace NadekoBot.Modules.Music.Services
_ = lastFinishedMessage?.DeleteAsync();
var embed = _eb.Create()
.WithOkColor()
.WithAuthor(GetText(guildId, "finished_song"), Music.MusicIconUrl)
.WithAuthor(GetText(guildId, strs.finished_song), Music.MusicIconUrl)
.WithDescription(trackInfo.PrettyName())
.WithFooter(trackInfo.PrettyTotalTime());
@@ -223,7 +223,7 @@ namespace NadekoBot.Modules.Music.Services
{
_ = lastPlayingMessage?.DeleteAsync();
var embed = _eb.Create().WithOkColor()
.WithAuthor(GetText(guildId, "playing_song", index + 1), Music.MusicIconUrl)
.WithAuthor(GetText(guildId, strs.playing_song(index + 1)), Music.MusicIconUrl)
.WithDescription(trackInfo.PrettyName())
.WithFooter($"{mp.PrettyVolume()} | {trackInfo.PrettyInfo()}");
@@ -308,6 +308,9 @@ namespace NadekoBot.Modules.Music.Services
private string GetText(ulong guildId, string key, params object[] args)
=> _strings.GetText(key, guildId, args);
private string GetText(ulong guildId, LocStr str)
=> _strings.GetText(str, guildId);
public IEnumerable<(string Name, Func<string> Func)> GetPlaceholders()
{

View File

@@ -57,7 +57,7 @@ namespace NadekoBot.Modules.NSFW
// return the error
if (img is null && !listOfProviders.Any())
{
await ReplyErrorLocalizedAsync("no_results").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_results).ConfigureAwait(false);
return;
}
@@ -116,7 +116,7 @@ namespace NadekoBot.Modules.NSFW
if (!_service.AutoHentaiTimers.TryRemove(ctx.Channel.Id, out t)) return;
t.Change(Timeout.Infinite, Timeout.Infinite); //proper way to disable the timer
await ReplyConfirmLocalizedAsync("stopped").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stopped).ConfigureAwait(false);
return;
}
@@ -146,9 +146,9 @@ namespace NadekoBot.Modules.NSFW
return t;
});
await ReplyConfirmLocalizedAsync("autohentai_started",
await ReplyConfirmLocalizedAsync(strs.autohentai_started(
interval,
string.Join(", ", tagsArr)).ConfigureAwait(false);
string.Join(", ", tagsArr)));
}
[NadekoCommand, Aliases]
@@ -164,7 +164,7 @@ namespace NadekoBot.Modules.NSFW
if (!_service.AutoBoobTimers.TryRemove(ctx.Channel.Id, out t)) return;
t.Change(Timeout.Infinite, Timeout.Infinite); //proper way to disable the timer
await ReplyConfirmLocalizedAsync("stopped").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stopped).ConfigureAwait(false);
return;
}
@@ -189,7 +189,7 @@ namespace NadekoBot.Modules.NSFW
return t;
});
await ReplyConfirmLocalizedAsync("started", interval).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.started(interval));
}
[NadekoCommand, Aliases]
@@ -204,7 +204,7 @@ namespace NadekoBot.Modules.NSFW
if (!_service.AutoButtTimers.TryRemove(ctx.Channel.Id, out t)) return;
t.Change(Timeout.Infinite, Timeout.Infinite); //proper way to disable the timer
await ReplyConfirmLocalizedAsync("stopped").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stopped).ConfigureAwait(false);
return;
}
@@ -229,7 +229,7 @@ namespace NadekoBot.Modules.NSFW
return t;
});
await ReplyConfirmLocalizedAsync("started", interval).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.started(interval));
}
#endif
@@ -254,7 +254,7 @@ namespace NadekoBot.Modules.NSFW
var linksEnum = images?.Where(l => l != null).ToArray();
if (images is null || !linksEnum.Any())
{
await ReplyErrorLocalizedAsync("no_results").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_results).ConfigureAwait(false);
return;
}
@@ -363,9 +363,9 @@ namespace NadekoBot.Modules.NSFW
var added = _service.ToggleBlacklistedTag(ctx.Guild.Id, tag);
if (added)
await ReplyConfirmLocalizedAsync("blacklisted_tag_add", tag).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.blacklisted_tag_add(tag));
else
await ReplyConfirmLocalizedAsync("blacklisted_tag_remove", tag).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.blacklisted_tag_remove(tag));
}
}
@@ -387,7 +387,7 @@ namespace NadekoBot.Modules.NSFW
if (g is null)
{
await ReplyErrorLocalizedAsync("not_found");
await ReplyErrorLocalizedAsync(strs.not_found);
return;
}
@@ -403,7 +403,7 @@ namespace NadekoBot.Modules.NSFW
if (g is null)
{
await ReplyErrorLocalizedAsync("not_found");
await ReplyErrorLocalizedAsync(strs.not_found);
return;
}
@@ -440,7 +440,7 @@ namespace NadekoBot.Modules.NSFW
imgObj = await _service.DapiSearch(tag, type, ctx.Guild?.Id, forceExplicit).ConfigureAwait(false);
if (imgObj is null)
await ReplyErrorLocalizedAsync("no_results").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_results).ConfigureAwait(false);
else
{
var embed = _eb.Create().WithOkColor()

View File

@@ -146,11 +146,11 @@ namespace NadekoBot.Modules.Permissions
}
if (action == AddRemove.Add)
await ReplyConfirmLocalizedAsync("blacklisted", Format.Code(type.ToString()),
Format.Code(id.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.blacklisted(Format.Code(type.ToString()),
Format.Code(id.ToString())));
else
await ReplyConfirmLocalizedAsync("unblacklisted", Format.Code(type.ToString()),
Format.Code(id.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.unblacklisted(Format.Code(type.ToString()),
Format.Code(id.ToString())));
}
}
}

View File

@@ -42,7 +42,7 @@ namespace NadekoBot.Modules.Permissions
var channel = (ITextChannel)ctx.Channel;
if (secs < 0 || secs > 3600)
{
await ReplyErrorLocalizedAsync("invalid_second_param_between", 0, 3600).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.invalid_second_param_between(0, 3600));
return;
}
@@ -72,14 +72,13 @@ namespace NadekoBot.Modules.Permissions
{
var activeCds = ActiveCooldowns.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<ActiveCooldown>());
activeCds.RemoveWhere(ac => ac.Command == name);
await ReplyConfirmLocalizedAsync("cmdcd_cleared",
Format.Bold(name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.cmdcd_cleared(Format.Bold(name)));
}
else
{
await ReplyConfirmLocalizedAsync("cmdcd_add",
await ReplyConfirmLocalizedAsync(strs.cmdcd_add(
Format.Bold(name),
Format.Bold(secs.ToString())).ConfigureAwait(false);
Format.Bold(secs.ToString())));
}
}
@@ -91,7 +90,7 @@ namespace NadekoBot.Modules.Permissions
var localSet = CommandCooldowns.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<CommandCooldown>());
if (!localSet.Any())
await ReplyConfirmLocalizedAsync("cmdcd_none").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.cmdcd_none).ConfigureAwait(false);
else
await channel.SendTableAsync("", localSet.Select(c => c.CommandName + ": " + c.Seconds + GetText(strs.sec)), s => $"{s,-30}", 2).ConfigureAwait(false);
}

View File

@@ -32,7 +32,7 @@ namespace NadekoBot.Modules.Permissions
public async Task FwClear()
{
_service.ClearFilteredWords(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync("fw_cleared").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.fw_cleared).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -52,12 +52,12 @@ namespace NadekoBot.Modules.Permissions
if (enabled)
{
_service.InviteFilteringServers.Add(channel.Guild.Id);
await ReplyConfirmLocalizedAsync("invite_filter_server_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.invite_filter_server_on).ConfigureAwait(false);
}
else
{
_service.InviteFilteringServers.TryRemove(channel.Guild.Id);
await ReplyConfirmLocalizedAsync("invite_filter_server_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.invite_filter_server_off).ConfigureAwait(false);
}
}
@@ -91,12 +91,12 @@ namespace NadekoBot.Modules.Permissions
if (removed is null)
{
_service.InviteFilteringChannels.Add(channel.Id);
await ReplyConfirmLocalizedAsync("invite_filter_channel_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.invite_filter_channel_on).ConfigureAwait(false);
}
else
{
_service.InviteFilteringChannels.TryRemove(channel.Id);
await ReplyConfirmLocalizedAsync("invite_filter_channel_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.invite_filter_channel_off).ConfigureAwait(false);
}
}
@@ -117,12 +117,12 @@ namespace NadekoBot.Modules.Permissions
if (enabled)
{
_service.LinkFilteringServers.Add(channel.Guild.Id);
await ReplyConfirmLocalizedAsync("link_filter_server_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.link_filter_server_on).ConfigureAwait(false);
}
else
{
_service.LinkFilteringServers.TryRemove(channel.Guild.Id);
await ReplyConfirmLocalizedAsync("link_filter_server_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.link_filter_server_off).ConfigureAwait(false);
}
}
@@ -156,12 +156,12 @@ namespace NadekoBot.Modules.Permissions
if (removed is null)
{
_service.LinkFilteringChannels.Add(channel.Id);
await ReplyConfirmLocalizedAsync("link_filter_channel_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.link_filter_channel_on).ConfigureAwait(false);
}
else
{
_service.LinkFilteringChannels.TryRemove(channel.Id);
await ReplyConfirmLocalizedAsync("link_filter_channel_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.link_filter_channel_off).ConfigureAwait(false);
}
}
@@ -182,12 +182,12 @@ namespace NadekoBot.Modules.Permissions
if (enabled)
{
_service.WordFilteringServers.Add(channel.Guild.Id);
await ReplyConfirmLocalizedAsync("word_filter_server_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.word_filter_server_on).ConfigureAwait(false);
}
else
{
_service.WordFilteringServers.TryRemove(channel.Guild.Id);
await ReplyConfirmLocalizedAsync("word_filter_server_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.word_filter_server_off).ConfigureAwait(false);
}
}
@@ -221,12 +221,12 @@ namespace NadekoBot.Modules.Permissions
if (removed is null)
{
_service.WordFilteringChannels.Add(channel.Id);
await ReplyConfirmLocalizedAsync("word_filter_channel_on").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.word_filter_channel_on).ConfigureAwait(false);
}
else
{
_service.WordFilteringChannels.TryRemove(channel.Id);
await ReplyConfirmLocalizedAsync("word_filter_channel_off").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.word_filter_channel_off).ConfigureAwait(false);
}
}
@@ -263,12 +263,12 @@ namespace NadekoBot.Modules.Permissions
if (removed is null)
{
filteredWords.Add(word);
await ReplyConfirmLocalizedAsync("filter_word_add", Format.Code(word)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.filter_word_add(Format.Code(word))).ConfigureAwait(false);
}
else
{
filteredWords.TryRemove(word);
await ReplyConfirmLocalizedAsync("filter_word_remove", Format.Code(word)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.filter_word_remove(Format.Code(word))).ConfigureAwait(false);
}
}

View File

@@ -32,7 +32,7 @@ namespace NadekoBot.Modules.Permissions
var blockedCommands = _service.BlockedCommands;
if (!blockedModule.Any() && !blockedCommands.Any())
{
await ReplyErrorLocalizedAsync("lgp_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.lgp_none).ConfigureAwait(false);
return;
}
@@ -61,11 +61,11 @@ namespace NadekoBot.Modules.Permissions
if (added)
{
await ReplyConfirmLocalizedAsync("gmod_add", Format.Bold(module.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.gmod_add(Format.Bold(module.Name))).ConfigureAwait(false);
return;
}
await ReplyConfirmLocalizedAsync("gmod_remove", Format.Bold(module.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.gmod_remove(Format.Bold(module.Name))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -77,11 +77,11 @@ namespace NadekoBot.Modules.Permissions
if (added)
{
await ReplyConfirmLocalizedAsync("gcmd_add", Format.Bold(cmd.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.gcmd_add(Format.Bold(cmd.Name))).ConfigureAwait(false);
return;
}
await ReplyConfirmLocalizedAsync("gcmd_remove", Format.Bold(cmd.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.gcmd_remove(Format.Bold(cmd.Name))).ConfigureAwait(false);
}
}
}

View File

@@ -40,11 +40,11 @@ namespace NadekoBot.Modules.Permissions
}
if (action.Value)
{
await ReplyConfirmLocalizedAsync("verbose_true").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.verbose_true).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("verbose_false").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.verbose_false).ConfigureAwait(false);
}
}
@@ -63,11 +63,11 @@ namespace NadekoBot.Modules.Permissions
if (!ulong.TryParse(cache.PermRole, out var roleId) ||
(role = ((SocketGuild)ctx.Guild).GetRole(roleId)) is null)
{
await ReplyConfirmLocalizedAsync("permrole_not_set", Format.Bold(cache.PermRole)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.permrole_not_set).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("permrole", Format.Bold(role.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.permrole(Format.Bold(role.ToString()))).ConfigureAwait(false);
}
return;
}
@@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Permissions
_service.UpdateCache(config);
}
await ReplyConfirmLocalizedAsync("permrole_changed", Format.Bold(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.permrole_changed(Format.Bold(role.Name))).ConfigureAwait(false);
}
public enum Reset { Reset };
@@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Permissions
_service.UpdateCache(config);
}
await ReplyConfirmLocalizedAsync("permrole_reset").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.permrole_reset).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -157,13 +157,14 @@ namespace NadekoBot.Modules.Permissions
await uow.SaveChangesAsync();
_service.UpdateCache(config);
}
await ReplyConfirmLocalizedAsync("removed",
await ReplyConfirmLocalizedAsync(strs.removed(
index + 1,
Format.Code(p.GetCommand(Prefix, (SocketGuild)ctx.Guild))).ConfigureAwait(false);
Format.Code(p.GetCommand(Prefix, (SocketGuild)ctx.Guild))));
}
catch (IndexOutOfRangeException)
{
await ReplyErrorLocalizedAsync("perm_out_of_range").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.perm_out_of_range).ConfigureAwait(false);
}
}
@@ -188,13 +189,13 @@ namespace NadekoBot.Modules.Permissions
if (!fromFound)
{
await ReplyErrorLocalizedAsync("not_found", ++from);
await ReplyErrorLocalizedAsync(strs.perm_not_found(++from));
return;
}
if (!toFound)
{
await ReplyErrorLocalizedAsync("not_found", ++to);
await ReplyErrorLocalizedAsync(strs.perm_not_found(++to));
return;
}
fromPerm = permsCol[from];
@@ -204,18 +205,19 @@ namespace NadekoBot.Modules.Permissions
await uow.SaveChangesAsync();
_service.UpdateCache(config);
}
await ReplyConfirmLocalizedAsync("moved_permission",
Format.Code(fromPerm.GetCommand(Prefix, (SocketGuild)ctx.Guild)),
++from,
++to)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.moved_permission(
Format.Code(fromPerm.GetCommand(Prefix, (SocketGuild)ctx.Guild)),
++from,
++to));
return;
}
catch (Exception e) when (e is ArgumentOutOfRangeException || e is IndexOutOfRangeException)
{
}
}
await ReplyErrorLocalizedAsync("perm_out_of_range").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.perm_out_of_range).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -234,15 +236,15 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("sx_enable",
await ReplyConfirmLocalizedAsync(strs.sx_enable(
Format.Code(command.Name),
GetText(strs.of_command)).ConfigureAwait(false);
GetText(strs.of_command)));
}
else
{
await ReplyConfirmLocalizedAsync("sx_disable",
await ReplyConfirmLocalizedAsync(strs.sx_disable(
Format.Code(command.Name),
GetText(strs.of_command)).ConfigureAwait(false);
GetText(strs.of_command)));
}
}
@@ -261,15 +263,15 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("sx_enable",
await ReplyConfirmLocalizedAsync(strs.sx_enable(
Format.Code(module.Name),
GetText(strs.of_module)).ConfigureAwait(false);
GetText(strs.of_module)));
}
else
{
await ReplyConfirmLocalizedAsync("sx_disable",
await ReplyConfirmLocalizedAsync(strs.sx_disable(
Format.Code(module.Name),
GetText(strs.of_module)).ConfigureAwait(false);
GetText(strs.of_module)));
}
}
@@ -289,17 +291,17 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("ux_enable",
await ReplyConfirmLocalizedAsync(strs.ux_enable(
Format.Code(command.Name),
GetText(strs.of_command),
Format.Code(user.ToString())).ConfigureAwait(false);
Format.Code(user.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync("ux_disable",
await ReplyConfirmLocalizedAsync(strs.ux_disable(
Format.Code(command.Name),
GetText(strs.of_command),
Format.Code(user.ToString())).ConfigureAwait(false);
Format.Code(user.ToString())));
}
}
@@ -318,17 +320,17 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("ux_enable",
await ReplyConfirmLocalizedAsync(strs.ux_enable(
Format.Code(module.Name),
GetText(strs.of_module),
Format.Code(user.ToString())).ConfigureAwait(false);
Format.Code(user.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync("ux_disable",
await ReplyConfirmLocalizedAsync(strs.ux_disable(
Format.Code(module.Name),
GetText(strs.of_module),
Format.Code(user.ToString())).ConfigureAwait(false);
Format.Code(user.ToString())));
}
}
@@ -351,17 +353,17 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("rx_enable",
await ReplyConfirmLocalizedAsync(strs.rx_enable(
Format.Code(command.Name),
GetText(strs.of_command),
Format.Code(role.Name)).ConfigureAwait(false);
Format.Code(role.Name)));
}
else
{
await ReplyConfirmLocalizedAsync("rx_disable",
await ReplyConfirmLocalizedAsync(strs.rx_disable(
Format.Code(command.Name),
GetText(strs.of_command),
Format.Code(role.Name)).ConfigureAwait(false);
Format.Code(role.Name)));
}
}
@@ -384,17 +386,17 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("rx_enable",
await ReplyConfirmLocalizedAsync(strs.rx_enable(
Format.Code(module.Name),
GetText(strs.of_module),
Format.Code(role.Name)).ConfigureAwait(false);
Format.Code(role.Name)));
}
else
{
await ReplyConfirmLocalizedAsync("rx_disable",
await ReplyConfirmLocalizedAsync(strs.rx_disable(
Format.Code(module.Name),
GetText(strs.of_module),
Format.Code(role.Name)).ConfigureAwait(false);
Format.Code(role.Name)));
}
}
@@ -414,17 +416,17 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("cx_enable",
await ReplyConfirmLocalizedAsync(strs.cx_enable(
Format.Code(command.Name),
GetText(strs.of_command),
Format.Code(chnl.Name)).ConfigureAwait(false);
Format.Code(chnl.Name)));
}
else
{
await ReplyConfirmLocalizedAsync("cx_disable",
await ReplyConfirmLocalizedAsync(strs.cx_disable(
Format.Code(command.Name),
GetText(strs.of_command),
Format.Code(chnl.Name)).ConfigureAwait(false);
Format.Code(chnl.Name)));
}
}
@@ -443,17 +445,17 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("cx_enable",
await ReplyConfirmLocalizedAsync(strs.cx_enable(
Format.Code(module.Name),
GetText(strs.of_module),
Format.Code(chnl.Name)).ConfigureAwait(false);
Format.Code(chnl.Name)));
}
else
{
await ReplyConfirmLocalizedAsync("cx_disable",
await ReplyConfirmLocalizedAsync(strs.cx_disable(
Format.Code(module.Name),
GetText(strs.of_module),
Format.Code(chnl.Name)).ConfigureAwait(false);
Format.Code(chnl.Name)));
}
}
@@ -472,13 +474,13 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("acm_enable",
Format.Code(chnl.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.acm_enable(
Format.Code(chnl.Name)));
}
else
{
await ReplyConfirmLocalizedAsync("acm_disable",
Format.Code(chnl.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.acm_disable(
Format.Code(chnl.Name)));
}
}
@@ -500,13 +502,13 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("arm_enable",
Format.Code(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.arm_enable(
Format.Code(role.Name)));
}
else
{
await ReplyConfirmLocalizedAsync("arm_disable",
Format.Code(role.Name)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.arm_disable(
Format.Code(role.Name)));
}
}
@@ -525,13 +527,13 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("aum_enable",
Format.Code(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.aum_enable(
Format.Code(user.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync("aum_disable",
Format.Code(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.aum_disable(
Format.Code(user.ToString())));
}
}
@@ -563,11 +565,11 @@ namespace NadekoBot.Modules.Permissions
if (action.Value)
{
await ReplyConfirmLocalizedAsync("asm_enable").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.asm_enable).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("asm_disable").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.asm_disable).ConfigureAwait(false);
}
}
}

View File

@@ -26,7 +26,7 @@ namespace NadekoBot.Modules.Permissions
public async Task ResetPerms()
{
await _perms.Reset(ctx.Guild.Id).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("perms_reset").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.perms_reset).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -34,7 +34,7 @@ namespace NadekoBot.Modules.Permissions
public async Task ResetGlobalPerms()
{
await _gps.Reset();
await ReplyConfirmLocalizedAsync("global_perms_reset").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.global_perms_reset).ConfigureAwait(false);
}
}
}

View File

@@ -26,7 +26,7 @@ namespace NadekoBot.Modules.Searches
if (novelData is null)
{
await ReplyErrorLocalizedAsync("failed_finding_novel").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.failed_finding_novel).ConfigureAwait(false);
return;
}
@@ -39,7 +39,8 @@ namespace NadekoBot.Modules.Searches
.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));
.WithFooter($"{GetText(strs.score)} {novelData.Score}");
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
@@ -146,7 +147,7 @@ namespace NadekoBot.Modules.Searches
if (animeData is null)
{
await ReplyErrorLocalizedAsync("failed_finding_anime").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.failed_finding_anime).ConfigureAwait(false);
return;
}
@@ -159,7 +160,7 @@ namespace NadekoBot.Modules.Searches
.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"));
.WithFooter($"{GetText(strs.score)} {animeData.AverageScore} / 100");
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
@@ -174,7 +175,7 @@ namespace NadekoBot.Modules.Searches
if (mangaData is null)
{
await ReplyErrorLocalizedAsync("failed_finding_manga").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.failed_finding_manga).ConfigureAwait(false);
return;
}
@@ -187,7 +188,7 @@ namespace NadekoBot.Modules.Searches
.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"));
.WithFooter($"{GetText(strs.score)} {mangaData.AverageScore} / 100");
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}

View File

@@ -34,7 +34,7 @@ namespace NadekoBot.Modules.Searches
if (crypto is null)
{
await ReplyErrorLocalizedAsync("crypto_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.crypto_not_found).ConfigureAwait(false);
return;
}

View File

@@ -41,12 +41,12 @@ namespace NadekoBot.Modules.Searches
success = _service.AddFeed(ctx.Guild.Id, channel.Id, url);
if (success)
{
await ReplyConfirmLocalizedAsync("feed_added").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.feed_added).ConfigureAwait(false);
return;
}
}
await ReplyErrorLocalizedAsync("feed_not_valid").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.feed_not_valid).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -56,10 +56,10 @@ namespace NadekoBot.Modules.Searches
{
if (_service.RemoveFeed(ctx.Guild.Id, --index))
{
await ReplyConfirmLocalizedAsync("feed_removed").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.feed_removed).ConfigureAwait(false);
}
else
await ReplyErrorLocalizedAsync("feed_out_of_range").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.feed_out_of_range).ConfigureAwait(false);
}
[NadekoCommand, Aliases]

View File

@@ -38,7 +38,7 @@ namespace NadekoBot.Modules.Searches
{
if (!_service.WowJokes.Any())
{
await ReplyErrorLocalizedAsync("jokes_not_loaded").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.jokes_not_loaded).ConfigureAwait(false);
return;
}
var joke = _service.WowJokes[new NadekoRandom().Next(0, _service.WowJokes.Count)];
@@ -50,7 +50,7 @@ namespace NadekoBot.Modules.Searches
{
if (!_service.WowJokes.Any())
{
await ReplyErrorLocalizedAsync("magicitems_not_loaded").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.magicitems_not_loaded).ConfigureAwait(false);
return;
}
var item = _service.MagicItems[new NadekoRandom().Next(0, _service.MagicItems.Count)];

View File

@@ -45,7 +45,7 @@ namespace NadekoBot.Modules.Searches
{
if (string.IsNullOrWhiteSpace(_creds.OsuApiKey))
{
await ReplyErrorLocalizedAsync("osu_api_key").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.osu_api_key).ConfigureAwait(false);
return;
}
@@ -57,7 +57,7 @@ namespace NadekoBot.Modules.Searches
if (objs.Count == 0)
{
await ReplyErrorLocalizedAsync("osu_user_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.osu_user_not_found).ConfigureAwait(false);
return;
}
@@ -79,11 +79,11 @@ namespace NadekoBot.Modules.Searches
}
catch (ArgumentOutOfRangeException)
{
await ReplyErrorLocalizedAsync("osu_user_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.osu_user_not_found).ConfigureAwait(false);
}
catch (Exception ex)
{
await ReplyErrorLocalizedAsync("osu_failed").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.osu_failed).ConfigureAwait(false);
Log.Warning(ex, "Osu command failed");
}
}
@@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Searches
var statsResponse = JsonConvert.DeserializeObject<GatariUserStatsResponse>(resString);
if (statsResponse.Code != 200 || statsResponse.Stats.Id == 0)
{
await ReplyErrorLocalizedAsync("osu_user_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.osu_user_not_found).ConfigureAwait(false);
return;
}

View File

@@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Searches
return;
}
}
await ReplyErrorLocalizedAsync("pokemon_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.pokemon_none).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -71,7 +71,7 @@ namespace NadekoBot.Modules.Searches
return;
}
}
await ReplyErrorLocalizedAsync("pokemon_ability_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.pokemon_ability_none).ConfigureAwait(false);
}
}
}

View File

@@ -115,20 +115,20 @@ namespace NadekoBot.Modules.Searches
var (data, err) = await _service.GetTimeDataAsync(query).ConfigureAwait(false);
if (err is not null)
{
string errorKey;
LocStr errorKey;
switch (err)
{
case TimeErrors.ApiKeyMissing:
errorKey = "api_key_missing";
errorKey = strs.api_key_missing;
break;
case TimeErrors.InvalidInput:
errorKey = "invalid_input";
errorKey = strs.invalid_input;
break;
case TimeErrors.NotFound:
errorKey = "not_found";
errorKey = strs.not_found;
break;
default:
errorKey = "error_occured";
errorKey = strs.error_occured;
break;
}
await ReplyErrorLocalizedAsync(errorKey).ConfigureAwait(false);
@@ -136,7 +136,7 @@ namespace NadekoBot.Modules.Searches
}
else if (string.IsNullOrWhiteSpace(data.TimeZoneName))
{
await ReplyErrorLocalizedAsync("timezone_db_api_key").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.timezone_db_api_key).ConfigureAwait(false);
return;
}
@@ -159,7 +159,7 @@ namespace NadekoBot.Modules.Searches
var result = (await _google.GetVideoLinksByKeywordAsync(query, 1).ConfigureAwait(false)).FirstOrDefault();
if (string.IsNullOrWhiteSpace(result))
{
await ReplyErrorLocalizedAsync("no_results").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_results).ConfigureAwait(false);
return;
}
@@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Searches
var movie = await _service.GetMovieDataAsync(query).ConfigureAwait(false);
if (movie is null)
{
await ReplyErrorLocalizedAsync("imdb_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.imdb_fail).ConfigureAwait(false);
return;
}
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
@@ -340,7 +340,7 @@ namespace NadekoBot.Modules.Searches
var data = await _service.GoogleSearchAsync(query);
if (data is null)
{
await ReplyErrorLocalizedAsync("no_results");
await ReplyErrorLocalizedAsync(strs.no_results);
return;
}
@@ -373,7 +373,7 @@ namespace NadekoBot.Modules.Searches
var data = await _service.DuckDuckGoSearchAsync(query);
if (data is null)
{
await ReplyErrorLocalizedAsync("no_results");
await ReplyErrorLocalizedAsync(strs.no_results);
return;
}
@@ -403,7 +403,7 @@ namespace NadekoBot.Modules.Searches
if (card is null)
{
await ReplyErrorLocalizedAsync("card_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.card_not_found).ConfigureAwait(false);
return;
}
@@ -427,7 +427,7 @@ namespace NadekoBot.Modules.Searches
if (string.IsNullOrWhiteSpace(_creds.RapidApiKey))
{
await ReplyErrorLocalizedAsync("mashape_api_missing").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.mashape_api_missing).ConfigureAwait(false);
return;
}
@@ -436,7 +436,7 @@ namespace NadekoBot.Modules.Searches
if (card is null)
{
await ReplyErrorLocalizedAsync("card_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.card_not_found).ConfigureAwait(false);
return;
}
var embed = _eb.Create().WithOkColor()
@@ -479,7 +479,7 @@ namespace NadekoBot.Modules.Searches
{
}
}
await ReplyErrorLocalizedAsync("ud_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.ud_error).ConfigureAwait(false);
}
@@ -509,7 +509,7 @@ namespace NadekoBot.Modules.Searches
if (!datas.Any())
{
Log.Warning("Definition not found: {Word}", word);
await ReplyErrorLocalizedAsync("define_unknown").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.define_unknown).ConfigureAwait(false);
}
@@ -606,7 +606,7 @@ namespace NadekoBot.Modules.Searches
var result = await http.GetStringAsync("https://en.wikipedia.org//w/api.php?action=query&format=json&prop=info&redirects=1&formatversion=2&inprop=url&titles=" + Uri.EscapeDataString(query)).ConfigureAwait(false);
var data = JsonConvert.DeserializeObject<WikipediaApiModel>(result);
if (data.Query.Pages[0].Missing || string.IsNullOrWhiteSpace(data.Query.Pages[0].FullUrl))
await ReplyErrorLocalizedAsync("wiki_page_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.wiki_page_not_found).ConfigureAwait(false);
else
await ctx.Channel.SendMessageAsync(data.Query.Pages[0].FullUrl).ConfigureAwait(false);
}
@@ -651,7 +651,7 @@ namespace NadekoBot.Modules.Searches
if (avatarUrl is null)
{
await ReplyErrorLocalizedAsync("avatar_none", usr.ToString()).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.avatar_none(usr.ToString())).ConfigureAwait(false);
return;
}
@@ -666,7 +666,7 @@ namespace NadekoBot.Modules.Searches
{
if (string.IsNullOrWhiteSpace(target) || string.IsNullOrWhiteSpace(query))
{
await ReplyErrorLocalizedAsync("wikia_input_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.wikia_input_error).ConfigureAwait(false);
return;
}
await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
@@ -686,7 +686,7 @@ namespace NadekoBot.Modules.Searches
if (string.IsNullOrWhiteSpace(title))
{
await ReplyErrorLocalizedAsync("wikia_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.wikia_error).ConfigureAwait(false);
return;
}
@@ -697,7 +697,7 @@ namespace NadekoBot.Modules.Searches
}
catch
{
await ReplyErrorLocalizedAsync("wikia_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.wikia_error).ConfigureAwait(false);
}
}
}
@@ -743,7 +743,7 @@ namespace NadekoBot.Modules.Searches
var appId = await _service.GetSteamAppIdByName(query).ConfigureAwait(false);
if (appId == -1)
{
await ReplyErrorLocalizedAsync("not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.not_found).ConfigureAwait(false);
return;
}
@@ -782,7 +782,7 @@ namespace NadekoBot.Modules.Searches
return true;
}
await ErrorLocalizedAsync("specify_search_params").ConfigureAwait(false);
await ErrorLocalizedAsync(strs.specify_search_params).ConfigureAwait(false);
return false;
}
}

View File

@@ -39,7 +39,7 @@ namespace NadekoBot.Modules.Searches
var data = await _service.FollowStream(ctx.Guild.Id, ctx.Channel.Id, link);
if (data is null)
{
await ReplyErrorLocalizedAsync("stream_not_added").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.stream_not_added).ConfigureAwait(false);
return;
}
@@ -59,14 +59,14 @@ namespace NadekoBot.Modules.Searches
var fs = await _service.UnfollowStreamAsync(ctx.Guild.Id, index);
if (fs is null)
{
await ReplyErrorLocalizedAsync("stream_no").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.stream_no).ConfigureAwait(false);
return;
}
await ReplyConfirmLocalizedAsync(
"stream_removed",
Format.Bold(fs.Username),
fs.Type).ConfigureAwait(false);
strs.stream_removed(
Format.Bold(fs.Username),
fs.Type));
}
// [NadekoCommand, Usage, Description, Aliases]
@@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Searches
// public async Task StreamsClear()
// {
// var count = _service.ClearAllStreams(ctx.Guild.Id);
// await ReplyConfirmLocalizedAsync("streams_cleared", count).ConfigureAwait(false);
// await ReplyErrorLocalizedAsync(strs.streams_cleared(count)));
// }
[NadekoCommand, Aliases]
@@ -146,11 +146,11 @@ namespace NadekoBot.Modules.Searches
var newValue = _service.ToggleStreamOffline(ctx.Guild.Id);
if (newValue)
{
await ReplyConfirmLocalizedAsync("stream_off_enabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_off_enabled).ConfigureAwait(false);
}
else
{
await ReplyConfirmLocalizedAsync("stream_off_disabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_off_disabled).ConfigureAwait(false);
}
}
@@ -164,19 +164,17 @@ namespace NadekoBot.Modules.Searches
if (!_service.SetStreamMessage(ctx.Guild.Id, index, message, out var fs))
{
await ReplyConfirmLocalizedAsync("stream_not_following").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_not_following).ConfigureAwait(false);
return;
}
if (string.IsNullOrWhiteSpace(message))
{
await ReplyConfirmLocalizedAsync("stream_message_reset", Format.Bold(fs.Username))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_message_reset(Format.Bold(fs.Username)));
}
else
{
await ReplyConfirmLocalizedAsync("stream_message_set", Format.Bold(fs.Username))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_message_set(Format.Bold(fs.Username)));
}
}
@@ -189,11 +187,11 @@ namespace NadekoBot.Modules.Searches
if (count == 0)
{
await ReplyConfirmLocalizedAsync("stream_not_following_any");
await ReplyConfirmLocalizedAsync(strs.stream_not_following_any);
return;
}
await ReplyConfirmLocalizedAsync("stream_message_set_all", count);
await ReplyErrorLocalizedAsync(strs.stream_message_set_all(count));
}
[NadekoCommand, Aliases]
@@ -205,26 +203,24 @@ namespace NadekoBot.Modules.Searches
var data = await _service.GetStreamDataAsync(url).ConfigureAwait(false);
if (data is null)
{
await ReplyErrorLocalizedAsync("no_channel_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_channel_found).ConfigureAwait(false);
return;
}
if (data.IsLive)
{
await ReplyConfirmLocalizedAsync("streamer_online",
Format.Bold(data.Name),
Format.Bold(data.Viewers.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.streamer_online(
Format.Bold(data.Name),
Format.Bold(data.Viewers.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync("streamer_offline", data.Name)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.streamer_offline(data.Name));
}
}
catch
{
await ReplyErrorLocalizedAsync("no_channel_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_channel_found).ConfigureAwait(false);
}
}
}

View File

@@ -34,7 +34,7 @@ namespace NadekoBot.Modules.Searches
}
catch
{
await ReplyErrorLocalizedAsync("bad_input_format").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.bad_input_format).ConfigureAwait(false);
}
}
@@ -76,18 +76,18 @@ namespace NadekoBot.Modules.Searches
if (autoDelete == AutoDeleteAutoTranslate.Del)
{
_searches.TranslatedChannels.AddOrUpdate(channel.Id, true, (key, val) => true);
await ReplyConfirmLocalizedAsync("atl_ad_started").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.atl_ad_started).ConfigureAwait(false);
return;
}
if (_searches.TranslatedChannels.TryRemove(channel.Id, out _))
{
await ReplyConfirmLocalizedAsync("atl_stopped").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.atl_stopped).ConfigureAwait(false);
return;
}
if (_searches.TranslatedChannels.TryAdd(channel.Id, autoDelete == AutoDeleteAutoTranslate.Del))
{
await ReplyConfirmLocalizedAsync("atl_started").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.atl_started).ConfigureAwait(false);
}
}
@@ -100,7 +100,7 @@ namespace NadekoBot.Modules.Searches
if (string.IsNullOrWhiteSpace(langs))
{
if (_searches.UserLanguages.TryRemove(ucp, out langs))
await ReplyConfirmLocalizedAsync("atl_removed").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.atl_removed).ConfigureAwait(false);
return;
}
@@ -112,13 +112,13 @@ namespace NadekoBot.Modules.Searches
if (!_google.Languages.Contains(from) || !_google.Languages.Contains(to))
{
await ReplyErrorLocalizedAsync("invalid_lang").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.invalid_lang).ConfigureAwait(false);
return;
}
_searches.UserLanguages.AddOrUpdate(ucp, langs, (key, val) => langs);
await ReplyConfirmLocalizedAsync("atl_set", from, to).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.atl_set(from, to));
}
[NadekoCommand, Aliases]

View File

@@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Searches
}
catch (HttpRequestException)
{
await ReplyErrorLocalizedAsync("comic_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.comic_not_found).ConfigureAwait(false);
}
return;
}
@@ -86,7 +86,7 @@ namespace NadekoBot.Modules.Searches
}
catch (HttpRequestException)
{
await ReplyErrorLocalizedAsync("comic_not_found").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.comic_not_found).ConfigureAwait(false);
}
}
}

View File

@@ -16,11 +16,11 @@ namespace NadekoBot.Modules.Searches
// var succ = await _service.ToggleChannelFollowAsync(ctx.Guild.Id, ctx.Channel.Id, ytChannelId, uploadMessage);
// if(succ)
// {
// await ReplyConfirmLocalizedAsync("yt_follow_added").ConfigureAwait(false);
// await ReplyConfirmLocalizedAsync(strs.yt_follow_added).ConfigureAwait(false);
// }
// else
// {
// await ReplyConfirmLocalizedAsync("yt_follow_fail").ConfigureAwait(false);
// await ReplyConfirmLocalizedAsync(strs.yt_follow_fail).ConfigureAwait(false);
// }
// }
//
@@ -31,11 +31,11 @@ namespace NadekoBot.Modules.Searches
// //var succ = await _service.ToggleChannelTrackingAsync(ctx.Guild.Id, ctx.Channel.Id, ytChannelId, uploadMessage);
// //if (succ)
// //{
// // await ReplyConfirmLocalizedAsync("yt_track_added").ConfigureAwait(false);
// // await ReplyConfirmLocalizedAsync(strs.yt_track_added).ConfigureAwait(false);
// //}
// //else
// //{
// // await ReplyConfirmLocalizedAsync("yt_track_fail").ConfigureAwait(false);
// // await ReplyConfirmLocalizedAsync(strs.yt_track_fail).ConfigureAwait(false);
// //}
// }
//
@@ -46,11 +46,11 @@ namespace NadekoBot.Modules.Searches
// //var succ = await _service.ToggleChannelTrackingAsync(ctx.Guild.Id, ctx.Channel.Id, ytChannelId, uploadMessage);
// //if (succ)
// //{
// // await ReplyConfirmLocalizedAsync("yt_track_added").ConfigureAwait(false);
// // await ReplyConfirmLocalizedAsync(strs.yt_track_added).ConfigureAwait(false);
// //}
// //else
// //{
// // await ReplyConfirmLocalizedAsync("yt_track_fail").ConfigureAwait(false);
// // await ReplyConfirmLocalizedAsync(strs.yt_track_fail).ConfigureAwait(false);
// //}
// }
// }

View File

@@ -37,7 +37,7 @@ namespace NadekoBot.Modules.Utility
public async Task AliasesClear()
{
var count = _service.ClearAliases(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync("aliases_cleared", count).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.aliases_cleared(count));
}
[NadekoCommand, Aliases]
@@ -57,7 +57,7 @@ namespace NadekoBot.Modules.Utility
if (!_service.AliasMaps.TryGetValue(ctx.Guild.Id, out var maps) ||
!maps.TryRemove(trigger, out _))
{
await ReplyErrorLocalizedAsync("alias_remove_fail", Format.Code(trigger)).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.alias_remove_fail(Format.Code(trigger))).ConfigureAwait(false);
return;
}
@@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Utility
uow.SaveChanges();
}
await ReplyConfirmLocalizedAsync("alias_removed", Format.Code(trigger)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.alias_removed(Format.Code(trigger))).ConfigureAwait(false);
return;
}
_service.AliasMaps.AddOrUpdate(ctx.Guild.Id, (_) =>
@@ -113,7 +113,7 @@ namespace NadekoBot.Modules.Utility
return map;
});
await ReplyConfirmLocalizedAsync("alias_added", Format.Code(trigger), Format.Code(mapping)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.alias_added(Format.Code(trigger), Format.Code(mapping))).ConfigureAwait(false);
}
@@ -129,7 +129,7 @@ namespace NadekoBot.Modules.Utility
if (!_service.AliasMaps.TryGetValue(ctx.Guild.Id, out var maps) || !maps.Any())
{
await ReplyErrorLocalizedAsync("aliases_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.aliases_none).ConfigureAwait(false);
return;
}

View File

@@ -162,7 +162,7 @@ namespace NadekoBot.Modules.Utility
if (!success)
{
await ReplyErrorLocalizedAsync("config_edit_fail", Format.Code(prop), Format.Code(value));
await ReplyErrorLocalizedAsync(strs.config_edit_fail(Format.Code(prop), Format.Code(value)));
return;
}

View File

@@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Utility
if (DateTime.UtcNow.Day < 5)
{
await ReplyErrorLocalizedAsync("clpa_too_early").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.clpa_too_early).ConfigureAwait(false);
return;
}

View File

@@ -52,7 +52,7 @@ namespace NadekoBot.Modules.Utility
string.Join("\n", quotes.Select(q => $"`#{q.Id}` {Format.Bold(q.Keyword.SanitizeAllMentions()),-20} by {q.AuthorName.SanitizeAllMentions()}")))
.ConfigureAwait(false);
else
await ReplyErrorLocalizedAsync("quotes_page_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.quotes_page_none).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -96,13 +96,13 @@ namespace NadekoBot.Modules.Utility
using (var uow = _db.GetDbContext())
{
quote = uow.Quotes.GetById(id);
if (quote.GuildId != ctx.Guild.Id)
if (quote?.GuildId != ctx.Guild.Id)
quote = null;
}
if (quote is null)
{
await ReplyErrorLocalizedAsync("quote_no_found_id");
await ReplyErrorLocalizedAsync(strs.quotes_notfound);
return;
}
@@ -198,7 +198,7 @@ namespace NadekoBot.Modules.Utility
});
await uow.SaveChangesAsync();
}
await ReplyConfirmLocalizedAsync("quote_added_new", Format.Code(q.Id.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.quote_added_new(Format.Code(q.Id.ToString()))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -248,7 +248,7 @@ namespace NadekoBot.Modules.Utility
await uow.SaveChangesAsync();
}
await ReplyConfirmLocalizedAsync("quotes_deleted", Format.Bold(keyword.SanitizeAllMentions())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.quotes_deleted(Format.Bold(keyword.SanitizeAllMentions()))).ConfigureAwait(false);
}
}
}

View File

@@ -40,7 +40,7 @@ namespace NadekoBot.Modules.Utility
{
if (!_service.TryParseRemindMessage(remindString, out var remindData))
{
await ReplyErrorLocalizedAsync("remind_invalid");
await ReplyErrorLocalizedAsync(strs.remind_invalid);
return;
}
@@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Utility
if (!await RemindInternal(target, meorhere == MeOrHere.Me || ctx.Guild is null, remindData.Time, remindData.What)
.ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("remind_too_long").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.remind_too_long).ConfigureAwait(false);
}
}
@@ -62,13 +62,13 @@ namespace NadekoBot.Modules.Utility
var perms = ((IGuildUser) ctx.User).GetPermissions(channel);
if (!perms.SendMessages || !perms.ViewChannel)
{
await ReplyErrorLocalizedAsync("cant_read_or_send").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.cant_read_or_send).ConfigureAwait(false);
return;
}
if (!_service.TryParseRemindMessage(remindString, out var remindData))
{
await ReplyErrorLocalizedAsync("remind_invalid");
await ReplyErrorLocalizedAsync(strs.remind_invalid);
return;
}
@@ -76,7 +76,7 @@ namespace NadekoBot.Modules.Utility
if (!await RemindInternal(channel.Id, false, remindData.Time, remindData.What)
.ConfigureAwait(false))
{
await ReplyErrorLocalizedAsync("remind_too_long").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.remind_too_long).ConfigureAwait(false);
}
}
@@ -144,11 +144,11 @@ namespace NadekoBot.Modules.Utility
if (rem is null)
{
await ReplyErrorLocalizedAsync("reminder_not_exist").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.reminder_not_exist).ConfigureAwait(false);
}
else
{
await ReplyErrorLocalizedAsync("reminder_deleted", index + 1).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.reminder_deleted(index + 1));
}
}

View File

@@ -28,7 +28,7 @@ namespace NadekoBot.Modules.Utility
var success = await _service.TriggerExternal(ctx.Guild.Id, index);
if (!success)
{
await ReplyErrorLocalizedAsync("repeat_invoke_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.repeat_invoke_none).ConfigureAwait(false);
}
}
@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Utility
var removed = await _service.RemoveByIndexAsync(ctx.Guild.Id, index);
if (removed is null)
{
await ReplyErrorLocalizedAsync("repeater_remove_fail").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.repeater_remove_fail).ConfigureAwait(false);
return;
}
@@ -66,17 +66,17 @@ namespace NadekoBot.Modules.Utility
if (result is null)
{
await ReplyErrorLocalizedAsync("index_out_of_range").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.index_out_of_range).ConfigureAwait(false);
return;
}
if (result.Value)
{
await ReplyConfirmLocalizedAsync("repeater_redundant_no", index + 1);
await ReplyErrorLocalizedAsync(strs.repeater_redundant_no(index + 1));
}
else
{
await ReplyConfirmLocalizedAsync("repeater_redundant_yes" ,index + 1);
await ReplyConfirmLocalizedAsync(strs.repeater_redundant_yes(index + 1));
}
}
@@ -139,7 +139,7 @@ namespace NadekoBot.Modules.Utility
if (runner is null)
{
await ReplyErrorLocalizedAsync("repeater_exceed_limit", 5);
await ReplyErrorLocalizedAsync(strs.repeater_exceed_limit(5));
return;
}
@@ -158,7 +158,7 @@ namespace NadekoBot.Modules.Utility
var repeaters = _service.GetRepeaters(ctx.Guild.Id);
if (repeaters.Count == 0)
{
await ReplyConfirmLocalizedAsync("repeaters_none").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.repeaters_none).ConfigureAwait(false);
return;
}

View File

@@ -20,7 +20,7 @@ namespace NadekoBot.Modules.Utility
{
await this._service.SetStreamRole(fromRole, addRole).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("stream_role_enabled", Format.Bold(fromRole.ToString()), Format.Bold(addRole.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_enabled(Format.Bold(fromRole.ToString()), Format.Bold(addRole.ToString()))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Utility
public async Task StreamRole()
{
await this._service.StopStreamRole(ctx.Guild).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("stream_role_disabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_disabled).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -42,9 +42,9 @@ namespace NadekoBot.Modules.Utility
string kw = await this._service.SetKeyword(ctx.Guild, keyword).ConfigureAwait(false);
if(string.IsNullOrWhiteSpace(keyword))
await ReplyConfirmLocalizedAsync("stream_role_kw_reset").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_kw_reset).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("stream_role_kw_set", Format.Bold(kw)).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_kw_set(Format.Bold(kw))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -58,14 +58,14 @@ namespace NadekoBot.Modules.Utility
if(action == AddRemove.Add)
if(success)
await ReplyConfirmLocalizedAsync("stream_role_bl_add", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_bl_add(Format.Bold(user.ToString()))).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("stream_role_bl_add_fail", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_bl_add_fail(Format.Bold(user.ToString()))).ConfigureAwait(false);
else
if (success)
await ReplyConfirmLocalizedAsync("stream_role_bl_rem", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_bl_rem(Format.Bold(user.ToString()))).ConfigureAwait(false);
else
await ReplyErrorLocalizedAsync("stream_role_bl_rem_fail", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.stream_role_bl_rem_fail(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -79,14 +79,14 @@ namespace NadekoBot.Modules.Utility
if (action == AddRemove.Add)
if(success)
await ReplyConfirmLocalizedAsync("stream_role_wl_add", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_wl_add(Format.Bold(user.ToString()))).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("stream_role_wl_add_fail", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_wl_add_fail(Format.Bold(user.ToString()))).ConfigureAwait(false);
else
if (success)
await ReplyConfirmLocalizedAsync("stream_role_wl_rem", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.stream_role_wl_rem(Format.Bold(user.ToString()))).ConfigureAwait(false);
else
await ReplyErrorLocalizedAsync("stream_role_wl_rem_fail", Format.Bold(user.ToString())).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.stream_role_wl_rem_fail(Format.Bold(user.ToString()))).ConfigureAwait(false);
}
}
}

View File

@@ -42,12 +42,12 @@ namespace NadekoBot.Modules.Utility
var targetUnit = _service.Units.FirstOrDefault(x => x.Triggers.Select(y => y.ToUpperInvariant()).Contains(target.ToUpperInvariant()));
if (originUnit is null || targetUnit is null)
{
await ReplyErrorLocalizedAsync("convert_not_found", Format.Bold(origin), Format.Bold(target)).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.convert_not_found(Format.Bold(origin), Format.Bold(target))).ConfigureAwait(false);
return;
}
if (originUnit.UnitType != targetUnit.UnitType)
{
await ReplyErrorLocalizedAsync("convert_type_error", Format.Bold(originUnit.Triggers.First()), Format.Bold(targetUnit.Triggers.First())).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.convert_type_error(Format.Bold(originUnit.Triggers.First()), Format.Bold(targetUnit.Triggers.First()))).ConfigureAwait(false);
return;
}
decimal res;

View File

@@ -81,7 +81,7 @@ namespace NadekoBot.Modules.Utility
int i = 0;
if (arr.Length == 0)
await ReplyErrorLocalizedAsync("nobody_playing_game").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.nobody_playing_game).ConfigureAwait(false);
else
{
await SendConfirmAsync("```css\n" + string.Join("\n", arr.GroupBy(item => (i++) / 2)
@@ -117,7 +117,7 @@ namespace NadekoBot.Modules.Utility
return _eb.Create().WithOkColor().WithDescription(GetText(strs.no_user_on_this_page));
return _eb.Create().WithOkColor()
.WithTitle(GetText(strs.inrole_list(Format.Bold(role?.Name ?? "No Role")) + $" - {roleUsers.Length}"))
.WithTitle(GetText(strs.inrole_list(Format.Bold(role?.Name ?? "No Role") + $" - {roleUsers.Length}")))
.WithDescription(string.Join("\n", pageUsers));
}, roleUsers.Length, 20).ConfigureAwait(false);
}
@@ -151,31 +151,29 @@ namespace NadekoBot.Modules.Utility
public async Task UserId([Leftover] IGuildUser target = null)
{
var usr = target ?? ctx.User;
await ReplyConfirmLocalizedAsync("userid", "🆔", Format.Bold(usr.ToString()),
Format.Code(usr.Id.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.userid("🆔", Format.Bold(usr.ToString()),
Format.Code(usr.Id.ToString())));
}
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]
public async Task RoleId([Leftover] IRole role)
{
await ReplyConfirmLocalizedAsync("roleid", "🆔", Format.Bold(role.ToString()),
Format.Code(role.Id.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.roleid("🆔", Format.Bold(role.ToString()),
Format.Code(role.Id.ToString())));
}
[NadekoCommand, Aliases]
public async Task ChannelId()
{
await ReplyConfirmLocalizedAsync("channelid", "🆔", Format.Code(ctx.Channel.Id.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.channelid("🆔", Format.Code(ctx.Channel.Id.ToString())));
}
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]
public async Task ServerId()
{
await ReplyConfirmLocalizedAsync("serverid", "🆔", Format.Code(ctx.Guild.Id.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.serverid("🆔", Format.Code(ctx.Guild.Id.ToString())));
}
[NadekoCommand, Aliases]
@@ -194,7 +192,7 @@ namespace NadekoBot.Modules.Utility
var roles = target.GetRoles().Except(new[] { guild.EveryoneRole }).OrderBy(r => -r.Position).Skip((page - 1) * rolesPerPage).Take(rolesPerPage).ToArray();
if (!roles.Any())
{
await ReplyErrorLocalizedAsync("no_roles_on_page").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_roles_on_page).ConfigureAwait(false);
}
else
{
@@ -208,7 +206,7 @@ namespace NadekoBot.Modules.Utility
var roles = guild.Roles.Except(new[] { guild.EveryoneRole }).OrderBy(r => -r.Position).Skip((page - 1) * rolesPerPage).Take(rolesPerPage).ToArray();
if (!roles.Any())
{
await ReplyErrorLocalizedAsync("no_roles_on_page").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_roles_on_page).ConfigureAwait(false);
}
else
{
@@ -232,7 +230,7 @@ namespace NadekoBot.Modules.Utility
var topic = channel.Topic;
if (string.IsNullOrWhiteSpace(topic))
await ReplyErrorLocalizedAsync("no_topic_set").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.no_topic_set).ConfigureAwait(false);
else
await SendConfirmAsync(GetText(strs.channel_topic), topic).ConfigureAwait(false);
}
@@ -272,7 +270,7 @@ namespace NadekoBot.Modules.Utility
var result = string.Join("\n", tags.Select(m => GetText(strs.showemojis(m, m.Url))));
if (string.IsNullOrWhiteSpace(result))
await ReplyErrorLocalizedAsync("showemojis_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.showemojis_none).ConfigureAwait(false);
else
await ctx.Channel.SendMessageAsync(result.TrimTo(2000)).ConfigureAwait(false);
}
@@ -290,7 +288,7 @@ namespace NadekoBot.Modules.Utility
if (!guilds.Any())
{
await ReplyErrorLocalizedAsync("listservers_none").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.listservers_none).ConfigureAwait(false);
return;
}
@@ -382,7 +380,7 @@ namespace NadekoBot.Modules.Utility
// {
// if (_inviteService.TryGetInvite(type, out var code))
// {
// await ReplyConfirmLocalizedAsync("your_invite", $"https://discord.gg/{code}");
// await ReplyErrorLocalizedAsync(strs.your_invite($"https://discord.gg/{code}"));
// return;
// }
// }

View File

@@ -19,9 +19,9 @@ namespace NadekoBot.Modules.Utility
var state = _service.ToggleVerboseErrors(ctx.Guild.Id, newstate);
if (state)
await ReplyConfirmLocalizedAsync("verbose_errors_enabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.verbose_errors_enabled).ConfigureAwait(false);
else
await ReplyConfirmLocalizedAsync("verbose_errors_disabled").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.verbose_errors_disabled).ConfigureAwait(false);
}
}
}

View File

@@ -29,11 +29,11 @@ namespace NadekoBot.Modules.Xp
var club = _service.TransferClub(ctx.User, newOwner);
if (club != null)
await ReplyConfirmLocalizedAsync("club_transfered",
await ReplyConfirmLocalizedAsync(strs.club_transfered(
Format.Bold(club.Name),
Format.Bold(newOwner.ToString())).ConfigureAwait(false);
Format.Bold(newOwner.ToString())));
else
await ReplyErrorLocalizedAsync("club_transfer_failed").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_transfer_failed).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -46,16 +46,14 @@ namespace NadekoBot.Modules.Xp
}
catch (InvalidOperationException)
{
await ReplyErrorLocalizedAsync("club_admin_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_admin_error).ConfigureAwait(false);
return;
}
if (admin)
await ReplyConfirmLocalizedAsync("club_admin_add", Format.Bold(toAdmin.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_admin_add(Format.Bold(toAdmin.ToString())));
else
await ReplyConfirmLocalizedAsync("club_admin_remove", Format.Bold(toAdmin.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_admin_remove(Format.Bold(toAdmin.ToString())));
}
[NadekoCommand, Aliases]
@@ -63,17 +61,17 @@ namespace NadekoBot.Modules.Xp
{
if (string.IsNullOrWhiteSpace(clubName) || clubName.Length > 20)
{
await ReplyErrorLocalizedAsync("club_name_too_long").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_name_too_long).ConfigureAwait(false);
return;
}
if (!_service.CreateClub(ctx.User, clubName, out ClubInfo club))
{
await ReplyErrorLocalizedAsync("club_create_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_create_error).ConfigureAwait(false);
return;
}
await ReplyConfirmLocalizedAsync("club_created", Format.Bold(club.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_created(Format.Bold(club.ToString()))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -82,11 +80,11 @@ namespace NadekoBot.Modules.Xp
if ((!Uri.IsWellFormedUriString(url, UriKind.Absolute) && url != null)
|| !await _service.SetClubIcon(ctx.User.Id, url is null ? null : new Uri(url)))
{
await ReplyErrorLocalizedAsync("club_icon_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_icon_error).ConfigureAwait(false);
return;
}
await ReplyConfirmLocalizedAsync("club_icon_set").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_icon_set).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -97,7 +95,7 @@ namespace NadekoBot.Modules.Xp
var club = _service.GetClubByMember(user);
if (club is null)
{
await ErrorLocalizedAsync("club_user_not_in_club", Format.Bold(user.ToString()));
await ErrorLocalizedAsync(strs.club_user_not_in_club(Format.Bold(user.ToString())));
return;
}
@@ -116,7 +114,7 @@ namespace NadekoBot.Modules.Xp
if (!_service.GetClubByName(clubName, out ClubInfo club))
{
await ReplyErrorLocalizedAsync("club_not_exists").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_not_exists).ConfigureAwait(false);
return;
}
@@ -138,7 +136,7 @@ namespace NadekoBot.Modules.Xp
var embed = _eb.Create()
.WithOkColor()
.WithTitle($"{club.ToString()}")
.WithDescription(GetText(strs.level_x(lvl.Level) + $" ({club.Xp} xp)"))
.WithDescription(GetText(strs.level_x(lvl.Level + $" ({club.Xp} xp)")))
.AddField(GetText(strs.desc), string.IsNullOrWhiteSpace(club.Description) ? "-" : club.Description,
false)
.AddField(GetText(strs.owner), club.Owner.ToString(), true)
@@ -172,7 +170,7 @@ namespace NadekoBot.Modules.Xp
var club = _service.GetClubWithBansAndApplications(ctx.User.Id);
if (club is null)
return ReplyErrorLocalizedAsync("club_not_exists_owner");
return ReplyErrorLocalizedAsync(strs.club_not_exists_owner);
var bans = club
.Bans
@@ -203,7 +201,7 @@ namespace NadekoBot.Modules.Xp
var club = _service.GetClubWithBansAndApplications(ctx.User.Id);
if (club is null)
return ReplyErrorLocalizedAsync("club_not_exists_owner");
return ReplyErrorLocalizedAsync(strs.club_not_exists_owner);
var apps = club
.Applicants
@@ -233,18 +231,17 @@ namespace NadekoBot.Modules.Xp
if (!_service.GetClubByName(clubName, out ClubInfo club))
{
await ReplyErrorLocalizedAsync("club_not_exists").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_not_exists).ConfigureAwait(false);
return;
}
if (_service.ApplyToClub(ctx.User, club))
{
await ReplyConfirmLocalizedAsync("club_applied", Format.Bold(club.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_applied(Format.Bold(club.ToString())));
}
else
{
await ReplyErrorLocalizedAsync("club_apply_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_apply_error).ConfigureAwait(false);
}
}
@@ -259,20 +256,19 @@ namespace NadekoBot.Modules.Xp
{
if (_service.AcceptApplication(ctx.User.Id, userName, out var discordUser))
{
await ReplyConfirmLocalizedAsync("club_accepted", Format.Bold(discordUser.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_accepted(Format.Bold(discordUser.ToString())));
}
else
await ReplyErrorLocalizedAsync("club_accept_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_accept_error).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
public async Task Clubleave()
{
if (_service.LeaveClub(ctx.User))
await ReplyConfirmLocalizedAsync("club_left").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_left).ConfigureAwait(false);
else
await ReplyErrorLocalizedAsync("club_not_in_club").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_not_in_club).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -285,10 +281,10 @@ namespace NadekoBot.Modules.Xp
public Task ClubKick([Leftover] string userName)
{
if (_service.Kick(ctx.User.Id, userName, out var club))
return ReplyConfirmLocalizedAsync("club_user_kick", Format.Bold(userName),
Format.Bold(club.ToString()));
return ReplyConfirmLocalizedAsync(strs.club_user_kick(Format.Bold(userName),
Format.Bold(club.ToString())));
else
return ReplyErrorLocalizedAsync("club_user_kick_fail");
return ReplyErrorLocalizedAsync(strs.club_user_kick_fail);
}
[NadekoCommand, Aliases]
@@ -301,10 +297,10 @@ namespace NadekoBot.Modules.Xp
public Task ClubBan([Leftover] string userName)
{
if (_service.Ban(ctx.User.Id, userName, out var club))
return ReplyConfirmLocalizedAsync("club_user_banned", Format.Bold(userName),
Format.Bold(club.ToString()));
return ReplyConfirmLocalizedAsync(strs.club_user_banned(Format.Bold(userName),
Format.Bold(club.ToString())));
else
return ReplyErrorLocalizedAsync("club_user_ban_fail");
return ReplyErrorLocalizedAsync(strs.club_user_ban_fail);
}
[NadekoCommand, Aliases]
@@ -317,10 +313,10 @@ namespace NadekoBot.Modules.Xp
public Task ClubUnBan([Leftover] string userName)
{
if (_service.UnBan(ctx.User.Id, userName, out var club))
return ReplyConfirmLocalizedAsync("club_user_unbanned", Format.Bold(userName),
Format.Bold(club.ToString()));
return ReplyConfirmLocalizedAsync(strs.club_user_unbanned(Format.Bold(userName),
Format.Bold(club.ToString())));
else
return ReplyErrorLocalizedAsync("club_user_unban_fail");
return ReplyErrorLocalizedAsync(strs.club_user_unban_fail);
}
[NadekoCommand, Aliases]
@@ -328,12 +324,11 @@ namespace NadekoBot.Modules.Xp
{
if (_service.ChangeClubLevelReq(ctx.User.Id, level))
{
await ReplyConfirmLocalizedAsync("club_level_req_changed", Format.Bold(level.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_level_req_changed(Format.Bold(level.ToString())));
}
else
{
await ReplyErrorLocalizedAsync("club_level_req_change_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_level_req_change_error).ConfigureAwait(false);
}
}
@@ -342,12 +337,11 @@ namespace NadekoBot.Modules.Xp
{
if (_service.ChangeClubDescription(ctx.User.Id, desc))
{
await ReplyConfirmLocalizedAsync("club_desc_updated", Format.Bold(desc ?? "-"))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_desc_updated(Format.Bold(desc ?? "-")));
}
else
{
await ReplyErrorLocalizedAsync("club_desc_update_failed").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_desc_update_failed).ConfigureAwait(false);
}
}
@@ -356,12 +350,11 @@ namespace NadekoBot.Modules.Xp
{
if (_service.Disband(ctx.User.Id, out ClubInfo club))
{
await ReplyConfirmLocalizedAsync("club_disbanded", Format.Bold(club.ToString()))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.club_disbanded(Format.Bold(club.ToString())));
}
else
{
await ReplyErrorLocalizedAsync("club_disband_error").ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.club_disband_error).ConfigureAwait(false);
}
}

View File

@@ -31,7 +31,7 @@ namespace NadekoBot.Modules.Xp
_service.XpReset(ctx.Guild.Id, userId);
await ReplyConfirmLocalizedAsync("reset_user", userId).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.reset_user(userId));
}
[NadekoCommand, Aliases]
@@ -48,7 +48,7 @@ namespace NadekoBot.Modules.Xp
_service.XpReset(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync("reset_server").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.reset_server).ConfigureAwait(false);
}
}
}

View File

@@ -128,7 +128,7 @@ namespace NadekoBot.Modules.Xp
public async Task XpRoleReward(int level)
{
_service.ResetRoleReward(ctx.Guild.Id, level);
await ReplyConfirmLocalizedAsync("xp_role_reward_cleared", level).ConfigureAwait(false);
await ReplyErrorLocalizedAsync(strs.xp_role_reward_cleared(level));
}
[NadekoCommand, Aliases]
@@ -142,13 +142,13 @@ namespace NadekoBot.Modules.Xp
_service.SetRoleReward(ctx.Guild.Id, level, role.Id, action == AddRemove.Remove);
if (action == AddRemove.Add)
await ReplyConfirmLocalizedAsync("xp_role_reward_add_role",
await ReplyConfirmLocalizedAsync(strs.xp_role_reward_add_role(
level,
Format.Bold(role.ToString()));
Format.Bold(role.ToString())));
else
await ReplyConfirmLocalizedAsync("xp_role_reward_remove_role",
await ReplyConfirmLocalizedAsync(strs.xp_role_reward_remove_role(
Format.Bold(level.ToString()),
Format.Bold(role.ToString()));
Format.Bold(role.ToString())));
}
[NadekoCommand, Aliases]
@@ -163,12 +163,10 @@ namespace NadekoBot.Modules.Xp
var config = _gss.Data;
if (amount == 0)
await ReplyConfirmLocalizedAsync("cur_reward_cleared", level, config.Currency.Sign)
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.cur_reward_cleared(level, config.Currency.Sign));
else
await ReplyConfirmLocalizedAsync("cur_reward_added",
level, Format.Bold(amount + config.Currency.Sign))
.ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.cur_reward_added(
level, Format.Bold(amount + config.Currency.Sign)));
}
public enum NotifyPlace
@@ -229,7 +227,14 @@ namespace NadekoBot.Modules.Xp
{
var ex = _service.ToggleExcludeServer(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync((ex ? "excluded" : "not_excluded"), Format.Bold(ctx.Guild.ToString())).ConfigureAwait(false);
if (ex)
{
await ReplyConfirmLocalizedAsync(strs.excluded(Format.Bold(ctx.Guild.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync(strs.not_excluded(Format.Bold(ctx.Guild.ToString())));
}
}
public enum Role { Role };
@@ -241,7 +246,14 @@ namespace NadekoBot.Modules.Xp
{
var ex = _service.ToggleExcludeRole(ctx.Guild.Id, role.Id);
await ReplyConfirmLocalizedAsync((ex ? "excluded" : "not_excluded"), Format.Bold(role.ToString())).ConfigureAwait(false);
if (ex)
{
await ReplyConfirmLocalizedAsync(strs.excluded(Format.Bold(role.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync(strs.not_excluded(Format.Bold(role.ToString())));
}
}
public enum Channel { Channel };
@@ -256,7 +268,14 @@ namespace NadekoBot.Modules.Xp
var ex = _service.ToggleExcludeChannel(ctx.Guild.Id, channel.Id);
await ReplyConfirmLocalizedAsync((ex ? "excluded" : "not_excluded"), Format.Bold(channel.ToString())).ConfigureAwait(false);
if (ex)
{
await ReplyConfirmLocalizedAsync(strs.excluded(Format.Bold(channel.ToString())));
}
else
{
await ReplyConfirmLocalizedAsync(strs.excluded(Format.Bold(channel.ToString())));
}
}
[NadekoCommand, Aliases]
@@ -410,7 +429,7 @@ namespace NadekoBot.Modules.Xp
_service.AddXp(userId, ctx.Guild.Id, amount);
var usr = ((SocketGuild)ctx.Guild).GetUser(userId)?.ToString()
?? userId.ToString();
await ReplyConfirmLocalizedAsync("modified", Format.Bold(usr), Format.Bold(amount.ToString())).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.modified(Format.Bold(usr), Format.Bold(amount.ToString()))).ConfigureAwait(false);
}
[NadekoCommand, Aliases]
@@ -426,7 +445,7 @@ namespace NadekoBot.Modules.Xp
{
_service.ReloadXpTemplate();
await Task.Delay(1000).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync("template_reloaded").ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.template_reloaded).ConfigureAwait(false);
}
}
}

View File

@@ -31,7 +31,7 @@
"banmsg_default": "No ban message set. Default behavior will be used.",
"banned_pl": "banned",
"banned_user": "User Banned",
"remove_roles": "have had their roles removed",
"remove_roles_pl": "have had their roles removed",
"bot_name": "Bot's name changed to {0}",
"bot_status": "Bot status changed to {0}",
"byedel_off": "Automatic deletion of bye messages has been disabled.",
@@ -107,7 +107,9 @@
"message_sent": "Message sent.",
"msg_not_found": "Message not found.",
"time_too_long": "Time you've specified is too long.",
"log_vc_moved": "{0} moved from {1} to {2}",
"log_vc_moved": "{0} moved from {1} to {2} voice channel",
"log_vc_joined": "{0} joined {1} voice channel",
"log_vc_left": "{0} left {1} voice channel",
"msg_del": "Message deleted in #{0}",
"msg_update": "Message updated in #{0}",
"muted_pl": "Muted",
@@ -1065,6 +1067,7 @@
"module_description_permissions": "Setup perms for commands, filter words and set up command cooldowns",
"module_description_searches": "Search for jokes, images of animals, anime and manga",
"module_description_xp": "Gain xp based on chat activity, check users' xp cards",
"module_description_missing": "Description is missing for this module.",
"obsolete_use": "⚠ Obsolete, use {0} instead.",
"purge_user_confirm": "Are you sure that you want to purge {0} from the database?",
"expr_import_no_input": "Invalid input. No valid file upload or input text found.",