2017-11-11 16:20:26 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Discord;
|
|
|
|
|
using Discord.Commands;
|
|
|
|
|
using Geekbot.net.Lib;
|
2018-05-03 00:56:06 +02:00
|
|
|
|
using Geekbot.net.Lib.ErrorHandling;
|
2017-11-11 16:20:26 +01:00
|
|
|
|
|
2018-05-03 00:56:06 +02:00
|
|
|
|
namespace Geekbot.net.Commands.Utils
|
2017-11-11 16:20:26 +01:00
|
|
|
|
{
|
|
|
|
|
public class AvatarGetter : ModuleBase
|
|
|
|
|
{
|
|
|
|
|
private readonly IErrorHandler _errorHandler;
|
2017-12-29 01:53:50 +01:00
|
|
|
|
|
2017-11-11 16:20:26 +01:00
|
|
|
|
public AvatarGetter(IErrorHandler errorHandler)
|
|
|
|
|
{
|
|
|
|
|
_errorHandler = errorHandler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Command("avatar", RunMode = RunMode.Async)]
|
|
|
|
|
[Summary("Get someones avatar")]
|
2018-04-30 23:44:19 +02:00
|
|
|
|
public async Task GetAvatar([Remainder] [Summary("user")] IUser user = null)
|
2017-11-11 16:20:26 +01:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2017-12-29 01:53:50 +01:00
|
|
|
|
if (user == null) user = Context.User;
|
2017-11-11 16:44:47 +01:00
|
|
|
|
var url = user.GetAvatarUrl().Replace("128", "1024");
|
|
|
|
|
await ReplyAsync(url);
|
2017-11-11 16:20:26 +01:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
_errorHandler.HandleCommandException(e, Context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|