diff --git a/NadekoBot/Classes/JSONModels/Configuration.cs b/NadekoBot/Classes/JSONModels/Configuration.cs index 9b2efb60..217e6a33 100644 --- a/NadekoBot/Classes/JSONModels/Configuration.cs +++ b/NadekoBot/Classes/JSONModels/Configuration.cs @@ -12,14 +12,14 @@ namespace NadekoBot.Classes.JSONModels { 119174277298782216, 143515953525817344 }; - public string[] CryResponses = { + public string[] CryResponses { get; } = { "http://i.imgur.com/Xg3i1Qy.gif", "http://i.imgur.com/3K8DRrU.gif", "http://i.imgur.com/k58BcAv.gif", "http://i.imgur.com/I2fLXwo.gif" }; - public string[] PatResponses = { + public string[] PatResponses { get; } = { "http://i.imgur.com/IiQwK12.gif", "http://i.imgur.com/JCXj8yD.gif", "http://i.imgur.com/qqBl2bm.gif", diff --git a/NadekoBot/Classes/JSONModels/LocalizedStrings.cs b/NadekoBot/Classes/JSONModels/LocalizedStrings.cs new file mode 100644 index 00000000..bd508217 --- /dev/null +++ b/NadekoBot/Classes/JSONModels/LocalizedStrings.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NadekoBot.Classes.JSONModels { + internal class LocalizedStrings { + public string[] Insults { get; } = { + " You are a poop.", " You're a jerk.", + " I will eat you when I get my powers back." + }; + + public string[] Praises = { + " You are cool.", + " You are nice!", + " You did a good job.", + " You did something nice.", + " is awesome!", + " Wow." + }; + } +} diff --git a/NadekoBot/Modules/Conversations.cs b/NadekoBot/Modules/Conversations.cs index 066ce3b7..793e438b 100644 --- a/NadekoBot/Modules/Conversations.cs +++ b/NadekoBot/Modules/Conversations.cs @@ -86,7 +86,7 @@ namespace NadekoBot.Modules { .Description("Shows how long Nadeko has been running for.") .Do(async e => { var time = (DateTime.Now - Process.GetCurrentProcess().StartTime); - var str = "I have been running for " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes."; + var str = string.Format("I have been running for {0} days, {1} hours, and {2} minutes.", time.Days, time.Hours, time.Minutes); await e.Channel.SendMessage(str); }); @@ -132,7 +132,6 @@ namespace NadekoBot.Modules { .Parameter("mention", ParameterType.Required) .Description("Insults @X person.\n**Usage**: @NadekoBot insult @X.") .Do(async e => { - var insults = new List { " You are a poop.", " You're a jerk.", " I will eat you when I get my powers back." }; var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault(); if (u == null) { await e.Channel.SendMessage("Invalid user specified."); @@ -143,20 +142,13 @@ namespace NadekoBot.Modules { await e.Channel.SendMessage("I would never insult my master <3"); return; } - await e.Channel.SendMessage(u.Mention + insults[rng.Next(0, insults.Count)]); + await e.Channel.SendMessage(u.Mention + NadekoBot.Locale.Insults[rng.Next(0, NadekoBot.Locale.Insults.Length)]); }); cgb.CreateCommand("praise") .Description("Praises @X person.\n**Usage**: @NadekoBot praise @X.") .Parameter("mention", ParameterType.Required) .Do(async e => { - var praises = new[] { " You are cool.", - " You are nice!", - " You did a good job.", - " You did something nice.", - " is awesome!", - " Wow."}; - var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault(); if (u == null) { @@ -168,7 +160,7 @@ namespace NadekoBot.Modules { await e.Channel.SendMessage(e.User.Mention + " I don't need your permission to praise my beloved Master <3"); return; } - await e.Channel.SendMessage(u.Mention + praises[rng.Next(0, praises.Length)]); + await e.Channel.SendMessage(u.Mention + NadekoBot.Locale.Praises[rng.Next(0, NadekoBot.Locale.Praises.Length)]); }); cgb.CreateCommand("pat") diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index e76d6ae3..5b199cfd 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -14,11 +14,12 @@ using NadekoBot.Classes.JSONModels; using NadekoBot.Commands; namespace NadekoBot { - public class NadekoBot { + internal class NadekoBot { public static DiscordClient Client; public static bool ForwardMessages = false; public static Credentials Creds { get; set; } public static Configuration Config { get; set; } + public static LocalizedStrings Locale { get; set; } = new LocalizedStrings(); public static string BotMention { get; set; } = ""; private static Channel OwnerPrivateChannel { get; set; } @@ -30,15 +31,13 @@ namespace NadekoBot { try { File.WriteAllText("credentials_example.json", JsonConvert.SerializeObject(new Credentials(), Formatting.Indented)); File.WriteAllText("data/config_example.json", JsonConvert.SerializeObject(new Configuration(), Formatting.Indented)); - } - catch { + } catch { Console.WriteLine("Failed writing credentials_example.json or data/config_example.json"); } try { Config = JsonConvert.DeserializeObject(File.ReadAllText("data/config.json")); - } - catch { + } catch { Console.WriteLine("Failed loading configuration."); } @@ -173,7 +172,7 @@ namespace NadekoBot { if (PollCommand.ActivePolls.SelectMany(kvp => kvp.Key.Users.Select(u => u.Id)).Contains(e.User.Id)) return; if (IsBlackListed(e)) return; - + if (!NadekoBot.Config.DontJoinServers) { try { await (await Client.GetInvite(e.Message.Text)).Accept(); diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index 6893f1de..e2ef4796 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -119,6 +119,7 @@ + diff --git a/NadekoBot/bin/Debug/data/config_example.json b/NadekoBot/bin/Debug/data/config_example.json index 5e1301c2..efe8ee65 100644 --- a/NadekoBot/bin/Debug/data/config_example.json +++ b/NadekoBot/bin/Debug/data/config_example.json @@ -7,5 +7,22 @@ 105309315895693312, 119174277298782216, 143515953525817344 + ], + "CryResponses": [ + "http://i.imgur.com/Xg3i1Qy.gif", + "http://i.imgur.com/3K8DRrU.gif", + "http://i.imgur.com/k58BcAv.gif", + "http://i.imgur.com/I2fLXwo.gif" + ], + "PatResponses": [ + "http://i.imgur.com/IiQwK12.gif", + "http://i.imgur.com/JCXj8yD.gif", + "http://i.imgur.com/qqBl2bm.gif", + "http://i.imgur.com/eOJlnwP.gif", + "https://45.media.tumblr.com/229ec0458891c4dcd847545c81e760a5/tumblr_mpfy232F4j1rxrpjzo1_r2_500.gif", + "https://media.giphy.com/media/KZQlfylo73AMU/giphy.gif", + "https://media.giphy.com/media/12hvLuZ7uzvCvK/giphy.gif", + "http://gallery1.anivide.com/_full/65030_1382582341.gif", + "https://49.media.tumblr.com/8e8a099c4eba22abd3ec0f70fd087cce/tumblr_nxovj9oY861ur1mffo1_500.gif " ] } \ No newline at end of file