Fixed ~revav

This commit is contained in:
Kwoth 2016-10-19 12:59:17 +02:00
parent 13bac49acc
commit 7d4db46fe7

View File

@ -335,18 +335,12 @@ $@"🌍 **Weather for** 【{obj["target"]}】
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Revav(IUserMessage umsg, [Remainder] string arg = null) public async Task Revav(IUserMessage umsg, [Remainder] IUser usr = null)
{ {
var channel = (ITextChannel)umsg.Channel; var channel = (ITextChannel)umsg.Channel;
var usrStr = arg?.Trim().ToUpperInvariant();
if (string.IsNullOrWhiteSpace(usrStr)) if (usr == null)
return; usr = umsg.Author;
var usr = channel.Guild.GetUsers().Where(u => u.Username.ToUpperInvariant() == usrStr).FirstOrDefault();
if (usr == null || string.IsNullOrWhiteSpace(usr.AvatarUrl))
return;
await channel.SendMessageAsync($"https://images.google.com/searchbyimage?image_url={usr.AvatarUrl}").ConfigureAwait(false); await channel.SendMessageAsync($"https://images.google.com/searchbyimage?image_url={usr.AvatarUrl}").ConfigureAwait(false);
} }