moved extensions to a separate module, added lmgtfy
This commit is contained in:
parent
eac933e4ec
commit
40227a175a
@ -6,8 +6,9 @@ using System.Security.Cryptography;
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Legacy;
|
using Discord.Legacy;
|
||||||
|
using NadekoBot.Modules;
|
||||||
|
|
||||||
namespace NadekoBot
|
namespace NadekoBot.Extensions
|
||||||
{
|
{
|
||||||
public static class Extensions
|
public static class Extensions
|
||||||
{
|
{
|
||||||
@ -113,6 +114,16 @@ namespace NadekoBot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shortens a string URL
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="action"></param>
|
||||||
|
public static string ShortenUrl(this string str) {
|
||||||
|
return Searches.ShortenUrl(str);
|
||||||
|
}
|
||||||
|
|
||||||
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action) {
|
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action) {
|
||||||
foreach (T element in source) {
|
foreach (T element in source) {
|
||||||
action(element);
|
action(element);
|
||||||
|
@ -8,7 +8,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using Discord.Legacy;
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot
|
namespace NadekoBot
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.Legacy;
|
using Discord.Legacy;
|
||||||
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot
|
namespace NadekoBot
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using Discord.Legacy;
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot
|
namespace NadekoBot
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using System.Drawing;
|
|||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Discord.Legacy;
|
using Discord.Legacy;
|
||||||
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot
|
namespace NadekoBot
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.Legacy;
|
using NadekoBot.Extensions;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace NadekoBot
|
namespace NadekoBot
|
||||||
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using Discord.Commands.Permissions.Visibility;
|
using Discord.Commands.Permissions.Visibility;
|
||||||
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot.Modules
|
namespace NadekoBot.Modules
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using Discord.Legacy;
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot.Modules
|
namespace NadekoBot.Modules
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using Discord.Legacy;
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot.Modules
|
namespace NadekoBot.Modules
|
||||||
{
|
{
|
||||||
|
@ -3,18 +3,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Audio;
|
using Discord.Audio;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using YoutubeExtractor;
|
using YoutubeExtractor;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Discord.Legacy;
|
using NadekoBot.Extensions;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
@ -196,7 +194,7 @@ namespace NadekoBot.Modules {
|
|||||||
.OrderByDescending(v => v.AudioBitrate).FirstOrDefault();
|
.OrderByDescending(v => v.AudioBitrate).FirstOrDefault();
|
||||||
|
|
||||||
if (video == null)
|
if (video == null)
|
||||||
throw new Exception("Could not load any video elements"); // First one
|
throw new Exception("Could not load any video elements");
|
||||||
|
|
||||||
StreamUrl = video.DownloadUrl;
|
StreamUrl = video.DownloadUrl;
|
||||||
Title = video.Title;
|
Title = video.Title;
|
||||||
|
@ -1,19 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Reflection;
|
|
||||||
using System.Xml;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Net.Http;
|
|
||||||
using Discord.Legacy;
|
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot.Modules
|
namespace NadekoBot.Modules
|
||||||
{
|
{
|
||||||
@ -109,6 +103,13 @@ namespace NadekoBot.Modules
|
|||||||
await e.Send("This feature is being reconstructed.");
|
await e.Send("This feature is being reconstructed.");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
cgb.CreateCommand("lmgtfy")
|
||||||
|
.Description("Google something for an idiot.")
|
||||||
|
.Parameter("ffs", ParameterType.Unparsed)
|
||||||
|
.Do(async e => {
|
||||||
|
if (e.GetArg("ffs") == null || e.GetArg("ffs").Length < 1) return;
|
||||||
|
await e.Send($"http://lmgtfy.com/?q={ Uri.EscapeUriString(e.GetArg("ffs").ToString()) }".ShortenUrl());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using Manatee.Trello.ManateeJson;
|
using Manatee.Trello.ManateeJson;
|
||||||
using Manatee.Trello;
|
using Manatee.Trello;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot.Modules {
|
namespace NadekoBot.Modules {
|
||||||
class Trello : DiscordModule {
|
class Trello : DiscordModule {
|
||||||
|
@ -7,7 +7,7 @@ using Discord.Commands;
|
|||||||
using NadekoBot.Modules;
|
using NadekoBot.Modules;
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using Discord.Audio;
|
using Discord.Audio;
|
||||||
using System.Threading.Tasks;
|
using NadekoBot.Extensions;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using Discord.Legacy;
|
using NadekoBot.Extensions;
|
||||||
|
|
||||||
namespace NadekoBot
|
namespace NadekoBot
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user