2017-09-15 22:56:03 +02:00
|
|
|
|
using System.Threading.Tasks;
|
2017-09-14 22:11:19 +02:00
|
|
|
|
using Discord.Commands;
|
|
|
|
|
using RestSharp;
|
|
|
|
|
|
|
|
|
|
namespace Geekbot.net.Modules
|
|
|
|
|
{
|
|
|
|
|
public class Cat : ModuleBase
|
|
|
|
|
{
|
2017-09-15 22:56:03 +02:00
|
|
|
|
[Command("cat", RunMode = RunMode.Async)]
|
|
|
|
|
[Summary("Return a random image of a cat.")]
|
2017-09-14 22:11:19 +02:00
|
|
|
|
public async Task Say()
|
|
|
|
|
{
|
|
|
|
|
var catClient = new RestClient("http://random.cat");
|
|
|
|
|
var request = new RestRequest("meow.php", Method.GET);
|
|
|
|
|
|
2017-09-15 22:56:03 +02:00
|
|
|
|
catClient.ExecuteAsync<CatResponse>(request, async response => { await ReplyAsync(response.Data.file); });
|
2017-09-14 22:11:19 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class CatResponse
|
|
|
|
|
{
|
|
|
|
|
public string file { get; set; }
|
|
|
|
|
}
|
2017-04-12 21:49:04 +02:00
|
|
|
|
}
|