geekbot/Geekbot.net/Modules/Cat.cs

24 lines
667 B
C#
Raw Normal View History

2017-09-15 22:56:03 +02:00
using System.Threading.Tasks;
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.")]
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); });
}
}
public class CatResponse
{
public string file { get; set; }
}
2017-04-12 21:49:04 +02:00
}