Code improvements

This commit is contained in:
dboerlage 2017-04-13 13:22:30 +02:00
parent d3662b9934
commit ec5d403597
No known key found for this signature in database
GPG key ID: BDA07B7D3FCF147F
5 changed files with 53 additions and 14 deletions

View file

@ -7,14 +7,18 @@ namespace Geekbot.net.Modules
{
public class Cat : ModuleBase
{
private readonly ICatClient catClient;
public Cat(ICatClient catClient)
{
this.catClient = catClient;
}
[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);
var response = catClient.Client.Execute<CatObject>(request);
await ReplyAsync(response.Data.file);
}
}