2018-01-07 23:26:20 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Discord.Commands;
|
|
|
|
|
using Geekbot.net.Lib;
|
|
|
|
|
|
|
|
|
|
namespace Geekbot.net.Commands
|
|
|
|
|
{
|
|
|
|
|
public class Gdq : ModuleBase
|
|
|
|
|
{
|
|
|
|
|
private readonly IErrorHandler _errorHandler;
|
|
|
|
|
|
|
|
|
|
public Gdq(IErrorHandler errorHandler)
|
|
|
|
|
{
|
|
|
|
|
_errorHandler = errorHandler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Command("gdq", RunMode = RunMode.Async)]
|
|
|
|
|
[Remarks(CommandCategories.Games)]
|
|
|
|
|
[Summary("Get a quote from the GDQ donation generator.")]
|
2018-04-30 23:44:19 +02:00
|
|
|
|
public async Task GetQuote()
|
2018-01-07 23:26:20 +01:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (var client = new WebClient())
|
|
|
|
|
{
|
|
|
|
|
var url = new Uri("http://taskinoz.com/gdq/api/");
|
|
|
|
|
var response = client.DownloadString(url);
|
|
|
|
|
|
|
|
|
|
await ReplyAsync(response);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
_errorHandler.HandleCommandException(e, Context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|