geekbot/Geekbot.net/Modules/Cat.cs

25 lines
634 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 23:20:05 +02:00
dynamic response = catClient.Client.Execute<dynamic>(request);
await ReplyAsync(response.Data["file"]);
2017-04-12 21:49:04 +02:00
}
}
}