From d0100f0c9f7258214dfc769b5dac3846094a6907 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Wed, 15 Feb 2017 00:38:02 +0100 Subject: [PATCH] Administration module fully translatable!!! Partially tested though, report any missing keys. --- .../Modules/Administration/Administration.cs | 216 ++++++----- .../Administration/Commands/Migration.cs | 2 +- .../Resources/ResponseStrings.Designer.cs | 336 ++++++++++++++++++ src/NadekoBot/Resources/ResponseStrings.resx | 114 ++++++ 4 files changed, 552 insertions(+), 116 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Administration.cs b/src/NadekoBot/Modules/Administration/Administration.cs index 21dceacc..97b872b9 100644 --- a/src/NadekoBot/Modules/Administration/Administration.cs +++ b/src/NadekoBot/Modules/Administration/Administration.cs @@ -1,18 +1,14 @@ using Discord; using Discord.Commands; using NadekoBot.Extensions; -using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using NadekoBot.Services; using NadekoBot.Attributes; using Discord.WebSocket; using NadekoBot.Services.Database.Models; -using System.Net.Http; -using System.IO; using static NadekoBot.Modules.Permissions.Permissions; using System.Collections.Concurrent; using NLog; @@ -22,7 +18,7 @@ namespace NadekoBot.Modules.Administration [NadekoModule("Administration", ".")] public partial class Administration : NadekoModule { - private static ConcurrentHashSet DeleteMessagesOnCommand { get; } = new ConcurrentHashSet(); + private static ConcurrentHashSet deleteMessagesOnCommand { get; } private new static Logger _log { get; } @@ -31,7 +27,7 @@ namespace NadekoBot.Modules.Administration _log = LogManager.GetCurrentClassLogger(); NadekoBot.CommandHandler.CommandExecuted += DelMsgOnCmd_Handler; - DeleteMessagesOnCommand = new ConcurrentHashSet(NadekoBot.AllGuildConfigs.Where(g => g.DeleteMessageOnCommand).Select(g => g.GuildId)); + deleteMessagesOnCommand = new ConcurrentHashSet(NadekoBot.AllGuildConfigs.Where(g => g.DeleteMessageOnCommand).Select(g => g.GuildId)); } @@ -44,7 +40,7 @@ namespace NadekoBot.Modules.Administration var channel = msg.Channel as SocketTextChannel; if (channel == null) return; - if (DeleteMessagesOnCommand.Contains(channel.Guild.Id) && cmd.Name != "prune") + if (deleteMessagesOnCommand.Contains(channel.Guild.Id) && cmd.Name != "prune") await msg.DeleteAsync().ConfigureAwait(false); } catch (Exception ex) @@ -71,17 +67,17 @@ namespace NadekoBot.Modules.Administration PermRole = config.PermissionRole, Verbose = config.VerbosePermissions, }; - Permissions.Permissions.Cache.AddOrUpdate(channel.Guild.Id, + Cache.AddOrUpdate(channel.Guild.Id, toAdd, (id, old) => toAdd); await uow.CompleteAsync(); } - - await channel.SendConfirmAsync($"{Context.Message.Author.Mention} πŸ†— **Permissions for this server are reset.**"); + await ReplyConfirmLocalized("perms_reset").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.Administrator)] + [RequireBotPermission(GuildPermission.ManageMessages)] public async Task Delmsgoncmd() { bool enabled; @@ -94,29 +90,31 @@ namespace NadekoBot.Modules.Administration } if (enabled) { - DeleteMessagesOnCommand.Add(Context.Guild.Id); - await Context.Channel.SendConfirmAsync("βœ… **Now automatically deleting successful command invokations.**").ConfigureAwait(false); + deleteMessagesOnCommand.Add(Context.Guild.Id); + await ReplyConfirmLocalized("delmsg_on").ConfigureAwait(false); } else { - DeleteMessagesOnCommand.TryRemove(Context.Guild.Id); - await Context.Channel.SendConfirmAsync("❗**Stopped automatic deletion of successful command invokations.**").ConfigureAwait(false); + deleteMessagesOnCommand.TryRemove(Context.Guild.Id); + await ReplyConfirmLocalized("delmsg_off").ConfigureAwait(false); } } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageRoles)] + [RequireBotPermission(GuildPermission.ManageRoles)] public async Task Setrole(IGuildUser usr, [Remainder] IRole role) { try { await usr.AddRolesAsync(role).ConfigureAwait(false); - await Context.Channel.SendConfirmAsync($"ℹ️ Successfully added role **{role.Name}** to user **{usr.Username}**").ConfigureAwait(false); + await ReplyConfirmLocalized("setrole", Format.Bold(role.Name), Format.Bold(usr.ToString())) + .ConfigureAwait(false); } catch (Exception ex) { - await Context.Channel.SendErrorAsync("⚠️ Failed to add role. **Bot has insufficient permissions.**\n").ConfigureAwait(false); + await ReplyErrorLocalized("setrole_err").ConfigureAwait(false); Console.WriteLine(ex.ToString()); } } @@ -124,82 +122,81 @@ namespace NadekoBot.Modules.Administration [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageRoles)] + [RequireBotPermission(GuildPermission.ManageRoles)] public async Task Removerole(IGuildUser usr, [Remainder] IRole role) { try { await usr.RemoveRolesAsync(role).ConfigureAwait(false); - await Context.Channel.SendConfirmAsync($"ℹ️ Successfully removed role **{role.Name}** from user **{usr.Username}**").ConfigureAwait(false); + await ReplyConfirmLocalized("remrole", Format.Bold(role.Name), Format.Bold(usr.ToString())).ConfigureAwait(false); } catch { - await Context.Channel.SendErrorAsync("⚠️ Failed to remove role. Most likely reason: **Insufficient permissions.**").ConfigureAwait(false); + await ReplyErrorLocalized("remrole_err").ConfigureAwait(false); } } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageRoles)] + [RequireBotPermission(GuildPermission.ManageRoles)] public async Task RenameRole(IRole roleToEdit, string newname) { try { if (roleToEdit.Position > (await Context.Guild.GetCurrentUserAsync().ConfigureAwait(false)).GetRoles().Max(r => r.Position)) { - await Context.Channel.SendErrorAsync("🚫 You can't edit roles higher than your highest role.").ConfigureAwait(false); + await ReplyErrorLocalized("renrole_perms").ConfigureAwait(false); return; } await roleToEdit.ModifyAsync(g => g.Name = newname).ConfigureAwait(false); - await Context.Channel.SendConfirmAsync("βœ… Role renamed.").ConfigureAwait(false); + await ReplyConfirmLocalized("renrole").ConfigureAwait(false); } catch (Exception) { - await Context.Channel.SendErrorAsync("⚠️ Failed to rename role. Probably **insufficient permissions.**").ConfigureAwait(false); + await ReplyErrorLocalized("renrole_err").ConfigureAwait(false); } } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageRoles)] + [RequireBotPermission(GuildPermission.ManageRoles)] public async Task RemoveAllRoles([Remainder] IGuildUser user) { try { await user.RemoveRolesAsync(user.GetRoles()).ConfigureAwait(false); - await Context.Channel.SendConfirmAsync($"πŸ—‘ Successfully removed **all** roles from user **{user.Username}**").ConfigureAwait(false); + await ReplyConfirmLocalized("rar", Format.Bold(user.ToString())).ConfigureAwait(false); } catch { - await Context.Channel.SendErrorAsync("⚠️ Failed to remove roles. Most likely reason: **Insufficient permissions.**").ConfigureAwait(false); + await ReplyErrorLocalized("rar_err").ConfigureAwait(false); } } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageRoles)] + [RequireBotPermission(GuildPermission.ManageRoles)] public async Task CreateRole([Remainder] string roleName = null) { if (string.IsNullOrWhiteSpace(roleName)) return; - try - { - var r = await Context.Guild.CreateRoleAsync(roleName).ConfigureAwait(false); - await Context.Channel.SendConfirmAsync($"βœ… Successfully created role **{r.Name}**.").ConfigureAwait(false); - } - catch (Exception) - { - await Context.Channel.SendErrorAsync("⚠️ Unspecified error.").ConfigureAwait(false); - } + + var r = await Context.Guild.CreateRoleAsync(roleName).ConfigureAwait(false); + await ReplyConfirmLocalized("cr", Format.Bold(r.Name)).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageRoles)] + [RequireBotPermission(GuildPermission.ManageRoles)] public async Task RoleColor(params string[] args) { - if (args.Count() != 2 && args.Count() != 4) + if (args.Length != 2 && args.Length != 4) { - await Context.Channel.SendErrorAsync("❌ The parameters specified are **invalid.**").ConfigureAwait(false); + await ReplyErrorLocalized("rc_params").ConfigureAwait(false); return; } var roleName = args[0].ToUpperInvariant(); @@ -207,7 +204,7 @@ namespace NadekoBot.Modules.Administration if (role == null) { - await Context.Channel.SendErrorAsync("🚫 That role **does not exist.**").ConfigureAwait(false); + await ReplyErrorLocalized("rc_not_exist").ConfigureAwait(false); return; } try @@ -220,64 +217,54 @@ namespace NadekoBot.Modules.Administration var blue = Convert.ToByte(rgb ? int.Parse(args[3]) : Convert.ToInt32(arg1.Substring(4, 2), 16)); await role.ModifyAsync(r => r.Color = new Color(red, green, blue)).ConfigureAwait(false); - await Context.Channel.SendConfirmAsync($"β˜‘οΈ Role **{role.Name}'s** color has been changed.").ConfigureAwait(false); + await ReplyConfirmLocalized("rc", Format.Bold(role.Name)).ConfigureAwait(false); } catch (Exception) { - await Context.Channel.SendErrorAsync("⚠️ Error occured, most likely **invalid parameters** or **insufficient permissions.**").ConfigureAwait(false); + await ReplyErrorLocalized("rc_perms").ConfigureAwait(false); } } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.BanMembers)] + [RequireBotPermission(GuildPermission.BanMembers)] public async Task Ban(IGuildUser user, [Remainder] string msg = null) { - if (string.IsNullOrWhiteSpace(msg)) - { - msg = "❗️No reason provided."; - } if (Context.User.Id != user.Guild.OwnerId && (user.GetRoles().Select(r => r.Position).Max() >= ((IGuildUser)Context.User).GetRoles().Select(r => r.Position).Max())) { - await Context.Channel.SendErrorAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy.").ConfigureAwait(false); + await ReplyErrorLocalized("hierarchy").ConfigureAwait(false); return; } if (!string.IsNullOrWhiteSpace(msg)) { try { - await (await user.CreateDMChannelAsync()).SendErrorAsync($"⛔️ **You have been BANNED from `{Context.Guild.Name}` server.**\n" + - $"βš– *Reason:* {msg}").ConfigureAwait(false); + await user.SendErrorAsync(GetText("bandm", Format.Bold(Context.Guild.Name), msg)); await Task.Delay(2000).ConfigureAwait(false); } catch { } } - try - { - await Context.Guild.AddBanAsync(user, 7).ConfigureAwait(false); - await Context.Channel.SendConfirmAsync("⛔️ **Banned** user **" + user.Username + "** ID: `" + user.Id + "`").ConfigureAwait(false); - } - catch - { - await Context.Channel.SendErrorAsync("⚠️ **Error.** Most likely I don't have sufficient permissions.").ConfigureAwait(false); - } + await Context.Guild.AddBanAsync(user, 7).ConfigureAwait(false); + await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() + .WithTitle("⛔️ " + GetText("banned_user")) + .AddField(efb => efb.WithName(GetText("username")).WithValue(user.ToString()).WithIsInline(true)) + .AddField(efb => efb.WithName("ID").WithValue(user.Id.ToString()).WithIsInline(true))) + .ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.KickMembers)] [RequireUserPermission(GuildPermission.ManageMessages)] + [RequireBotPermission(GuildPermission.BanMembers)] public async Task Softban(IGuildUser user, [Remainder] string msg = null) { - if (string.IsNullOrWhiteSpace(msg)) - { - msg = "❗️No reason provided."; - } if (Context.User.Id != user.Guild.OwnerId && user.GetRoles().Select(r => r.Position).Max() >= ((IGuildUser)Context.User).GetRoles().Select(r => r.Position).Max()) { - await Context.Channel.SendErrorAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy."); + await ReplyErrorLocalized("hierarchy").ConfigureAwait(false); return; } @@ -285,161 +272,159 @@ namespace NadekoBot.Modules.Administration { try { - await user.SendErrorAsync($"☣ **You have been SOFT-BANNED from `{Context.Guild.Name}` server.**\n" + - $"βš– *Reason:* {msg}").ConfigureAwait(false); + await user.SendErrorAsync(GetText("sbdm", Format.Bold(Context.Guild.Name), msg)); await Task.Delay(2000).ConfigureAwait(false); } catch { } } - try - { - await Context.Guild.AddBanAsync(user, 7).ConfigureAwait(false); - try { await Context.Guild.RemoveBanAsync(user).ConfigureAwait(false); } - catch { await Context.Guild.RemoveBanAsync(user).ConfigureAwait(false); } - - await Context.Channel.SendConfirmAsync("☣ **Soft-Banned** user **" + user.Username + "** ID: `" + user.Id + "`").ConfigureAwait(false); - } - catch - { - await Context.Channel.SendErrorAsync("⚠️ Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false); - } + await Context.Guild.AddBanAsync(user, 7).ConfigureAwait(false); + try { await Context.Guild.RemoveBanAsync(user).ConfigureAwait(false); } + catch { await Context.Guild.RemoveBanAsync(user).ConfigureAwait(false); } + + await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() + .WithTitle("☣ " + GetText("sb_user")) + .AddField(efb => efb.WithName(GetText("username")).WithValue(user.ToString()).WithIsInline(true)) + .AddField(efb => efb.WithName("ID").WithValue(user.Id.ToString()).WithIsInline(true))) + .ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.KickMembers)] + [RequireBotPermission(GuildPermission.KickMembers)] public async Task Kick(IGuildUser user, [Remainder] string msg = null) { - if (user == null) - { - await Context.Channel.SendErrorAsync("❗️User not found.").ConfigureAwait(false); - return; - } - if (Context.Message.Author.Id != user.Guild.OwnerId && user.GetRoles().Select(r => r.Position).Max() >= ((IGuildUser)Context.User).GetRoles().Select(r => r.Position).Max()) { - await Context.Channel.SendErrorAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy."); + await ReplyErrorLocalized("hierarchy").ConfigureAwait(false); return; } if (!string.IsNullOrWhiteSpace(msg)) { try { - await user.SendErrorAsync($"‼️**You have been KICKED from `{Context.Guild.Name}` server.**\n" + - $"βš– *Reason:* {msg}").ConfigureAwait(false); + await user.SendErrorAsync(GetText("kickdm", Format.Bold(Context.Guild.Name), msg)); await Task.Delay(2000).ConfigureAwait(false); } catch { } } - try - { - await user.KickAsync().ConfigureAwait(false); - await Context.Channel.SendConfirmAsync("‼️**Kicked** user **" + user.Username + "** ID: `" + user.Id + "`").ConfigureAwait(false); - } - catch - { - await Context.Channel.SendErrorAsync("⚠️ Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false); - } + + await user.KickAsync().ConfigureAwait(false); + await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() + .WithTitle(GetText("kicked_user")) + .AddField(efb => efb.WithName(GetText("username")).WithValue(user.ToString()).WithIsInline(true)) + .AddField(efb => efb.WithName("ID").WithValue(user.Id.ToString()).WithIsInline(true))) + .ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.DeafenMembers)] + [RequireBotPermission(GuildPermission.DeafenMembers)] public async Task Deafen(params IGuildUser[] users) { if (!users.Any()) return; - try + foreach (var u in users) { - foreach (var u in users) + try { await u.ModifyAsync(usr => usr.Deaf = true).ConfigureAwait(false); } - await Context.Channel.SendConfirmAsync("πŸ”‡ **Deafen** successful.").ConfigureAwait(false); - } - catch - { - await Context.Channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + catch + { + // ignored + } } + await ReplyConfirmLocalized("deafen").ConfigureAwait(false); } + [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.DeafenMembers)] + [RequireBotPermission(GuildPermission.DeafenMembers)] public async Task UnDeafen(params IGuildUser[] users) { if (!users.Any()) return; - try + + foreach (var u in users) { - foreach (var u in users) + try { await u.ModifyAsync(usr => usr.Deaf = false).ConfigureAwait(false); } - await Context.Channel.SendConfirmAsync("πŸ”Š **Undeafen** successful.").ConfigureAwait(false); - } - catch - { - await Context.Channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + catch + { + // ignored + } } + await ReplyConfirmLocalized("undeafen").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageChannels)] + [RequireBotPermission(GuildPermission.ManageChannels)] public async Task DelVoiChanl([Remainder] IVoiceChannel voiceChannel) { await voiceChannel.DeleteAsync().ConfigureAwait(false); - await Context.Channel.SendConfirmAsync($"πŸ—‘ Removed voice channel **{voiceChannel.Name}** successfully.").ConfigureAwait(false); + await ReplyConfirmLocalized("delvoich", Format.Bold(voiceChannel.Name)).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageChannels)] + [RequireBotPermission(GuildPermission.ManageChannels)] public async Task CreatVoiChanl([Remainder] string channelName) { var ch = await Context.Guild.CreateVoiceChannelAsync(channelName).ConfigureAwait(false); - await Context.Channel.SendConfirmAsync($"βœ… Created voice channel **{ch.Name}**. ID: `{ch.Id}`").ConfigureAwait(false); + await ReplyConfirmLocalized("createvoich",Format.Bold(ch.Name)).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageChannels)] + [RequireBotPermission(GuildPermission.ManageChannels)] public async Task DelTxtChanl([Remainder] ITextChannel toDelete) { await toDelete.DeleteAsync().ConfigureAwait(false); - await Context.Channel.SendConfirmAsync($"πŸ—‘ Removed text channel **{toDelete.Name}**. ID: `{toDelete.Id}`").ConfigureAwait(false); + await ReplyConfirmLocalized("deltextchan", Format.Bold(toDelete.Name)).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageChannels)] + [RequireBotPermission(GuildPermission.ManageChannels)] public async Task CreaTxtChanl([Remainder] string channelName) { var txtCh = await Context.Guild.CreateTextChannelAsync(channelName).ConfigureAwait(false); - await Context.Channel.SendConfirmAsync($"βœ… Added text channel **{txtCh.Name}**. ID: `{txtCh.Id}`").ConfigureAwait(false); + await ReplyConfirmLocalized("createtextchan", Format.Bold(txtCh.Name)).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageChannels)] + [RequireBotPermission(GuildPermission.ManageChannels)] public async Task SetTopic([Remainder] string topic = null) { var channel = (ITextChannel)Context.Channel; topic = topic ?? ""; await channel.ModifyAsync(c => c.Topic = topic); - await channel.SendConfirmAsync("πŸ†— **New channel topic set.**").ConfigureAwait(false); + await ReplyConfirmLocalized("set_topic").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageChannels)] + [RequireBotPermission(GuildPermission.ManageChannels)] public async Task SetChanlName([Remainder] string name) { var channel = (ITextChannel)Context.Channel; await channel.ModifyAsync(c => c.Name = name).ConfigureAwait(false); - await channel.SendConfirmAsync("πŸ†— **New channel name set.**").ConfigureAwait(false); + await ReplyConfirmLocalized("set_channel_name").ConfigureAwait(false); } @@ -459,6 +444,7 @@ namespace NadekoBot.Modules.Administration [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(ChannelPermission.ManageMessages)] + [RequireBotPermission(GuildPermission.ManageMessages)] public async Task Prune(int count) { if (count < 1) @@ -474,6 +460,7 @@ namespace NadekoBot.Modules.Administration [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(ChannelPermission.ManageMessages)] + [RequireBotPermission(GuildPermission.ManageMessages)] public async Task Prune(IGuildUser user, int count = 100) { if (count < 1) @@ -492,7 +479,7 @@ namespace NadekoBot.Modules.Administration [RequireUserPermission(GuildPermission.MentionEveryone)] public async Task MentionRole(params IRole[] roles) { - string send = $"❕{Context.User.Mention} has invoked a mention on the following roles ❕"; + string send = "❕" +GetText("menrole",Context.User.Mention); foreach (var role in roles) { send += $"\n**{role.Name}**\n"; @@ -510,7 +497,7 @@ namespace NadekoBot.Modules.Administration await Context.Channel.SendMessageAsync(send).ConfigureAwait(false); } - IGuild _nadekoSupportServer; + private IGuild _nadekoSupportServer; [NadekoCommand, Usage, Description, Aliases] public async Task Donators() { @@ -520,7 +507,7 @@ namespace NadekoBot.Modules.Administration { donatorsOrdered = uow.Donators.GetDonatorsOrdered(); } - await Context.Channel.SendConfirmAsync("Thanks to the people listed below for making this project happen!", string.Join("⭐", donatorsOrdered.Select(d => d.Name))).ConfigureAwait(false); + await Context.Channel.SendConfirmAsync(GetText("donators"), string.Join("⭐", donatorsOrdered.Select(d => d.Name))).ConfigureAwait(false); _nadekoSupportServer = _nadekoSupportServer ?? NadekoBot.Client.GetGuild(117523346618318850); @@ -543,8 +530,7 @@ namespace NadekoBot.Modules.Administration don = uow.Donators.AddOrUpdateDonator(donator.Id, donator.Username, amount); await uow.CompleteAsync(); } - - await Context.Channel.SendConfirmAsync($"Successfuly added a new donator. Total donated amount from this user: {don.Amount} πŸ‘‘").ConfigureAwait(false); + await ReplyConfirmLocalized("donadd", don.Amount).ConfigureAwait(false); } //[NadekoCommand, Usage, Description, Aliases] diff --git a/src/NadekoBot/Modules/Administration/Commands/Migration.cs b/src/NadekoBot/Modules/Administration/Commands/Migration.cs index 8ee6f652..802e5ae9 100644 --- a/src/NadekoBot/Modules/Administration/Commands/Migration.cs +++ b/src/NadekoBot/Modules/Administration/Commands/Migration.cs @@ -24,7 +24,7 @@ namespace NadekoBot.Modules.Administration { private const int CURRENT_VERSION = 1; - private static Logger _log { get; } + private new static readonly Logger _log; static Migration() { diff --git a/src/NadekoBot/Resources/ResponseStrings.Designer.cs b/src/NadekoBot/Resources/ResponseStrings.Designer.cs index bb9992f1..d8db88cd 100644 --- a/src/NadekoBot/Resources/ResponseStrings.Designer.cs +++ b/src/NadekoBot/Resources/ResponseStrings.Designer.cs @@ -95,6 +95,16 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to You have been banned from {0} server. + ///Reason: {1}. + /// + public static string administration_bandm { + get { + return ResourceManager.GetString("administration_bandm", resourceCulture); + } + } + /// /// Looks up a localized string similar to banned. /// @@ -104,6 +114,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to User Banned. + /// + public static string administration_banned_user { + get { + return ResourceManager.GetString("administration_banned_user", resourceCulture); + } + } + /// /// Looks up a localized string similar to Bot name changed to {0}. /// @@ -230,6 +249,42 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Sucessfully created role {0}. + /// + public static string administration_cr { + get { + return ResourceManager.GetString("administration_cr", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Text channel {0} created.. + /// + public static string administration_createtextchan { + get { + return ResourceManager.GetString("administration_createtextchan", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Voice channel {0} created.. + /// + public static string administration_createvoich { + get { + return ResourceManager.GetString("administration_createvoich", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deafen successful.. + /// + public static string administration_deafen { + get { + return ResourceManager.GetString("administration_deafen", resourceCulture); + } + } + /// /// Looks up a localized string similar to Deleted server {0}. /// @@ -239,6 +294,42 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Stopped automatic deletion of successful command invokations.. + /// + public static string administration_delmsg_off { + get { + return ResourceManager.GetString("administration_delmsg_off", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Now automatically deleting sucessful command invokations.. + /// + public static string administration_delmsg_on { + get { + return ResourceManager.GetString("administration_delmsg_on", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Text channel {0} deleted.. + /// + public static string administration_deltextchan { + get { + return ResourceManager.GetString("administration_deltextchan", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Voice channel {0} deleted.. + /// + public static string administration_delvoich { + get { + return ResourceManager.GetString("administration_delvoich", resourceCulture); + } + } + /// /// Looks up a localized string similar to DM from. /// @@ -248,6 +339,24 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Sucessfully added a new donator.Total donated amount from this user: {0} πŸ‘‘. + /// + public static string administration_donadd { + get { + return ResourceManager.GetString("administration_donadd", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Thanks to the people listed below for making this project hjappen!. + /// + public static string administration_donators { + get { + return ResourceManager.GetString("administration_donators", resourceCulture); + } + } + /// /// Looks up a localized string similar to I will forward DMs to all owners.. /// @@ -392,6 +501,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to You can't use this command on users with a role higher or equal to yours in the role hierarchy.. + /// + public static string administration_hierarchy { + get { + return ResourceManager.GetString("administration_hierarchy", resourceCulture); + } + } + /// /// Looks up a localized string similar to Images loaded after {0} seconds!. /// @@ -428,6 +546,25 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to You have been kicked from {0} server. + ///Reason: {1}. + /// + public static string administration_kickdm { + get { + return ResourceManager.GetString("administration_kickdm", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User Kicked. + /// + public static string administration_kicked_user { + get { + return ResourceManager.GetString("administration_kicked_user", resourceCulture); + } + } + /// /// Looks up a localized string similar to List Of Languages ///{0}. @@ -564,6 +701,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to {0} has invoked a mention on the following roles. + /// + public static string administration_menrole { + get { + return ResourceManager.GetString("administration_menrole", resourceCulture); + } + } + /// /// Looks up a localized string similar to Message from {0} `[Bot Owner]`:. /// @@ -735,6 +881,24 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Error. Most likely I don't have sufficient permissions.. + /// + public static string administration_perms { + get { + return ResourceManager.GetString("administration_perms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Permissions for this server are reset.. + /// + public static string administration_perms_reset { + get { + return ResourceManager.GetString("administration_perms_reset", resourceCulture); + } + } + /// /// Looks up a localized string similar to Active Protections. /// @@ -807,6 +971,105 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Successfully removed all roles from user {0}. + /// + public static string administration_rar { + get { + return ResourceManager.GetString("administration_rar", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to remove roles. I have insufficient permissions.. + /// + public static string administration_rar_err { + get { + return ResourceManager.GetString("administration_rar_err", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Color of {0} role has been changed.. + /// + public static string administration_rc { + get { + return ResourceManager.GetString("administration_rc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to That role does not exist.. + /// + public static string administration_rc_not_exist { + get { + return ResourceManager.GetString("administration_rc_not_exist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameters specified are invalid.. + /// + public static string administration_rc_params { + get { + return ResourceManager.GetString("administration_rc_params", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error occured due to invalid color or insufficient permissions.. + /// + public static string administration_rc_perms { + get { + return ResourceManager.GetString("administration_rc_perms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed role {0} from user {1}. + /// + public static string administration_remrole { + get { + return ResourceManager.GetString("administration_remrole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to remove role. I have insufficient permissions.. + /// + public static string administration_remrole_err { + get { + return ResourceManager.GetString("administration_remrole_err", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role renamed.. + /// + public static string administration_renrole { + get { + return ResourceManager.GetString("administration_renrole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to rename role. I have insufficient permissions.. + /// + public static string administration_renrole_err { + get { + return ResourceManager.GetString("administration_renrole_err", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You can't edit roles higher than your highest role.. + /// + public static string administration_renrole_perms { + get { + return ResourceManager.GetString("administration_renrole_perms", resourceCulture); + } + } + /// /// Looks up a localized string similar to Removed the playing message: {0}. /// @@ -997,6 +1260,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to New channel name set.. + /// + public static string administration_set_channel_name { + get { + return ResourceManager.GetString("administration_set_channel_name", resourceCulture); + } + } + /// /// Looks up a localized string similar to New game set!. /// @@ -1015,6 +1287,33 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to New channel topic set.. + /// + public static string administration_set_topic { + get { + return ResourceManager.GetString("administration_set_topic", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sucessfully added role {0} to user {1}. + /// + public static string administration_setrole { + get { + return ResourceManager.GetString("administration_setrole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to add role. I have insufficient permissions.. + /// + public static string administration_setrole_err { + get { + return ResourceManager.GetString("administration_setrole_err", resourceCulture); + } + } + /// /// Looks up a localized string similar to Shard {0} reconnected.. /// @@ -1124,6 +1423,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Undeafen successful.. + /// + public static string administration_undeafen { + get { + return ResourceManager.GetString("administration_undeafen", resourceCulture); + } + } + /// /// Looks up a localized string similar to Unmuted. /// @@ -1268,6 +1576,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Username. + /// + public static string administration_username { + get { + return ResourceManager.GetString("administration_username", resourceCulture); + } + } + /// /// Looks up a localized string similar to Username Changed. /// @@ -1376,6 +1693,16 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to You have been soft-banned from {0} server. + ///Reason: {1}. + /// + public static string administraton_sbdm { + get { + return ResourceManager.GetString("administraton_sbdm", resourceCulture); + } + } + /// /// Looks up a localized string similar to User Unbanned. /// @@ -1412,6 +1739,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to User Soft-Banned. + /// + public static string adminsitration_sb_user { + get { + return ResourceManager.GetString("adminsitration_sb_user", resourceCulture); + } + } + /// /// Looks up a localized string similar to That base is already claimed or destroyed.. /// diff --git a/src/NadekoBot/Resources/ResponseStrings.resx b/src/NadekoBot/Resources/ResponseStrings.resx index f044bf3a..7fabfa84 100644 --- a/src/NadekoBot/Resources/ResponseStrings.resx +++ b/src/NadekoBot/Resources/ResponseStrings.resx @@ -310,10 +310,17 @@ Avatar Changed + + You have been banned from {0} server. +Reason: {1} + banned PLURAL + + User Banned + Bot name changed to {0} @@ -356,12 +363,42 @@ Content + + Sucessfully created role {0} + + + Text channel {0} created. + + + Voice channel {0} created. + + + Deafen successful. + Deleted server {0} + + Stopped automatic deletion of successful command invokations. + + + Now automatically deleting sucessful command invokations. + + + Text channel {0} deleted. + + + Voice channel {0} deleted. + DM from + + Sucessfully added a new donator.Total donated amount from this user: {0} πŸ‘‘ + + + Thanks to the people listed below for making this project hjappen! + I will forward DMs to all owners. @@ -410,6 +447,9 @@ Greet announcements enabled on this channel. + + You can't use this command on users with a role higher or equal to yours in the role hierarchy. + Images loaded after {0} seconds! @@ -422,6 +462,13 @@ {0} has joined {1} + + You have been kicked from {0} server. +Reason: {1} + + + User Kicked + List Of Languages {0} @@ -468,6 +515,9 @@ Stopped logging {0} event. + + {0} has invoked a mention on the following roles + Message from {0} `[Bot Owner]`: @@ -527,6 +577,12 @@ Old Topic + + Error. Most likely I don't have sufficient permissions. + + + Permissions for this server are reset. + Active Protections @@ -551,6 +607,39 @@ Time must be between {0} and {1} seconds. + + Successfully removed all roles from user {0} + + + Failed to remove roles. I have insufficient permissions. + + + Color of {0} role has been changed. + + + That role does not exist. + + + The parameters specified are invalid. + + + Error occured due to invalid color or insufficient permissions. + + + Successfully removed role {0} from user {1} + + + Failed to remove role. I have insufficient permissions. + + + Role renamed. + + + Failed to rename role. I have insufficient permissions. + + + You can't edit roles higher than your highest role. + Removed the playing message: {0} @@ -612,15 +701,27 @@ You now have {0} role. + + Sucessfully added role {0} to user {1} + + + Failed to add role. I have insufficient permissions. + New avatar set! + + New channel name set. + New game set! New stream set! + + New channel topic set. + Shard {0} reconnected. @@ -659,10 +760,16 @@ Text Channel Destroyed + + Undeafen successful. + Unmuted singular + + Username + Username Changed @@ -744,6 +851,10 @@ User {0} from voice chat + + You have been soft-banned from {0} server. +Reason: {1} + User Unbanned @@ -756,6 +867,9 @@ Presence Updates + + User Soft-Banned + Back to ToC