geekbot/Geekbot.net/Modules/Cat.cs

26 lines
611 B
C#
Raw Normal View History

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