mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
await usings and minor cleanup
This commit is contained in:
@@ -48,7 +48,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
var av = usr.RealAvatarUrl(128);
|
||||
if (av is null)
|
||||
return;
|
||||
using (var picStream = await _service.GetRipPictureAsync(usr.Nickname ?? usr.Username, av).ConfigureAwait(false))
|
||||
await using (var picStream = await _service.GetRipPictureAsync(usr.Nickname ?? usr.Username, av).ConfigureAwait(false))
|
||||
{
|
||||
await ctx.Channel.SendFileAsync(
|
||||
picStream,
|
||||
@@ -626,7 +626,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
new PointF(x, 50)
|
||||
}));
|
||||
}
|
||||
using (var ms = img.ToStream())
|
||||
|
||||
await using (var ms = img.ToStream())
|
||||
{
|
||||
await ctx.Channel.SendFileAsync(ms, $"colors.png").ConfigureAwait(false);
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@ public class FeedsService : INService
|
||||
.AsQueryable()
|
||||
.Where(x => guildConfigIds.Contains(x.Id))
|
||||
.Include(x => x.FeedSubs)
|
||||
.ThenInclude(x => x.GuildConfig)
|
||||
.ToList()
|
||||
.SelectMany(x => x.FeedSubs)
|
||||
.GroupBy(x => x.Url.ToLower())
|
||||
|
@@ -339,7 +339,7 @@ public sealed class StreamNotificationService : INService
|
||||
|
||||
public async Task<int> ClearAllStreams(ulong guildId)
|
||||
{
|
||||
using var uow = _db.GetDbContext();
|
||||
await using var uow = _db.GetDbContext();
|
||||
var gc = uow.GuildConfigsForId(guildId, set => set.Include(x => x.FollowedStreams));
|
||||
uow.RemoveRange(gc.FollowedStreams);
|
||||
|
||||
@@ -354,7 +354,7 @@ public sealed class StreamNotificationService : INService
|
||||
public async Task<FollowedStream> UnfollowStreamAsync(ulong guildId, int index)
|
||||
{
|
||||
FollowedStream fs;
|
||||
using (var uow = _db.GetDbContext())
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var fss = uow.Set<FollowedStream>()
|
||||
.AsQueryable()
|
||||
@@ -400,7 +400,7 @@ public sealed class StreamNotificationService : INService
|
||||
return null;
|
||||
|
||||
FollowedStream fs;
|
||||
using (var uow = _db.GetDbContext())
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var gc = uow.GuildConfigsForId(guildId, set => set.Include(x => x.FollowedStreams));
|
||||
|
||||
|
@@ -84,7 +84,7 @@ public partial class Searches
|
||||
}
|
||||
|
||||
var streams = new List<FollowedStream>();
|
||||
using (var uow = _db.GetDbContext())
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var all = uow
|
||||
.GuildConfigsForId(ctx.Guild.Id, set => set.Include(gc => gc.FollowedStreams))
|
||||
|
Reference in New Issue
Block a user