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

33 lines
893 B
C#
Raw Normal View History

2019-03-17 17:52:07 +01:00
using System;
using System.Threading.Tasks;
using Discord.Commands;
2020-07-15 02:52:13 +02:00
using Geekbot.net.Lib;
2019-03-17 17:52:07 +01:00
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
{
2020-07-15 02:52:13 +02:00
var response = await HttpAbstractions.Get<KanyeResponseDto>(new Uri("https://api.kanye.rest/"));
await ReplyAsync(response.Quote);
2019-03-17 17:52:07 +01:00
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
}
}
}
}