diff --git a/NadekoBot/Classes/JSONModels/LocalizedStrings.cs b/NadekoBot/Classes/JSONModels/LocalizedStrings.cs index bd508217..7c21eaf2 100644 --- a/NadekoBot/Classes/JSONModels/LocalizedStrings.cs +++ b/NadekoBot/Classes/JSONModels/LocalizedStrings.cs @@ -1,17 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.IO; namespace NadekoBot.Classes.JSONModels { internal class LocalizedStrings { - public string[] Insults { get; } = { + public string[] Insults { get; set; } = { " You are a poop.", " You're a jerk.", " I will eat you when I get my powers back." }; - public string[] Praises = { + public string[] Praises { get; set; } = { " You are cool.", " You are nice!", " You did a good job.", @@ -19,5 +15,36 @@ namespace NadekoBot.Classes.JSONModels { " is awesome!", " Wow." }; + + public static string[] GetAvailableLocales() { + Directory.CreateDirectory("data/locales"); + return Directory.GetFiles("data/locales"); + } + + //public static void HandleLocalization() { + // var locales = LocalizedStrings.GetAvailableLocales(); + + + // Console.WriteLine("Pick a language:\n" + + // "1. English"); + // for (var i = 0; i < locales.Length; i++) { + // Console.WriteLine((i + 2) + ". " + Path.GetFileNameWithoutExtension(locales[i])); + // } + // File.WriteAllText("data/locales/english.json", JsonConvert.SerializeObject(new LocalizedStrings(), Formatting.Indented)); + // try { + // Console.WriteLine($"Type in a number from {1} to {locales.Length + 1}\n"); + // var input = Console.ReadLine(); + // if (input != "1") + // Locale = LocalizedStrings.LoadLocale(locales[int.Parse(input) - 2]); + // } catch (Exception ex) { + // Console.ForegroundColor = ConsoleColor.Red; + // Console.WriteLine(ex); + // Console.ReadKey(); + // return; + // } + //} + + public static LocalizedStrings LoadLocale(string localeFile) => + Newtonsoft.Json.JsonConvert.DeserializeObject(File.ReadAllText(localeFile)); } } diff --git a/NadekoBot/Commands/StreamNotifications.cs b/NadekoBot/Commands/StreamNotifications.cs index 853c3773..9e61967a 100644 --- a/NadekoBot/Commands/StreamNotifications.cs +++ b/NadekoBot/Commands/StreamNotifications.cs @@ -118,7 +118,7 @@ namespace NadekoBot.Commands { NadekoBot.Config.ObservingStreams.Remove(toRemove); ConfigHandler.SaveConfig(); - await e.Channel.SendMessage($":ok: Removed `{toRemove.Username}`'s stream from hitbox notifications"); + await e.Channel.SendMessage($":ok: Removed `{toRemove.Username}`'s stream from notifications."); }); cgb.CreateCommand(Module.Prefix + "liststreams") diff --git a/NadekoBot/Modules/Conversations.cs b/NadekoBot/Modules/Conversations.cs index 64c3b3df..7d74a4f2 100644 --- a/NadekoBot/Modules/Conversations.cs +++ b/NadekoBot/Modules/Conversations.cs @@ -30,6 +30,7 @@ namespace NadekoBot.Modules { cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance); cgb.CreateCommand("e") + .Description("You did it.") .Do(async e => { await e.Channel.SendMessage($"{e.User.Name} did it. 😒 🔫"); }); @@ -305,7 +306,7 @@ namespace NadekoBot.Modules { }); cgb.CreateCommand("bb") - .Description("Says bye to someone. **Usage**: @NadekoBot bb @X") + .Description("Says bye to someone.\n**Usage**: @NadekoBot bb @X") .Parameter("ppl", ParameterType.Unparsed) .Do(async e => { var str = "Bye"; @@ -375,7 +376,7 @@ namespace NadekoBot.Modules { cgb.CreateCommand("av").Alias("avatar") .Parameter("mention", ParameterType.Required) - .Description("Shows a mentioned person's avatar. **Usage**: ~av @X") + .Description("Shows a mentioned person's avatar.\n**Usage**: ~av @X") .Do(async e => { var usr = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault(); if (usr == null) { diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index bb205f59..2be8faad 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -7,6 +7,7 @@ using NadekoBot.Modules; using Discord.Modules; using Discord.Audio; using System.Linq; +using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; using NadekoBot.Classes.JSONModels; @@ -24,6 +25,7 @@ namespace NadekoBot { private static void Main() { Console.OutputEncoding = Encoding.Unicode; + // generate credentials example so people can know about the changes i make try { File.WriteAllText("credentials_example.json", JsonConvert.SerializeObject(new Credentials(), Formatting.Indented)); @@ -163,8 +165,6 @@ namespace NadekoBot { public static bool IsOwner(ulong id) => Creds.OwnerIds.Contains(id); - public static bool IsOwner(User u) => IsOwner(u.Id); - public async Task SendMessageToOwner(string message) { if (Config.ForwardMessages && OwnerPrivateChannel != null) await OwnerPrivateChannel.SendMessage(message);