diff --git a/Boyfriend/Boyfriend.cs b/Boyfriend/Boyfriend.cs index 05d473b..7d3d94d 100644 --- a/Boyfriend/Boyfriend.cs +++ b/Boyfriend/Boyfriend.cs @@ -1,5 +1,5 @@ using System.Globalization; -using System.Text.Json; +using Newtonsoft.Json; using Discord; using Discord.WebSocket; @@ -26,7 +26,7 @@ public static class Boyfriend { await Client.LoginAsync(TokenType.Bot, token); await Client.StartAsync(); - await Client.SetActivityAsync(new Game("Retrospecter - Chiller", ActivityType.Listening)); + await Client.SetActivityAsync(new Game("Retrospecter - Expurgation", ActivityType.Listening)); new EventHandler().InitEvents(); @@ -41,27 +41,33 @@ public static class Boyfriend { public static async Task SetupGuildConfigs() { foreach (var guild in Client.Guilds) { var path = "config_" + guild.Id + ".json"; - var openStream = !File.Exists(path) ? File.Create(path) : File.OpenRead(path); + if (!File.Exists(path)) File.Create(path); - GuildConfig config; - try { - config = await JsonSerializer.DeserializeAsync(openStream) ?? throw new Exception(); - } catch (JsonException) { + var config = JsonConvert.DeserializeObject(await File.ReadAllTextAsync(path)); + if (config == null) { Messages.Culture = new CultureInfo("ru"); - config = new GuildConfig(guild.Id, "ru", "!", false, true, - true, Messages.DefaultWelcomeMessage, 0, 0, 0, 0); + config = new GuildConfig(guild.Id); } - GuildConfigDictionary.Add(guild.Id, config); + config.Validate(); + + GuildConfigDictionary.Add(config.Id.GetValueOrDefault(0), config); } } + public static void ResetGuildConfig(IGuild guild) { + GuildConfigDictionary.Remove(guild.Id); + var config = new GuildConfig(guild.Id); + config.Validate(); + GuildConfigDictionary.Add(guild.Id, config); + } + public static GuildConfig GetGuildConfig(IGuild guild) { Messages.Culture = new CultureInfo("ru"); - var toReturn = GuildConfigDictionary.ContainsKey(guild.Id) ? GuildConfigDictionary[guild.Id] - : new GuildConfig(guild.Id, "ru", "!", false, true, true, Messages.DefaultWelcomeMessage, 0, 0, 0, 0); + var config = GuildConfigDictionary.ContainsKey(guild.Id) ? GuildConfigDictionary[guild.Id] : + new GuildConfig(guild.Id); + config.Validate(); - if (toReturn.Id != guild.Id) throw new Exception(); - return toReturn; + return config; } public static IGuild FindGuild(IMessageChannel channel) { @@ -71,4 +77,4 @@ public static class Boyfriend { throw new Exception(Messages.CouldntFindGuildByChannel); } -} \ No newline at end of file +} diff --git a/Boyfriend/Boyfriend.csproj b/Boyfriend/Boyfriend.csproj index 1563891..ada7a52 100644 --- a/Boyfriend/Boyfriend.csproj +++ b/Boyfriend/Boyfriend.csproj @@ -15,7 +15,8 @@ - + + diff --git a/Boyfriend/CommandHandler.cs b/Boyfriend/CommandHandler.cs index 0d79886..b9a455c 100644 --- a/Boyfriend/CommandHandler.cs +++ b/Boyfriend/CommandHandler.cs @@ -9,14 +9,15 @@ namespace Boyfriend; public static class CommandHandler { public static readonly Command[] Commands = { new BanCommand(), new ClearCommand(), new HelpCommand(), - new KickCommand(), new MuteCommand() + new KickCommand(), new MuteCommand(), new PingCommand(), + new SettingsCommand(), new UnbanCommand(), new UnmuteCommand() }; public static async Task HandleCommand(SocketUserMessage message) { var context = new SocketCommandContext(Boyfriend.Client, message); foreach (var command in Commands) { - var regex = new Regex(Regex.Escape(Boyfriend.GetGuildConfig(context.Guild).Prefix)); + var regex = new Regex(Regex.Escape(Boyfriend.GetGuildConfig(context.Guild).Prefix!)); if (!command.GetAliases().Contains(regex.Replace(message.Content, "", 1).Split()[0])) continue; var args = message.Content.Split().Skip(1).ToArray(); @@ -35,6 +36,7 @@ public static class CommandHandler { await context.Channel.SendMessageAsync($"{signature} `{e.Message}`"); if (e.StackTrace != null && e is not ApplicationException or UnauthorizedAccessException) await context.Channel.SendMessageAsync(Utils.Wrap(e.StackTrace)); + throw; } break; @@ -66,4 +68,4 @@ public static class CommandHandler { if (actor.Hierarchy <= target.Hierarchy) throw new UnauthorizedAccessException(Messages.InteractionsFailedUser); } -} \ No newline at end of file +} diff --git a/Boyfriend/Commands/MuteCommand.cs b/Boyfriend/Commands/MuteCommand.cs index d9832fc..2c3e0a9 100644 --- a/Boyfriend/Commands/MuteCommand.cs +++ b/Boyfriend/Commands/MuteCommand.cs @@ -28,15 +28,17 @@ public class MuteCommand : Command { toMute.TimedOutUntil != null && toMute.TimedOutUntil.Value.ToUnixTimeMilliseconds() > DateTimeOffset.Now.ToUnixTimeMilliseconds()) throw new ApplicationException(Messages.MemberAlreadyMuted); - var rolesRemoved = Boyfriend.GetGuildConfig(context.Guild).RolesRemovedOnMute; + var config = Boyfriend.GetGuildConfig(context.Guild); + var rolesRemoved = config.RolesRemovedOnMute!; if (rolesRemoved.ContainsKey(toMute.Id)) { foreach (var roleId in rolesRemoved[toMute.Id]) await toMute.AddRoleAsync(roleId); rolesRemoved.Remove(toMute.Id); + await config.Save(); await Warn(context.Channel, Messages.RolesReturned); return; } - await CommandHandler.CheckPermissions(author, GuildPermission.ManageMessages, GuildPermission.ManageRoles); + await CommandHandler.CheckPermissions(author, GuildPermission.ModerateMembers, GuildPermission.ManageRoles); await CommandHandler.CheckInteractions(author, toMute); MuteMember(context.Guild, context.Channel as ITextChannel, context.Guild.GetUser(context.User.Id), toMute, duration, reason); @@ -48,7 +50,7 @@ public class MuteCommand : Command { var authorMention = author.Mention; var role = Utils.GetMuteRole(guild); var config = Boyfriend.GetGuildConfig(guild); - if (config.RemoveRolesOnMute && role != null) { + if (config.RemoveRolesOnMute.GetValueOrDefault(false) && role != null) { var rolesRemoved = new List(); try { foreach (var roleId in toMute.RoleIds) { @@ -59,7 +61,7 @@ public class MuteCommand : Command { } catch (NullReferenceException) { } - config.RolesRemovedOnMute.Add(toMute.Id, rolesRemoved); + config.RolesRemovedOnMute!.Add(toMute.Id, rolesRemoved); await config.Save(); } @@ -89,4 +91,4 @@ public class MuteCommand : Command { public override string GetSummary() { return "Глушит участника"; } -} \ No newline at end of file +} diff --git a/Boyfriend/Commands/PingCommand.cs b/Boyfriend/Commands/PingCommand.cs index ce8100a..ae0c4af 100644 --- a/Boyfriend/Commands/PingCommand.cs +++ b/Boyfriend/Commands/PingCommand.cs @@ -7,7 +7,7 @@ namespace Boyfriend.Commands; public class PingCommand : Command { public override async Task Run(SocketCommandContext context, string[] args) { - await context.Channel.SendMessageAsync($"{Utils.GetBeep(Boyfriend.GetGuildConfig(context.Guild).Lang)}" + + await context.Channel.SendMessageAsync($"{Utils.GetBeep(Boyfriend.GetGuildConfig(context.Guild).Lang!)}" + $"{Boyfriend.Client.Latency}{Messages.Milliseconds}"); } @@ -22,4 +22,4 @@ public class PingCommand : Command { public override string GetSummary() { return "Измеряет время обработки REST-запроса"; } -} \ No newline at end of file +} diff --git a/Boyfriend/Commands/SettingsCommand.cs b/Boyfriend/Commands/SettingsCommand.cs index 3902077..9cdfe6e 100644 --- a/Boyfriend/Commands/SettingsCommand.cs +++ b/Boyfriend/Commands/SettingsCommand.cs @@ -14,71 +14,89 @@ public class SettingsCommand : Command { var guild = context.Guild; if (args.Length == 0) { var nl = Environment.NewLine; - var adminLogChannel = guild.GetTextChannel(config.AdminLogChannel); + var adminLogChannel = guild.GetTextChannel(config.AdminLogChannel.GetValueOrDefault(0)); var admin = adminLogChannel == null ? Messages.ChannelNotSpecified : adminLogChannel.Mention; - var botLogChannel = guild.GetTextChannel(config.BotLogChannel); + var botLogChannel = guild.GetTextChannel(config.BotLogChannel.GetValueOrDefault(0)); var bot = botLogChannel == null ? Messages.ChannelNotSpecified : botLogChannel.Mention; - var muteRole = guild.GetRole(config.MuteRole); + var muteRole = guild.GetRole(config.MuteRole.GetValueOrDefault(0)); var mute = muteRole == null ? Messages.RoleNotSpecified : muteRole.Mention; - var defaultRole = guild.GetRole(config.DefaultRole); - var defaultr = muteRole == null ? Messages.RoleNotSpecified : defaultRole.Mention; + var defaultRole = guild.GetRole(config.DefaultRole.GetValueOrDefault(0)); + var defaultr = defaultRole == null ? Messages.RoleNotSpecified : defaultRole.Mention; var toSend = string.Format(Messages.CurrentSettings, nl) + string.Format(Messages.CurrentSettingsLang, config.Lang, nl) + string.Format(Messages.CurrentSettingsPrefix, config.Prefix, nl) + - string.Format(Messages.CurrentSettingsRemoveRoles, YesOrNo(config.RemoveRolesOnMute), nl) + - string.Format(Messages.CurrentSettingsUseSystemChannel, YesOrNo(config.UseSystemChannel), nl) + - string.Format(Messages.CurrentSettingsSendWelcomeMessages, YesOrNo(config.UseSystemChannel), - nl) + + string.Format(Messages.CurrentSettingsRemoveRoles, YesOrNo( + config.RemoveRolesOnMute.GetValueOrDefault(false)), nl) + + string.Format(Messages.CurrentSettingsUseSystemChannel, YesOrNo( + config.UseSystemChannel.GetValueOrDefault(true)), nl) + + string.Format(Messages.CurrentSettingsSendWelcomeMessages, YesOrNo( + config.SendWelcomeMessages.GetValueOrDefault(true)), nl) + + string.Format(Messages.CurrentSettingsReceiveStartupMessages, YesOrNo( + config.ReceiveStartupMessages.GetValueOrDefault(true)), nl) + string.Format(Messages.CurrentSettingsWelcomeMessage, config.WelcomeMessage, nl) + string.Format(Messages.CurrentSettingsDefaultRole, defaultr, nl) + string.Format(Messages.CurrentSettingsMuteRole, mute, nl) + string.Format(Messages.CurrentSettingsAdminLogChannel, admin, nl) + string.Format(Messages.CurrentSettingsBotLogChannel, bot); - await Utils.SilentSendAsync(context.Channel as ITextChannel ?? throw new Exception(), toSend); + await Utils.SilentSendAsync(context.Channel as ITextChannel ?? throw new ApplicationException(), toSend); return; } var setting = args[0].ToLower(); - var value = args[1].ToLower(); + var value = ""; + var shouldDefault = false; + if (args.Length >= 2) + value = args[1].ToLower(); + else + shouldDefault = true; - var boolValue = ParseBool(args[1]); + var boolValue = ParseBool(value); var channel = await Utils.ParseChannelNullable(value) as IGuildChannel; var role = Utils.ParseRoleNullable(guild, value); switch (setting) { + case "reset": + Boyfriend.ResetGuildConfig(guild); + break; case "lang" when value is not ("ru" or "en"): - throw new Exception(Messages.LanguageNotSupported); + throw new ApplicationException(Messages.LanguageNotSupported); case "lang": - config.Lang = value; - Messages.Culture = new CultureInfo(value); + config.Lang = shouldDefault ? "ru" : value; + Messages.Culture = new CultureInfo(shouldDefault ? "ru" : value); break; case "prefix": - config.Prefix = value; + config.Prefix = shouldDefault ? "!" : value; break; case "removerolesonmute": - config.RemoveRolesOnMute = GetBoolValue(boolValue); + config.RemoveRolesOnMute = !shouldDefault && GetBoolValue(boolValue); break; case "usesystemchannel": - config.UseSystemChannel = GetBoolValue(boolValue); + config.UseSystemChannel = shouldDefault || GetBoolValue(boolValue); break; case "sendwelcomemessages": - config.SendWelcomeMessages = GetBoolValue(boolValue); + config.SendWelcomeMessages = shouldDefault || GetBoolValue(boolValue); + break; + case "receivestartupmessages": + config.ReceiveStartupMessages = shouldDefault || GetBoolValue(boolValue); break; case "welcomemessage": - config.WelcomeMessage = value; + config.WelcomeMessage = shouldDefault ? Messages.DefaultWelcomeMessage : value; break; case "defaultrole": - config.DefaultRole = GetRoleId(role); + config.DefaultRole = shouldDefault ? 0 : GetRoleId(role); break; case "muterole": - config.MuteRole = GetRoleId(role); + config.MuteRole = shouldDefault ? 0 : GetRoleId(role); break; case "adminlogchannel": - config.AdminLogChannel = GetChannelId(channel); + config.AdminLogChannel = shouldDefault ? 0 : GetChannelId(channel); break; case "botlogchannel": - config.BotLogChannel = GetChannelId(channel); + config.BotLogChannel = shouldDefault ? 0 : GetChannelId(channel); break; + default: + await context.Channel.SendMessageAsync(Messages.SettingDoesntExist); + return; } await config.Save(); @@ -89,22 +107,21 @@ public class SettingsCommand : Command { private static bool? ParseBool(string toParse) { try { return bool.Parse(toParse.ToLower()); - } - catch (FormatException) { + } catch (FormatException) { return null; } } private static bool GetBoolValue(bool? from) { - return from ?? throw new Exception(Messages.InvalidBoolean); + return from ?? throw new ApplicationException(Messages.InvalidBoolean); } private static ulong GetRoleId(IRole? role) { - return (role ?? throw new Exception(Messages.InvalidRoleSpecified)).Id; + return (role ?? throw new ApplicationException(Messages.InvalidRoleSpecified)).Id; } private static ulong GetChannelId(IGuildChannel? channel) { - return (channel ?? throw new Exception(Messages.InvalidChannelSpecified)).Id; + return (channel ?? throw new ApplicationException(Messages.InvalidChannelSpecified)).Id; } private static string YesOrNo(bool isYes) { @@ -122,4 +139,4 @@ public class SettingsCommand : Command { public override string GetSummary() { return "Настраивает бота отдельно для этого сервера"; } -} \ No newline at end of file +} diff --git a/Boyfriend/Commands/UnbanCommand.cs b/Boyfriend/Commands/UnbanCommand.cs index c8b9fef..d2d223f 100644 --- a/Boyfriend/Commands/UnbanCommand.cs +++ b/Boyfriend/Commands/UnbanCommand.cs @@ -11,7 +11,7 @@ public class UnbanCommand : Command { public override async Task Run(SocketCommandContext context, string[] args) { var toUnban = await Utils.ParseUser(args[0]); if (context.Guild.GetBanAsync(toUnban.Id) == null) - throw new Exception(Messages.UserNotBanned); + throw new ApplicationException(Messages.UserNotBanned); UnbanUser(context.Guild, context.Channel as ITextChannel, context.Guild.GetUser(context.User.Id), toUnban, Utils.JoinString(args, 1)); } @@ -40,4 +40,4 @@ public class UnbanCommand : Command { public override string GetSummary() { return "Возвращает пользователя из бана"; } -} \ No newline at end of file +} diff --git a/Boyfriend/Commands/UnmuteCommand.cs b/Boyfriend/Commands/UnmuteCommand.cs index c416807..75eec78 100644 --- a/Boyfriend/Commands/UnmuteCommand.cs +++ b/Boyfriend/Commands/UnmuteCommand.cs @@ -14,14 +14,21 @@ public class UnmuteCommand : Command { await CommandHandler.CheckPermissions(author, GuildPermission.ManageMessages, GuildPermission.ManageRoles); await CommandHandler.CheckInteractions(author, toUnmute); var role = Utils.GetMuteRole(context.Guild); - if (role != null) + if (role != null) { if (toUnmute.RoleIds.All(x => x != role.Id)) { - var rolesRemoved = Boyfriend.GetGuildConfig(context.Guild).RolesRemovedOnMute; + var config = Boyfriend.GetGuildConfig(context.Guild); + var rolesRemoved = config.RolesRemovedOnMute; - foreach (var roleId in rolesRemoved[toUnmute.Id]) await toUnmute.AddRoleAsync(roleId); + foreach (var roleId in rolesRemoved![toUnmute.Id]) await toUnmute.AddRoleAsync(roleId); rolesRemoved.Remove(toUnmute.Id); + await config.Save(); throw new ApplicationException(Messages.RolesReturned); } + } + if (role != null && toUnmute.RoleIds.All(x => x != role.Id) || + toUnmute.TimedOutUntil == null || toUnmute.TimedOutUntil.Value.ToUnixTimeMilliseconds() + < DateTimeOffset.Now.ToUnixTimeMilliseconds()) + throw new ApplicationException(Messages.MemberNotMuted); UnmuteMember(context.Guild, context.Channel as ITextChannel, context.Guild.GetUser(context.User.Id), toUnmute, Utils.JoinString(args, 1)); @@ -33,12 +40,19 @@ public class UnmuteCommand : Command { var authorMention = author.Mention; var notification = string.Format(Messages.MemberUnmuted, authorMention, toUnmute.Mention, Utils.WrapInline(reason)); - await toUnmute.RemoveRoleAsync(Utils.GetMuteRole(guild)); - var config = Boyfriend.GetGuildConfig(guild); + var role = Utils.GetMuteRole(guild); - if (config.RolesRemovedOnMute.ContainsKey(toUnmute.Id)) { - foreach (var roleId in config.RolesRemovedOnMute[toUnmute.Id]) await toUnmute.AddRoleAsync(roleId); - config.RolesRemovedOnMute.Remove(toUnmute.Id); + if (role != null) { + await toUnmute.RemoveRoleAsync(role); + var config = Boyfriend.GetGuildConfig(guild); + + if (config.RolesRemovedOnMute!.ContainsKey(toUnmute.Id)) { + foreach (var roleId in config.RolesRemovedOnMute[toUnmute.Id]) await toUnmute.AddRoleAsync(roleId); + config.RolesRemovedOnMute.Remove(toUnmute.Id); + await config.Save(); + } + } else { + await toUnmute.RemoveTimeOutAsync(); } await Utils.SilentSendAsync(channel, string.Format(Messages.UnmuteResponse, toUnmute.Mention, @@ -58,4 +72,4 @@ public class UnmuteCommand : Command { public override string GetSummary() { return "Снимает мут с участника"; } -} \ No newline at end of file +} diff --git a/Boyfriend/EventHandler.cs b/Boyfriend/EventHandler.cs index fdae9d2..3ca9897 100644 --- a/Boyfriend/EventHandler.cs +++ b/Boyfriend/EventHandler.cs @@ -23,10 +23,10 @@ public class EventHandler { var i = new Random().Next(3); foreach (var guild in Boyfriend.Client.Guilds) { var config = Boyfriend.GetGuildConfig(guild); - Messages.Culture = new CultureInfo(config.Lang); - var channel = guild.GetTextChannel(config.BotLogChannel); - if (channel == null) continue; - await channel.SendMessageAsync(string.Format(Messages.Ready, Utils.GetBeep(config.Lang, i))); + Messages.Culture = new CultureInfo(config.Lang!); + var channel = guild.GetTextChannel(config.BotLogChannel.GetValueOrDefault(0)); + if (!config.ReceiveStartupMessages.GetValueOrDefault(true) || channel == null) continue; + await channel.SendMessageAsync(string.Format(Messages.Ready, Utils.GetBeep(config.Lang!, i))); } } @@ -48,7 +48,7 @@ public class EventHandler { var argPos = 0; var guildConfig = Boyfriend.GetGuildConfig(guild); - Messages.Culture = new CultureInfo(guildConfig.Lang); + Messages.Culture = new CultureInfo(guildConfig.Lang!); if ((message.MentionedUsers.Count > 3 || message.MentionedRoles.Count > 2) && !user.GuildPermissions.MentionEveryone) await BanCommand.BanUser(guild, null, await guild.GetCurrentUserAsync(), user, @@ -67,7 +67,7 @@ public class EventHandler { if (!(message.HasStringPrefix(guildConfig.Prefix, ref argPos) || message.HasMentionPrefix(Boyfriend.Client.CurrentUser, ref argPos)) || user == await guild.GetCurrentUserAsync() - || user.IsBot && message.Content.Contains(prev) || message.Content.Contains(prevFailsafe)) + || user.IsBot && (message.Content.Contains(prev) || message.Content.Contains(prevFailsafe))) return; await CommandHandler.HandleCommand(message); @@ -91,10 +91,10 @@ public class EventHandler { private static async Task UserJoinedEvent(SocketGuildUser user) { var guild = user.Guild; var config = Boyfriend.GetGuildConfig(guild); - if (config.SendWelcomeMessages) - await Utils.SilentSendAsync(guild.SystemChannel, string.Format(config.WelcomeMessage, user.Mention, + if (config.SendWelcomeMessages.GetValueOrDefault(true)) + await Utils.SilentSendAsync(guild.SystemChannel, string.Format(config.WelcomeMessage!, user.Mention, guild.Name)); if (config.DefaultRole != 0) - await user.AddRoleAsync(Utils.ParseRole(guild, config.DefaultRole.ToString())); + await user.AddRoleAsync(Utils.ParseRole(guild, config.DefaultRole.ToString()!)); } -} \ No newline at end of file +} diff --git a/Boyfriend/GuildConfig.cs b/Boyfriend/GuildConfig.cs index 1238579..6b45aa7 100644 --- a/Boyfriend/GuildConfig.cs +++ b/Boyfriend/GuildConfig.cs @@ -1,40 +1,48 @@ -using System.Text.Json; +using System.Globalization; +using Newtonsoft.Json; namespace Boyfriend; public class GuildConfig { - public ulong Id { get; } - public string Lang { get; set; } - public string Prefix { get; set; } - public bool RemoveRolesOnMute { get; set; } - public bool UseSystemChannel { get; set; } - public bool SendWelcomeMessages { get; set; } - public string WelcomeMessage { get; set; } - public ulong DefaultRole { get; set; } - public ulong MuteRole { get; set; } - public ulong AdminLogChannel { get; set; } - public ulong BotLogChannel { get; set; } - public Dictionary> RolesRemovedOnMute { get; set; } + public ulong? Id { get; } + public string? Lang { get; set; } + public string? Prefix { get; set; } + public bool? RemoveRolesOnMute { get; set; } + public bool? UseSystemChannel { get; set; } + public bool? SendWelcomeMessages { get; set; } + public bool? ReceiveStartupMessages { get; set; } + public string? WelcomeMessage { get; set; } + public ulong? DefaultRole { get; set; } + public ulong? MuteRole { get; set; } + public ulong? AdminLogChannel { get; set; } + public ulong? BotLogChannel { get; set; } + public Dictionary>? RolesRemovedOnMute { get; private set; } - public GuildConfig(ulong id, string lang, string prefix, bool removeRolesOnMute, bool useSystemChannel, - bool sendWelcomeMessages, string welcomeMessage, ulong defaultRole, ulong muteRole, ulong adminLogChannel, - ulong botLogChannel) { + public GuildConfig(ulong id) { Id = id; - Lang = lang; - Prefix = prefix; - RemoveRolesOnMute = removeRolesOnMute; - UseSystemChannel = useSystemChannel; - SendWelcomeMessages = sendWelcomeMessages; - WelcomeMessage = welcomeMessage; - DefaultRole = defaultRole; - MuteRole = muteRole; - AdminLogChannel = adminLogChannel; - BotLogChannel = botLogChannel; - RolesRemovedOnMute = new Dictionary>(); + Validate(); + } + + public void Validate() { + if (Id == null) throw new Exception("Something went horribly, horribly wrong"); + Lang ??= "ru"; + Messages.Culture = new CultureInfo(Lang); + Prefix ??= "!"; + RemoveRolesOnMute ??= false; + UseSystemChannel ??= true; + SendWelcomeMessages ??= true; + ReceiveStartupMessages ??= true; + WelcomeMessage ??= Messages.DefaultWelcomeMessage; + DefaultRole ??= 0; + MuteRole ??= 0; + AdminLogChannel ??= 0; + BotLogChannel ??= 0; + RolesRemovedOnMute ??= new Dictionary>(); } public async Task Save() { - await using var stream = File.OpenWrite("config_" + Id + ".json"); - await JsonSerializer.SerializeAsync(stream, this); + Validate(); + RolesRemovedOnMute!.TrimExcess(); + await File.WriteAllTextAsync("config_" + Id + ".json", JsonConvert.SerializeObject(this)); } -} \ No newline at end of file +} diff --git a/Boyfriend/Messages.Designer.cs b/Boyfriend/Messages.Designer.cs index 6538678..5e7fd44 100644 --- a/Boyfriend/Messages.Designer.cs +++ b/Boyfriend/Messages.Designer.cs @@ -1,6 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -11,32 +12,46 @@ namespace Boyfriend { using System; - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [System.Diagnostics.DebuggerNonUserCodeAttribute()] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Messages { - private static System.Resources.ResourceManager resourceMan; + private static global::System.Resources.ResourceManager resourceMan; - private static System.Globalization.CultureInfo resourceCulture; + private static global::System.Globalization.CultureInfo resourceCulture; - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Messages() { } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Resources.ResourceManager ResourceManager { + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { get { - if (object.Equals(null, resourceMan)) { - System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Boyfriend.Messages", typeof(Messages).Assembly); + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Boyfriend.Messages", typeof(Messages).Assembly); resourceMan = temp; } return resourceMan; } } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Globalization.CultureInfo Culture { + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -45,442 +60,679 @@ namespace Boyfriend { } } - internal static string CouldntFindGuildByChannel { - get { - return ResourceManager.GetString("CouldntFindGuildByChannel", resourceCulture); - } - } - - internal static string Ready { - get { - return ResourceManager.GetString("Ready", resourceCulture); - } - } - - internal static string UncachedMessageDeleted { - get { - return ResourceManager.GetString("UncachedMessageDeleted", resourceCulture); - } - } - - internal static string CachedMessageDeleted { - get { - return ResourceManager.GetString("CachedMessageDeleted", resourceCulture); - } - } - - internal static string AutobanReason { - get { - return ResourceManager.GetString("AutobanReason", resourceCulture); - } - } - - internal static string UncachedMessageEdited { - get { - return ResourceManager.GetString("UncachedMessageEdited", resourceCulture); - } - } - - internal static string CachedMessageEdited { - get { - return ResourceManager.GetString("CachedMessageEdited", resourceCulture); - } - } - - internal static string DefaultWelcomeMessage { - get { - return ResourceManager.GetString("DefaultWelcomeMessage", resourceCulture); - } - } - - internal static string Beep1 { - get { - return ResourceManager.GetString("Beep1", resourceCulture); - } - } - - internal static string Beep2 { - get { - return ResourceManager.GetString("Beep2", resourceCulture); - } - } - - internal static string Beep3 { - get { - return ResourceManager.GetString("Beep3", resourceCulture); - } - } - - internal static string InvalidAdminLogChannel { - get { - return ResourceManager.GetString("InvalidAdminLogChannel", resourceCulture); - } - } - - internal static string MuteRoleRequired { - get { - return ResourceManager.GetString("MuteRoleRequired", resourceCulture); - } - } - - internal static string CommandExecutionUnsuccessful { - get { - return ResourceManager.GetString("CommandExecutionUnsuccessful", resourceCulture); - } - } - - internal static string RepeatedArgumentsDetected { - get { - return ResourceManager.GetString("RepeatedArgumentsDetected", resourceCulture); - } - } - - internal static string CommandParseFailed { - get { - return ResourceManager.GetString("CommandParseFailed", resourceCulture); - } - } - - internal static string UnknownCommand { - get { - return ResourceManager.GetString("UnknownCommand", resourceCulture); - } - } - - internal static string BadArgumentCount { - get { - return ResourceManager.GetString("BadArgumentCount", resourceCulture); - } - } - + /// + /// Looks up a localized string similar to Arguments not present! {0}. + /// internal static string ArgumentNotPresent { get { return ResourceManager.GetString("ArgumentNotPresent", resourceCulture); } } - internal static string CommandNoPermissionBot { + /// + /// Looks up a localized string similar to Too many mentions in 1 message. + /// + internal static string AutobanReason { get { - return ResourceManager.GetString("CommandNoPermissionBot", resourceCulture); + return ResourceManager.GetString("AutobanReason", resourceCulture); } } - internal static string CommandNoPermissionUser { + /// + /// Looks up a localized string similar to Invalid argument count! {0}. + /// + internal static string BadArgumentCount { get { - return ResourceManager.GetString("CommandNoPermissionUser", resourceCulture); - } - } - - internal static string InteractionsDifferentGuilds { - get { - return ResourceManager.GetString("InteractionsDifferentGuilds", resourceCulture); - } - } - - internal static string InteractionsOwner { - get { - return ResourceManager.GetString("InteractionsOwner", resourceCulture); - } - } - - internal static string InteractionsYourself { - get { - return ResourceManager.GetString("InteractionsYourself", resourceCulture); - } - } - - internal static string InteractionsMe { - get { - return ResourceManager.GetString("InteractionsMe", resourceCulture); - } - } - - internal static string InteractionsFailedUser { - get { - return ResourceManager.GetString("InteractionsFailedUser", resourceCulture); - } - } - - internal static string InteractionsFailedBot { - get { - return ResourceManager.GetString("InteractionsFailedBot", resourceCulture); - } - } - - internal static string YouWereBanned { - get { - return ResourceManager.GetString("YouWereBanned", resourceCulture); - } - } - - internal static string UserBanned { - get { - return ResourceManager.GetString("UserBanned", resourceCulture); - } - } - - internal static string PunishmentExpired { - get { - return ResourceManager.GetString("PunishmentExpired", resourceCulture); - } - } - - internal static string ClearNegativeAmount { - get { - return ResourceManager.GetString("ClearNegativeAmount", resourceCulture); - } - } - - internal static string ClearAmountTooLarge { - get { - return ResourceManager.GetString("ClearAmountTooLarge", resourceCulture); - } - } - - internal static string MessagesDeleted { - get { - return ResourceManager.GetString("MessagesDeleted", resourceCulture); - } - } - - internal static string CommandHelp { - get { - return ResourceManager.GetString("CommandHelp", resourceCulture); - } - } - - internal static string YouWereKicked { - get { - return ResourceManager.GetString("YouWereKicked", resourceCulture); - } - } - - internal static string MemberKicked { - get { - return ResourceManager.GetString("MemberKicked", resourceCulture); - } - } - - internal static string MemberMuted { - get { - return ResourceManager.GetString("MemberMuted", resourceCulture); - } - } - - internal static string Milliseconds { - get { - return ResourceManager.GetString("Milliseconds", resourceCulture); - } - } - - internal static string MemberAlreadyMuted { - get { - return ResourceManager.GetString("MemberAlreadyMuted", resourceCulture); - } - } - - internal static string MuteRoleManuallyRemoved { - get { - return ResourceManager.GetString("MuteRoleManuallyRemoved", resourceCulture); - } - } - - internal static string ChannelNotSpecified { - get { - return ResourceManager.GetString("ChannelNotSpecified", resourceCulture); - } - } - - internal static string RoleNotSpecified { - get { - return ResourceManager.GetString("RoleNotSpecified", resourceCulture); - } - } - - internal static string CurrentSettings { - get { - return ResourceManager.GetString("CurrentSettings", resourceCulture); - } - } - - internal static string CurrentSettingsLang { - get { - return ResourceManager.GetString("CurrentSettingsLang", resourceCulture); - } - } - - internal static string CurrentSettingsPrefix { - get { - return ResourceManager.GetString("CurrentSettingsPrefix", resourceCulture); - } - } - - internal static string CurrentSettingsRemoveRoles { - get { - return ResourceManager.GetString("CurrentSettingsRemoveRoles", resourceCulture); - } - } - - internal static string CurrentSettingsUseSystemChannel { - get { - return ResourceManager.GetString("CurrentSettingsUseSystemChannel", resourceCulture); - } - } - - internal static string CurrentSettingsSendWelcomeMessages { - get { - return ResourceManager.GetString("CurrentSettingsSendWelcomeMessages", resourceCulture); - } - } - - internal static string CurrentSettingsDefaultRole { - get { - return ResourceManager.GetString("CurrentSettingsDefaultRole", resourceCulture); - } - } - - internal static string CurrentSettingsMuteRole { - get { - return ResourceManager.GetString("CurrentSettingsMuteRole", resourceCulture); - } - } - - internal static string CurrentSettingsAdminLogChannel { - get { - return ResourceManager.GetString("CurrentSettingsAdminLogChannel", resourceCulture); - } - } - - internal static string CurrentSettingsBotLogChannel { - get { - return ResourceManager.GetString("CurrentSettingsBotLogChannel", resourceCulture); - } - } - - internal static string LanguageNotSupported { - get { - return ResourceManager.GetString("LanguageNotSupported", resourceCulture); - } - } - - internal static string SettingsUpdated { - get { - return ResourceManager.GetString("SettingsUpdated", resourceCulture); - } - } - - internal static string InvalidBoolean { - get { - return ResourceManager.GetString("InvalidBoolean", resourceCulture); - } - } - - internal static string InvalidRoleSpecified { - get { - return ResourceManager.GetString("InvalidRoleSpecified", resourceCulture); - } - } - - internal static string InvalidChannelSpecified { - get { - return ResourceManager.GetString("InvalidChannelSpecified", resourceCulture); - } - } - - internal static string Yes { - get { - return ResourceManager.GetString("Yes", resourceCulture); - } - } - - internal static string No { - get { - return ResourceManager.GetString("No", resourceCulture); - } - } - - internal static string UserNotBanned { - get { - return ResourceManager.GetString("UserNotBanned", resourceCulture); - } - } - - internal static string MemberNotMuted { - get { - return ResourceManager.GetString("MemberNotMuted", resourceCulture); - } - } - - internal static string RolesReturned { - get { - return ResourceManager.GetString("RolesReturned", resourceCulture); - } - } - - internal static string MemberUnmuted { - get { - return ResourceManager.GetString("MemberUnmuted", resourceCulture); - } - } - - internal static string UserUnbanned { - get { - return ResourceManager.GetString("UserUnbanned", resourceCulture); - } - } - - internal static string CurrentSettingsWelcomeMessage { - get { - return ResourceManager.GetString("CurrentSettingsWelcomeMessage", resourceCulture); - } - } - - internal static string NotEnoughArguments { - get { - return ResourceManager.GetString("NotEnoughArguments", resourceCulture); - } - } - - internal static string ClearInvalidAmountSpecified { - get { - return ResourceManager.GetString("ClearInvalidAmountSpecified", resourceCulture); + return ResourceManager.GetString("BadArgumentCount", resourceCulture); } } + /// + /// Looks up a localized string similar to :white_check_mark: Successfully banned {0} for {1}. + /// internal static string BanResponse { get { return ResourceManager.GetString("BanResponse", resourceCulture); } } + /// + /// Looks up a localized string similar to Bah! . + /// + internal static string Beep1 { + get { + return ResourceManager.GetString("Beep1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bop! . + /// + internal static string Beep2 { + get { + return ResourceManager.GetString("Beep2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Beep! . + /// + internal static string Beep3 { + get { + return ResourceManager.GetString("Beep3", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleted message from {0} in channel . + /// + internal static string CachedMessageDeleted { + get { + return ResourceManager.GetString("CachedMessageDeleted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Message edited from {0} in channel {1}.{2}Before:{3}{4}{5}After:{6}{7}. + /// + internal static string CachedMessageEdited { + get { + return ResourceManager.GetString("CachedMessageEdited", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Not specified. + /// + internal static string ChannelNotSpecified { + get { + return ResourceManager.GetString("ChannelNotSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Too many messages specified!. + /// + internal static string ClearAmountTooLarge { + get { + return ResourceManager.GetString("ClearAmountTooLarge", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid message amount specified!. + /// + internal static string ClearInvalidAmountSpecified { + get { + return ResourceManager.GetString("ClearInvalidAmountSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Negative message amount specified!. + /// + internal static string ClearNegativeAmount { + get { + return ResourceManager.GetString("ClearNegativeAmount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Command execution was unsuccessful: {0}. + /// + internal static string CommandExecutionUnsuccessful { + get { + return ResourceManager.GetString("CommandExecutionUnsuccessful", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Command help:{0}. + /// + internal static string CommandHelp { + get { + return ResourceManager.GetString("CommandHelp", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to I do not have permission to execute this command!. + /// + internal static string CommandNoPermissionBot { + get { + return ResourceManager.GetString("CommandNoPermissionBot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You do not have permission to execute this command!. + /// + internal static string CommandNoPermissionUser { + get { + return ResourceManager.GetString("CommandNoPermissionUser", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Command parsing failed: {0}. + /// + internal static string CommandParseFailed { + get { + return ResourceManager.GetString("CommandParseFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Couldn't find guild by message!. + /// + internal static string CouldntFindGuildByChannel { + get { + return ResourceManager.GetString("CouldntFindGuildByChannel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Current settings:{0}. + /// + internal static string CurrentSettings { + get { + return ResourceManager.GetString("CurrentSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Admin log channel (`adminLogChannel`): {0}{1}. + /// + internal static string CurrentSettingsAdminLogChannel { + get { + return ResourceManager.GetString("CurrentSettingsAdminLogChannel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bot log channel (`botLogChannel`): {0}. + /// + internal static string CurrentSettingsBotLogChannel { + get { + return ResourceManager.GetString("CurrentSettingsBotLogChannel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Default role (`defaultRole`): {0}{1}. + /// + internal static string CurrentSettingsDefaultRole { + get { + return ResourceManager.GetString("CurrentSettingsDefaultRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Language (`lang`): `{0}`{1}. + /// + internal static string CurrentSettingsLang { + get { + return ResourceManager.GetString("CurrentSettingsLang", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Mute role (`muteRole`): {0}{1}. + /// + internal static string CurrentSettingsMuteRole { + get { + return ResourceManager.GetString("CurrentSettingsMuteRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Prefix (`prefix`): `{0}`{1}. + /// + internal static string CurrentSettingsPrefix { + get { + return ResourceManager.GetString("CurrentSettingsPrefix", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Receive startup messages (`receiveStartupMessages`): {0}{1}. + /// + internal static string CurrentSettingsReceiveStartupMessages { + get { + return ResourceManager.GetString("CurrentSettingsReceiveStartupMessages", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove roles on mute (`removeRolesOnMute`): {0}{1}. + /// + internal static string CurrentSettingsRemoveRoles { + get { + return ResourceManager.GetString("CurrentSettingsRemoveRoles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Send welcome messages (`sendWelcomeMessages`): {0}{1}. + /// + internal static string CurrentSettingsSendWelcomeMessages { + get { + return ResourceManager.GetString("CurrentSettingsSendWelcomeMessages", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Use system channel for notifications (`useSystemChannel`): {0}{1}. + /// + internal static string CurrentSettingsUseSystemChannel { + get { + return ResourceManager.GetString("CurrentSettingsUseSystemChannel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Welcome message: `{0}`{1}. + /// + internal static string CurrentSettingsWelcomeMessage { + get { + return ResourceManager.GetString("CurrentSettingsWelcomeMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}, welcome to {1}. + /// + internal static string DefaultWelcomeMessage { + get { + return ResourceManager.GetString("DefaultWelcomeMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Members are in different guilds!. + /// + internal static string InteractionsDifferentGuilds { + get { + return ResourceManager.GetString("InteractionsDifferentGuilds", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to I cannot interact with this member!. + /// + internal static string InteractionsFailedBot { + get { + return ResourceManager.GetString("InteractionsFailedBot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You cannot interact with this member!. + /// + internal static string InteractionsFailedUser { + get { + return ResourceManager.GetString("InteractionsFailedUser", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You cannot interact with me!. + /// + internal static string InteractionsMe { + get { + return ResourceManager.GetString("InteractionsMe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You cannot interact with guild owner!. + /// + internal static string InteractionsOwner { + get { + return ResourceManager.GetString("InteractionsOwner", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You cannot interact with yourself!. + /// + internal static string InteractionsYourself { + get { + return ResourceManager.GetString("InteractionsYourself", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid admin log channel for guild. + /// + internal static string InvalidAdminLogChannel { + get { + return ResourceManager.GetString("InvalidAdminLogChannel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid argument! 'true' or 'false' required!. + /// + internal static string InvalidBoolean { + get { + return ResourceManager.GetString("InvalidBoolean", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid channel specified!. + /// + internal static string InvalidChannelSpecified { + get { + return ResourceManager.GetString("InvalidChannelSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid role specified!. + /// + internal static string InvalidRoleSpecified { + get { + return ResourceManager.GetString("InvalidRoleSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to :white_check_mark: Successfully kicked {0} for {1}. + /// internal static string KickResponse { get { return ResourceManager.GetString("KickResponse", resourceCulture); } } - internal static string UserNotInGuild { + /// + /// Looks up a localized string similar to Language not supported!. + /// + internal static string LanguageNotSupported { get { - return ResourceManager.GetString("UserNotInGuild", resourceCulture); + return ResourceManager.GetString("LanguageNotSupported", resourceCulture); } } + /// + /// Looks up a localized string similar to Member is already muted!. + /// + internal static string MemberAlreadyMuted { + get { + return ResourceManager.GetString("MemberAlreadyMuted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} kicked {1} for {2}. + /// + internal static string MemberKicked { + get { + return ResourceManager.GetString("MemberKicked", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} muted {1} for {2}. + /// + internal static string MemberMuted { + get { + return ResourceManager.GetString("MemberMuted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Member not muted!. + /// + internal static string MemberNotMuted { + get { + return ResourceManager.GetString("MemberNotMuted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} unmuted {1} for {2}. + /// + internal static string MemberUnmuted { + get { + return ResourceManager.GetString("MemberUnmuted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} deleted {1} messages in channel {2}. + /// + internal static string MessagesDeleted { + get { + return ResourceManager.GetString("MessagesDeleted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ms. + /// + internal static string Milliseconds { + get { + return ResourceManager.GetString("Milliseconds", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to :white_check_mark: Successfully muted {0} for {1}. + /// internal static string MuteResponse { get { return ResourceManager.GetString("MuteResponse", resourceCulture); } } + /// + /// Looks up a localized string similar to Someone removed the mute role manually!. + /// + internal static string MuteRoleManuallyRemoved { + get { + return ResourceManager.GetString("MuteRoleManuallyRemoved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must set up a mute role in settings!. + /// + internal static string MuteRoleRequired { + get { + return ResourceManager.GetString("MuteRoleRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No. + /// + internal static string No { + get { + return ResourceManager.GetString("No", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Not enough arguments! Needed: {0}, provided: {1}. + /// + internal static string NotEnoughArguments { + get { + return ResourceManager.GetString("NotEnoughArguments", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Punishment expired. + /// + internal static string PunishmentExpired { + get { + return ResourceManager.GetString("PunishmentExpired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}I'm ready! (C#). + /// + internal static string Ready { + get { + return ResourceManager.GetString("Ready", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Repeated arguments detected! {0}. + /// + internal static string RepeatedArgumentsDetected { + get { + return ResourceManager.GetString("RepeatedArgumentsDetected", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Not specified. + /// + internal static string RoleNotSpecified { + get { + return ResourceManager.GetString("RoleNotSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Someone removed the mute role manually! I added back all roles that I removed during the mute. + /// + internal static string RolesReturned { + get { + return ResourceManager.GetString("RolesReturned", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to That setting doesn't exist!. + /// + internal static string SettingDoesntExist { + get { + return ResourceManager.GetString("SettingDoesntExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Settings successfully updated. + /// + internal static string SettingsUpdated { + get { + return ResourceManager.GetString("SettingsUpdated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to :white_check_mark: Successfully unbanned {0} for {1}. + /// internal static string UnbanResponse { get { return ResourceManager.GetString("UnbanResponse", resourceCulture); } } + /// + /// Looks up a localized string similar to Deleted message in {0}, but I forgot what was there. + /// + internal static string UncachedMessageDeleted { + get { + return ResourceManager.GetString("UncachedMessageDeleted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Message edited from {0} in channel {1}, but I forgot what was there before the edit. + /// + internal static string UncachedMessageEdited { + get { + return ResourceManager.GetString("UncachedMessageEdited", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unknown command! {0}. + /// + internal static string UnknownCommand { + get { + return ResourceManager.GetString("UnknownCommand", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to :white_check_mark: Successfully unmuted {0} for {1}. + /// internal static string UnmuteResponse { get { return ResourceManager.GetString("UnmuteResponse", resourceCulture); } } + + /// + /// Looks up a localized string similar to {0} banned {1} for {2}. + /// + internal static string UserBanned { + get { + return ResourceManager.GetString("UserBanned", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User not banned!. + /// + internal static string UserNotBanned { + get { + return ResourceManager.GetString("UserNotBanned", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified user is not a member of this server!. + /// + internal static string UserNotInGuild { + get { + return ResourceManager.GetString("UserNotInGuild", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} unbanned {1} for {2}. + /// + internal static string UserUnbanned { + get { + return ResourceManager.GetString("UserUnbanned", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes. + /// + internal static string Yes { + get { + return ResourceManager.GetString("Yes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You were banned by {0} in guild {1} for {2}. + /// + internal static string YouWereBanned { + get { + return ResourceManager.GetString("YouWereBanned", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You were kicked by {0} in guild {1} for {2}. + /// + internal static string YouWereKicked { + get { + return ResourceManager.GetString("YouWereKicked", resourceCulture); + } + } } } diff --git a/Boyfriend/Messages.resx b/Boyfriend/Messages.resx index bc46f3c..75ee336 100644 --- a/Boyfriend/Messages.resx +++ b/Boyfriend/Messages.resx @@ -243,4 +243,10 @@ :white_check_mark: Successfully unmuted {0} for {1} + + That setting doesn't exist! + + + Receive startup messages (`receiveStartupMessages`): {0}{1} + \ No newline at end of file diff --git a/Boyfriend/Messages.ru.resx b/Boyfriend/Messages.ru.resx index 534cca1..2790d0a 100644 --- a/Boyfriend/Messages.ru.resx +++ b/Boyfriend/Messages.ru.resx @@ -234,4 +234,10 @@ :white_check_mark: Успешно возвращён из мута {0} за {1} + + Такая настройка не существует! + + + Получать сообщения о запуске (`receiveStartupMessages`): {0}{1} + \ No newline at end of file diff --git a/Boyfriend/Utils.cs b/Boyfriend/Utils.cs index b6b981f..eedeaf7 100644 --- a/Boyfriend/Utils.cs +++ b/Boyfriend/Utils.cs @@ -21,7 +21,7 @@ public static class Utils { } public static async Task GetAdminLogChannel(IGuild guild) { - var adminLogChannel = await ParseChannelNullable(Boyfriend.GetGuildConfig(guild).AdminLogChannel.ToString()); + var adminLogChannel = await ParseChannelNullable(Boyfriend.GetGuildConfig(guild).AdminLogChannel.ToString()!); return adminLogChannel as ITextChannel; } @@ -111,4 +111,4 @@ public static class Utils { public static string JoinString(string[] args, int startIndex) { return string.Join(" ", args, startIndex, args.Length - startIndex); } -} \ No newline at end of file +}