geekbot/Geekbot.net/Modules/Cat.cs

30 lines
707 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
{
2017-04-13 13:22:30 +02:00
private readonly ICatClient catClient;
public Cat(ICatClient catClient)
{
this.catClient = catClient;
}
2017-04-12 21:49:04 +02:00
[Command("cat"), Summary("Return a random image of a cat.")]
public async Task Say()
{
var request = new RestRequest("meow.php", Method.GET);
2017-04-13 13:22:30 +02:00
var response = catClient.Client.Execute<CatObject>(request);
2017-04-12 21:49:04 +02:00
await ReplyAsync(response.Data.file);
}
}
public class CatObject
{
public string file {get;set;}
}
}