geekbot/Geekbot.net/Commands/Randomness/Kanye/Kanye.cs

33 lines
No EOL
893 B
C#

using System;
using System.Threading.Tasks;
using Discord.Commands;
using Geekbot.net.Lib;
using Geekbot.net.Lib.ErrorHandling;
namespace Geekbot.net.Commands.Randomness.Kanye
{
public class Kanye : ModuleBase
{
private readonly IErrorHandler _errorHandler;
public Kanye(IErrorHandler errorHandler)
{
_errorHandler = errorHandler;
}
[Command("kanye", RunMode = RunMode.Async)]
[Summary("A random kayne west quote")]
public async Task Say()
{
try
{
var response = await HttpAbstractions.Get<KanyeResponseDto>(new Uri("https://api.kanye.rest/"));
await ReplyAsync(response.Quote);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
}
}
}
}