2017-09-14 22:11:19 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Discord.Commands;
|
|
|
|
|
using RestSharp;
|
|
|
|
|
|
|
|
|
|
namespace Geekbot.net.Modules
|
|
|
|
|
{
|
|
|
|
|
public class Dog : ModuleBase
|
|
|
|
|
{
|
2017-09-15 22:56:03 +02:00
|
|
|
|
[Command("dog", RunMode = RunMode.Async)]
|
|
|
|
|
[Summary("Return a random image of a dog.")]
|
2017-09-14 22:11:19 +02:00
|
|
|
|
public async Task Say()
|
|
|
|
|
{
|
|
|
|
|
var dogClient = new RestClient("http://random.dog");
|
|
|
|
|
var request = new RestRequest("woof.json", Method.GET);
|
|
|
|
|
Console.WriteLine(dogClient.BaseUrl);
|
|
|
|
|
|
2017-09-15 22:56:03 +02:00
|
|
|
|
dogClient.ExecuteAsync<DogResponse>(request, async response => { await ReplyAsync(response.Data.url); });
|
2017-09-14 22:11:19 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DogResponse
|
|
|
|
|
{
|
|
|
|
|
public string url { get; set; }
|
|
|
|
|
}
|
2017-05-06 20:35:31 +02:00
|
|
|
|
}
|