summaryrefslogtreecommitdiff
path: root/DiscoBot/Auxiliary/CommandExtension.cs
diff options
context:
space:
mode:
Diffstat (limited to 'DiscoBot/Auxiliary/CommandExtension.cs')
-rw-r--r--DiscoBot/Auxiliary/CommandExtension.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/DiscoBot/Auxiliary/CommandExtension.cs b/DiscoBot/Auxiliary/CommandExtension.cs
index 973bafa..e19149b 100644
--- a/DiscoBot/Auxiliary/CommandExtension.cs
+++ b/DiscoBot/Auxiliary/CommandExtension.cs
@@ -3,7 +3,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
+ using System.IO;
using System.Linq;
+ using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -13,6 +15,8 @@
public static class CommandExtension
{
+ private static WebClient client;
+
public static async Task ReplyTimedAsync(this ModuleBase m, string message, TimeSpan time)
{
var token = message.GetHashCode();
@@ -95,5 +99,16 @@
await m.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90));
}
+
+ public static async Task SendWebFile(this IMessageChannel channel, string url = "https://i.imgur.com/0iHEycJ.png")
+ {
+ if (client == null)
+ {
+ client = new WebClient();
+ }
+
+ Stream stream = client.OpenRead(url);
+ await channel.SendFileAsync(stream, url.Split('/').Last());
+ }
}
}