added ~cp command that gets you in jail, and @NadekoBot cry

Also started youtube playlist queue
This commit is contained in:
Master Kwoth 2016-02-02 21:02:09 +01:00
parent 64fdb0c25d
commit b2f43f4f72
2 changed files with 58 additions and 0 deletions

View File

@ -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 => {

View File

@ -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<string> GetVideoIDs(string v) {
List<string> toReturn = new List<string>();
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<string>();
}
}
public string GetDanbooruImageLink(string tag) {
try {
var rng = new Random();