diff --git a/Geekbot.net/Commands/Utils/Quote/Quote.cs b/Geekbot.net/Commands/Utils/Quote/Quote.cs index 5c2bd3b..6288bef 100644 --- a/Geekbot.net/Commands/Utils/Quote/Quote.cs +++ b/Geekbot.net/Commands/Utils/Quote/Quote.cs @@ -252,7 +252,7 @@ namespace Geekbot.net.Commands.Utils.Quote try { var list = Context.Channel.GetMessagesAsync().Flatten(); - return await list.FirstOrDefault(msg => + return await list.FirstOrDefaultAsync(msg => msg.Author.Id == user.Id && msg.Embeds.Count == 0 && msg.Id != Context.Message.Id && diff --git a/Geekbot.net/Geekbot.net.csproj b/Geekbot.net/Geekbot.net.csproj index 32555e7..0d39cae 100755 --- a/Geekbot.net/Geekbot.net.csproj +++ b/Geekbot.net/Geekbot.net.csproj @@ -20,28 +20,28 @@ true - - - - + + + + - - - - - - - - + + + + + + + + - - - + + + diff --git a/Geekbot.net/Lib/Extensions/DbSetExtensions.cs b/Geekbot.net/Lib/Extensions/DbSetExtensions.cs index c731fc0..e08b2d4 100644 --- a/Geekbot.net/Lib/Extensions/DbSetExtensions.cs +++ b/Geekbot.net/Lib/Extensions/DbSetExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using Microsoft.EntityFrameworkCore; @@ -13,5 +14,15 @@ namespace Geekbot.net.Lib.Extensions var exists = predicate != null ? dbSet.Any(predicate) : dbSet.Any(); return !exists ? dbSet.Add(entity) : null; } + + // https://github.com/dotnet/efcore/issues/18124 + public static IAsyncEnumerable AsAsyncEnumerable(this Microsoft.EntityFrameworkCore.DbSet obj) where TEntity : class + { + return Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.AsAsyncEnumerable(obj); + } + public static IQueryable Where(this Microsoft.EntityFrameworkCore.DbSet obj, System.Linq.Expressions.Expression> predicate) where TEntity : class + { + return System.Linq.Queryable.Where(obj, predicate); + } } } \ No newline at end of file diff --git a/Geekbot.net/Lib/Polyfills/UserPolyfillDto.cs b/Geekbot.net/Lib/Polyfills/UserPolyfillDto.cs index 6d81581..32ea663 100644 --- a/Geekbot.net/Lib/Polyfills/UserPolyfillDto.cs +++ b/Geekbot.net/Lib/Polyfills/UserPolyfillDto.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Immutable; using System.Threading.Tasks; using Discord; @@ -11,6 +12,7 @@ namespace Geekbot.net.Lib.Polyfills public string Mention { get; set; } public IActivity Activity { get; } public UserStatus Status { get; set; } + public IImmutableSet ActiveClients { get; } public string AvatarId { get; set; } public string Discriminator { get; set; } public ushort DiscriminatorValue { get; set; } diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 235cc0b..345dacd 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -6,9 +6,9 @@ xUnit1026 - - - + + +