mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
await usings and minor cleanup
This commit is contained in:
@@ -32,7 +32,7 @@ public partial class Games
|
||||
|
||||
if (_service.ChatterBotGuilds.TryRemove(channel.Guild.Id, out _))
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
uow.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, false);
|
||||
await uow.SaveChangesAsync();
|
||||
@@ -43,7 +43,7 @@ public partial class Games
|
||||
|
||||
_service.ChatterBotGuilds.TryAdd(channel.Guild.Id, new(() => _service.CreateSession(), true));
|
||||
|
||||
using (var uow = _db.GetDbContext())
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
uow.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, true);
|
||||
await uow.SaveChangesAsync();
|
||||
|
@@ -54,7 +54,8 @@ public class PollRunner
|
||||
var _ = OnVoted?.Invoke(msg, usr);
|
||||
}
|
||||
finally { _locker.Release(); }
|
||||
using (var uow = _db.GetDbContext())
|
||||
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var trackedPoll = uow.Poll.FirstOrDefault(x => x.Id == Poll.Id);
|
||||
trackedPoll.Votes.Add(voteObj);
|
||||
|
@@ -66,7 +66,7 @@ public partial class Games : NadekoModule<GamesService>
|
||||
return;
|
||||
}
|
||||
|
||||
using (var imgStream = new MemoryStream())
|
||||
await using (var imgStream = new MemoryStream())
|
||||
{
|
||||
lock (gr)
|
||||
{
|
||||
|
Reference in New Issue
Block a user