cry/pat now in config.

This commit is contained in:
Master Kwoth 2016-03-04 18:58:19 +01:00
parent bc0da6e8c2
commit 97867b6118
6 changed files with 51 additions and 19 deletions

View File

@ -12,14 +12,14 @@ namespace NadekoBot.Classes.JSONModels {
119174277298782216, 119174277298782216,
143515953525817344 143515953525817344
}; };
public string[] CryResponses = { public string[] CryResponses { get; } = {
"http://i.imgur.com/Xg3i1Qy.gif", "http://i.imgur.com/Xg3i1Qy.gif",
"http://i.imgur.com/3K8DRrU.gif", "http://i.imgur.com/3K8DRrU.gif",
"http://i.imgur.com/k58BcAv.gif", "http://i.imgur.com/k58BcAv.gif",
"http://i.imgur.com/I2fLXwo.gif" "http://i.imgur.com/I2fLXwo.gif"
}; };
public string[] PatResponses = { public string[] PatResponses { get; } = {
"http://i.imgur.com/IiQwK12.gif", "http://i.imgur.com/IiQwK12.gif",
"http://i.imgur.com/JCXj8yD.gif", "http://i.imgur.com/JCXj8yD.gif",
"http://i.imgur.com/qqBl2bm.gif", "http://i.imgur.com/qqBl2bm.gif",

View File

@ -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."
};
}
}

View File

@ -86,7 +86,7 @@ namespace NadekoBot.Modules {
.Description("Shows how long Nadeko has been running for.") .Description("Shows how long Nadeko has been running for.")
.Do(async e => { .Do(async e => {
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime); 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); await e.Channel.SendMessage(str);
}); });
@ -132,7 +132,6 @@ namespace NadekoBot.Modules {
.Parameter("mention", ParameterType.Required) .Parameter("mention", ParameterType.Required)
.Description("Insults @X person.\n**Usage**: @NadekoBot insult @X.") .Description("Insults @X person.\n**Usage**: @NadekoBot insult @X.")
.Do(async e => { .Do(async e => {
var insults = new List<string> { " 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(); var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault();
if (u == null) { if (u == null) {
await e.Channel.SendMessage("Invalid user specified."); 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"); await e.Channel.SendMessage("I would never insult my master <3");
return; 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") cgb.CreateCommand("praise")
.Description("Praises @X person.\n**Usage**: @NadekoBot praise @X.") .Description("Praises @X person.\n**Usage**: @NadekoBot praise @X.")
.Parameter("mention", ParameterType.Required) .Parameter("mention", ParameterType.Required)
.Do(async e => { .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(); var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault();
if (u == null) { 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"); await e.Channel.SendMessage(e.User.Mention + " I don't need your permission to praise my beloved Master <3");
return; 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") cgb.CreateCommand("pat")

View File

@ -14,11 +14,12 @@ using NadekoBot.Classes.JSONModels;
using NadekoBot.Commands; using NadekoBot.Commands;
namespace NadekoBot { namespace NadekoBot {
public class NadekoBot { internal class NadekoBot {
public static DiscordClient Client; public static DiscordClient Client;
public static bool ForwardMessages = false; public static bool ForwardMessages = false;
public static Credentials Creds { get; set; } public static Credentials Creds { get; set; }
public static Configuration Config { get; set; } public static Configuration Config { get; set; }
public static LocalizedStrings Locale { get; set; } = new LocalizedStrings();
public static string BotMention { get; set; } = ""; public static string BotMention { get; set; } = "";
private static Channel OwnerPrivateChannel { get; set; } private static Channel OwnerPrivateChannel { get; set; }
@ -30,15 +31,13 @@ namespace NadekoBot {
try { try {
File.WriteAllText("credentials_example.json", JsonConvert.SerializeObject(new Credentials(), Formatting.Indented)); File.WriteAllText("credentials_example.json", JsonConvert.SerializeObject(new Credentials(), Formatting.Indented));
File.WriteAllText("data/config_example.json", JsonConvert.SerializeObject(new Configuration(), 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"); Console.WriteLine("Failed writing credentials_example.json or data/config_example.json");
} }
try { try {
Config = JsonConvert.DeserializeObject<Configuration>(File.ReadAllText("data/config.json")); Config = JsonConvert.DeserializeObject<Configuration>(File.ReadAllText("data/config.json"));
} } catch {
catch {
Console.WriteLine("Failed loading configuration."); 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 (PollCommand.ActivePolls.SelectMany(kvp => kvp.Key.Users.Select(u => u.Id)).Contains(e.User.Id)) return;
if (IsBlackListed(e)) if (IsBlackListed(e))
return; return;
if (!NadekoBot.Config.DontJoinServers) { if (!NadekoBot.Config.DontJoinServers) {
try { try {
await (await Client.GetInvite(e.Message.Text)).Accept(); await (await Client.GetInvite(e.Message.Text)).Accept();

View File

@ -119,6 +119,7 @@
<Compile Include="Classes\FlowersHandler.cs" /> <Compile Include="Classes\FlowersHandler.cs" />
<Compile Include="Classes\JSONModels\AnimeResult.cs" /> <Compile Include="Classes\JSONModels\AnimeResult.cs" />
<Compile Include="Classes\JSONModels\Configuration.cs" /> <Compile Include="Classes\JSONModels\Configuration.cs" />
<Compile Include="Classes\JSONModels\LocalizedStrings.cs" />
<Compile Include="Classes\JSONModels\MangaResult.cs" /> <Compile Include="Classes\JSONModels\MangaResult.cs" />
<Compile Include="Classes\JSONModels\_JSONModels.cs" /> <Compile Include="Classes\JSONModels\_JSONModels.cs" />
<Compile Include="Classes\Music\MusicControls.cs" /> <Compile Include="Classes\Music\MusicControls.cs" />

View File

@ -7,5 +7,22 @@
105309315895693312, 105309315895693312,
119174277298782216, 119174277298782216,
143515953525817344 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 "
] ]
} }