diff --git a/Geekbot.net/Commands/Admin/Mod.cs b/Geekbot.net/Commands/Admin/Mod.cs index 6f79157..7551a47 100644 --- a/Geekbot.net/Commands/Admin/Mod.cs +++ b/Geekbot.net/Commands/Admin/Mod.cs @@ -6,6 +6,7 @@ using Discord.Commands; using Discord.WebSocket; using Geekbot.net.Lib; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using Geekbot.net.Lib.UserRepository; using StackExchange.Redis; diff --git a/Geekbot.net/Commands/Games/Overwatch.cs b/Geekbot.net/Commands/Games/Overwatch.cs index 73e5858..bda75b3 100644 --- a/Geekbot.net/Commands/Games/Overwatch.cs +++ b/Geekbot.net/Commands/Games/Overwatch.cs @@ -4,6 +4,7 @@ using Discord; using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using Geekbot.net.Lib.UserRepository; using OverwatchAPI; using OverwatchAPI.Config; diff --git a/Geekbot.net/Commands/Games/Pokedex.cs b/Geekbot.net/Commands/Games/Pokedex.cs index 57f842a..780c564 100644 --- a/Geekbot.net/Commands/Games/Pokedex.cs +++ b/Geekbot.net/Commands/Games/Pokedex.cs @@ -5,6 +5,7 @@ using Discord; using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using PokeAPI; namespace Geekbot.net.Commands.Games diff --git a/Geekbot.net/Commands/Integrations/MagicTheGathering.cs b/Geekbot.net/Commands/Integrations/MagicTheGathering.cs index 3074803..8ecefd2 100644 --- a/Geekbot.net/Commands/Integrations/MagicTheGathering.cs +++ b/Geekbot.net/Commands/Integrations/MagicTheGathering.cs @@ -7,6 +7,7 @@ using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.Converters; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using MtgApiManager.Lib.Service; namespace Geekbot.net.Commands.Integrations diff --git a/Geekbot.net/Commands/Integrations/Mal.cs b/Geekbot.net/Commands/Integrations/Mal.cs index d70949a..eee5782 100644 --- a/Geekbot.net/Commands/Integrations/Mal.cs +++ b/Geekbot.net/Commands/Integrations/Mal.cs @@ -6,6 +6,7 @@ using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.Clients; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; namespace Geekbot.net.Commands.Integrations { diff --git a/Geekbot.net/Commands/Integrations/UbranDictionary/UrbanDictionary.cs b/Geekbot.net/Commands/Integrations/UbranDictionary/UrbanDictionary.cs index 44402d0..9d99885 100644 --- a/Geekbot.net/Commands/Integrations/UbranDictionary/UrbanDictionary.cs +++ b/Geekbot.net/Commands/Integrations/UbranDictionary/UrbanDictionary.cs @@ -6,6 +6,7 @@ using Discord; using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using Newtonsoft.Json; namespace Geekbot.net.Commands.Integrations.UbranDictionary diff --git a/Geekbot.net/Commands/Randomness/RandomAnimals.cs b/Geekbot.net/Commands/Randomness/RandomAnimals.cs index a96aea8..0e3b81d 100644 --- a/Geekbot.net/Commands/Randomness/RandomAnimals.cs +++ b/Geekbot.net/Commands/Randomness/RandomAnimals.cs @@ -73,11 +73,9 @@ namespace Geekbot.net.Commands.Randomness await ReplyAsync("", false, Eb(_mediaProvider.GetFox())); } - private EmbedBuilder Eb(string image) + private Embed Eb(string image) { - var eb = new EmbedBuilder(); - eb.ImageUrl = image; - return eb; + return new EmbedBuilder {ImageUrl = image}.Build(); } } } \ No newline at end of file diff --git a/Geekbot.net/Commands/User/GuildInfo.cs b/Geekbot.net/Commands/User/GuildInfo.cs index 6306a76..18618d7 100644 --- a/Geekbot.net/Commands/User/GuildInfo.cs +++ b/Geekbot.net/Commands/User/GuildInfo.cs @@ -5,6 +5,7 @@ using Discord; using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using Geekbot.net.Lib.Levels; using StackExchange.Redis; diff --git a/Geekbot.net/Commands/User/Karma.cs b/Geekbot.net/Commands/User/Karma.cs index d6244a8..6290dc4 100644 --- a/Geekbot.net/Commands/User/Karma.cs +++ b/Geekbot.net/Commands/User/Karma.cs @@ -4,6 +4,7 @@ using Discord; using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using Geekbot.net.Lib.Localization; using StackExchange.Redis; diff --git a/Geekbot.net/Commands/User/Stats.cs b/Geekbot.net/Commands/User/Stats.cs index 19a6aa8..476d643 100644 --- a/Geekbot.net/Commands/User/Stats.cs +++ b/Geekbot.net/Commands/User/Stats.cs @@ -4,6 +4,7 @@ using Discord; using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using Geekbot.net.Lib.Levels; using StackExchange.Redis; diff --git a/Geekbot.net/Commands/Utils/Info.cs b/Geekbot.net/Commands/Utils/Info.cs index de34e89..467b9d3 100644 --- a/Geekbot.net/Commands/Utils/Info.cs +++ b/Geekbot.net/Commands/Utils/Info.cs @@ -7,6 +7,7 @@ using Discord.Commands; using Discord.WebSocket; using Geekbot.net.Lib; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using StackExchange.Redis; namespace Geekbot.net.Commands.Utils diff --git a/Geekbot.net/Commands/Utils/Poll/Poll.cs b/Geekbot.net/Commands/Utils/Poll/Poll.cs index 5d18a0f..b32a7c9 100644 --- a/Geekbot.net/Commands/Utils/Poll/Poll.cs +++ b/Geekbot.net/Commands/Utils/Poll/Poll.cs @@ -8,6 +8,7 @@ using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.Converters; using Geekbot.net.Lib.ErrorHandling; +using Geekbot.net.Lib.Extensions; using Geekbot.net.Lib.UserRepository; using Newtonsoft.Json; using StackExchange.Redis; diff --git a/Geekbot.net/Commands/Utils/Quote/Quote.cs b/Geekbot.net/Commands/Utils/Quote/Quote.cs index 7a25b50..84eec26 100644 --- a/Geekbot.net/Commands/Utils/Quote/Quote.cs +++ b/Geekbot.net/Commands/Utils/Quote/Quote.cs @@ -189,12 +189,11 @@ namespace Geekbot.net.Commands.Utils.Quote try { var list = Context.Channel.GetMessagesAsync().Flatten(); - await list; - return list.Result - .First(msg => msg.Author.Id == user.Id - && msg.Embeds.Count == 0 - && msg.Id != Context.Message.Id - && !msg.Content.ToLower().StartsWith("!")); + return await list.FirstOrDefault(msg => + msg.Author.Id == user.Id && + msg.Embeds.Count == 0 && + msg.Id != Context.Message.Id && + !msg.Content.ToLower().StartsWith("!")); } catch { diff --git a/Geekbot.net/Geekbot.net.csproj b/Geekbot.net/Geekbot.net.csproj index 90ff896..81f3a6c 100755 --- a/Geekbot.net/Geekbot.net.csproj +++ b/Geekbot.net/Geekbot.net.csproj @@ -15,7 +15,7 @@ - 1.0.2 + 2.0.0-beta diff --git a/Geekbot.net/Lib/Extensions/EmbedBuilderExtensions.cs b/Geekbot.net/Lib/Extensions/EmbedBuilderExtensions.cs new file mode 100644 index 0000000..2a84622 --- /dev/null +++ b/Geekbot.net/Lib/Extensions/EmbedBuilderExtensions.cs @@ -0,0 +1,12 @@ +using Discord; + +namespace Geekbot.net.Lib.Extensions +{ + public static class EmbedBuilderExtensions + { + public static EmbedBuilder AddInlineField(this EmbedBuilder builder, string name, object value) + { + return builder.AddField(new EmbedFieldBuilder().WithIsInline(true).WithName(name).WithValue(value)); + } + } +} diff --git a/Geekbot.net/Lib/Polyfills/UserPolyfillDto.cs b/Geekbot.net/Lib/Polyfills/UserPolyfillDto.cs index 407ae36..568bdd7 100644 --- a/Geekbot.net/Lib/Polyfills/UserPolyfillDto.cs +++ b/Geekbot.net/Lib/Polyfills/UserPolyfillDto.cs @@ -9,7 +9,7 @@ namespace Geekbot.net.Lib.Polyfills public ulong Id { get; set; } public DateTimeOffset CreatedAt { get; set; } public string Mention { get; set; } - public Game? Game { get; set; } + public IActivity Activity { get; } public UserStatus Status { get; set; } public string AvatarId { get; set; } public string Discriminator { get; set; }