Cat and dog in embeds, avatar getter gets 1024px instead of 128, urban shows tags

This commit is contained in:
Runebaas 2017-11-11 16:44:47 +01:00
parent 45f289d071
commit 98a0a302df
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
4 changed files with 18 additions and 10 deletions

View file

@ -16,7 +16,7 @@ namespace Geekbot.net.Commands
} }
[Command("avatar", RunMode = RunMode.Async)] [Command("avatar", RunMode = RunMode.Async)]
[Remarks(CommandCategories.Randomness)] [Remarks(CommandCategories.Helpers)]
[Summary("Get someones avatar")] [Summary("Get someones avatar")]
public async Task getAvatar([Remainder, Summary("user")] IUser user = null) public async Task getAvatar([Remainder, Summary("user")] IUser user = null)
{ {
@ -26,7 +26,8 @@ namespace Geekbot.net.Commands
{ {
user = Context.User; user = Context.User;
} }
await ReplyAsync(user.GetAvatarUrl()); var url = user.GetAvatarUrl().Replace("128", "1024");
await ReplyAsync(url);
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Discord;
using Discord.Commands; using Discord.Commands;
using Geekbot.net.Lib; using Geekbot.net.Lib;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -33,7 +34,9 @@ namespace Geekbot.net.Commands
var stringResponse = await response.Content.ReadAsStringAsync(); var stringResponse = await response.Content.ReadAsStringAsync();
var catFile = JsonConvert.DeserializeObject<CatResponse>(stringResponse); var catFile = JsonConvert.DeserializeObject<CatResponse>(stringResponse);
await ReplyAsync(catFile.file); var eb = new EmbedBuilder();
eb.ImageUrl = catFile.file;
await ReplyAsync("", false, eb.Build());
} }
catch (HttpRequestException e) catch (HttpRequestException e)
{ {

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Discord;
using Discord.Commands; using Discord.Commands;
using Geekbot.net.Lib; using Geekbot.net.Lib;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -33,7 +34,9 @@ namespace Geekbot.net.Commands
var stringResponse = await response.Content.ReadAsStringAsync(); var stringResponse = await response.Content.ReadAsStringAsync();
var dogFile = JsonConvert.DeserializeObject<DogResponse>(stringResponse); var dogFile = JsonConvert.DeserializeObject<DogResponse>(stringResponse);
await ReplyAsync(dogFile.url); var eb = new EmbedBuilder();
eb.ImageUrl = dogFile.url;
await ReplyAsync("", false, eb.Build());
} }
catch (HttpRequestException e) catch (HttpRequestException e)
{ {

View file

@ -20,7 +20,7 @@ namespace Geekbot.net.Commands
} }
[Command("urban", RunMode = RunMode.Async)] [Command("urban", RunMode = RunMode.Async)]
[Remarks(CommandCategories.Randomness)] [Remarks(CommandCategories.Helpers)]
[Summary("Lookup something on urban dictionary")] [Summary("Lookup something on urban dictionary")]
public async Task urbanDefine([Remainder, Summary("word")] string word) public async Task urbanDefine([Remainder, Summary("word")] string word)
{ {
@ -42,16 +42,17 @@ namespace Geekbot.net.Commands
var definition = definitions.list.OrderBy(e => e.thumbs_up).First(); var definition = definitions.list.OrderBy(e => e.thumbs_up).First();
var eb = new EmbedBuilder(); var eb = new EmbedBuilder();
eb.Title = definition.word; eb.WithAuthor(new EmbedAuthorBuilder()
{
Name = definition.word,
Url = definition.permalink
});
eb.WithColor(new Color(239,255,0)); eb.WithColor(new Color(239,255,0));
eb.Description = definition.definition; eb.Description = definition.definition;
eb.AddField("Example", definition.example); eb.AddField("Example", definition.example);
eb.AddInlineField("Upvotes", definition.thumbs_up); eb.AddInlineField("Upvotes", definition.thumbs_up);
eb.AddInlineField("Downvotes", definition.thumbs_down); eb.AddInlineField("Downvotes", definition.thumbs_down);
eb.WithFooter(new EmbedFooterBuilder() eb.AddField("Tags", string.Join(", ", definitions.tags));
{
Text = definition.permalink
});
await ReplyAsync("", false, eb.Build()); await ReplyAsync("", false, eb.Build());
} }