diff --git a/NadekoBot/Modules/Conversations.cs b/NadekoBot/Modules/Conversations.cs index 778e703f..12b1d9ab 100644 --- a/NadekoBot/Modules/Conversations.cs +++ b/NadekoBot/Modules/Conversations.cs @@ -199,6 +199,16 @@ namespace NadekoBot.Modules { await e.Send($"{e.Message.MentionedUsers.First().Mention} {pats[new Random().Next(0, pats.Length)]}"); }); + cgb.CreateCommand("cry") + .Description("Tell Nadeko to cry. You are a heartless monster if you use this command.") + .Do(async e => { + string[] pats = new string[] { "http://i.imgur.com/Xg3i1Qy.gif", + "http://i.imgur.com/3K8DRrU.gif", + "http://i.imgur.com/k58BcAv.gif", + "http://i.imgur.com/I2fLXwo.gif" }; + await e.Send($"(•̥́ _•ૅ。)\n{pats[new Random().Next(0, pats.Length)]}"); + }); + cgb.CreateCommand("are you real") .Description("Useless.") .Do(async e => { diff --git a/NadekoBot/Modules/Searches.cs b/NadekoBot/Modules/Searches.cs index 258489dd..bbb2f979 100644 --- a/NadekoBot/Modules/Searches.cs +++ b/NadekoBot/Modules/Searches.cs @@ -8,6 +8,7 @@ using System.Text.RegularExpressions; using Newtonsoft.Json; using Discord.Commands; using NadekoBot.Extensions; +using System.Collections.Generic; namespace NadekoBot.Modules { class Searches : DiscordModule { @@ -125,6 +126,12 @@ namespace NadekoBot.Modules { tag = ""; await e.Send(GetGelbooruImageLink(tag)); }); + cgb.CreateCommand("~cp") + .Description("We all know where this will lead you to.") + .Parameter("anything", ParameterType.Unparsed) + .Do(async e => { + await e.Send("http://i.imgur.com/MZkY1md.jpg"); + }); cgb.CreateCommand("lmgtfy") .Description("Google something for an idiot.") .Parameter("ffs", ParameterType.Unparsed) @@ -230,6 +237,47 @@ namespace NadekoBot.Modules { } } + public static string GetPlaylistIdByKeyword(string v) { + if (NadekoBot.GoogleAPIKey == "" || NadekoBot.GoogleAPIKey == null) { + Console.WriteLine("ERROR: No google api key found. Playing `Never gonna give you up`."); + return string.Empty; + } + try { + WebRequest wr = WebRequest.Create($"https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q={Uri.EscapeDataString(v)}&type=playlist&key={NadekoBot.creds.GoogleAPIKey}"); + + var sr = new StreamReader(wr.GetResponse().GetResponseStream()); + + dynamic obj = JObject.Parse(sr.ReadToEnd()); + string toReturn = obj.items[0].id.playlistId.ToString(); + return toReturn; + } catch (Exception ex) { + Console.WriteLine($"Error in GetPlaylistId: {ex.Message}"); + return string.Empty; + } + } + + public static List GetVideoIDs(string v) { + List toReturn = new List(); + if (NadekoBot.GoogleAPIKey == "" || NadekoBot.GoogleAPIKey == null) { + Console.WriteLine("ERROR: No google api key found. Playing `Never gonna give you up`."); + return toReturn; + } + try { + + WebRequest wr = WebRequest.Create($"https://www.googleapis.com/youtube/v3/playlistItems?part=contentDetails&maxResults={25}&playlistId=PL8lZieNFgOdmrNGTqwjqYJpJ_2nw_O_M2&key={ NadekoBot.creds.GoogleAPIKey }"); + + var sr = new StreamReader(wr.GetResponse().GetResponseStream()); + + dynamic obj = JObject.Parse(sr.ReadToEnd()); + toReturn = "http://www.youtube.com/watch?v=" + obj.items[0].id.playlistId.ToString(); + return toReturn; + } catch (Exception ex) { + Console.WriteLine($"Error in GetPlaylistId: {ex.Message}"); + return new List(); + } + } + + public string GetDanbooruImageLink(string tag) { try { var rng = new Random();