mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58:26 -04:00
await usings and minor cleanup
This commit is contained in:
@@ -58,7 +58,7 @@ public class CurrencyService : ICurrencyService, INService
|
||||
throw new ArgumentException("You can't add negative amounts. Use RemoveAsync method for that.", nameof(amount));
|
||||
}
|
||||
|
||||
using (var uow = _db.GetDbContext())
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
InternalChange(userId, userName, discrim, avatar, reason, amount, gamble, uow);
|
||||
await uow.SaveChangesAsync();
|
||||
@@ -102,7 +102,7 @@ public class CurrencyService : ICurrencyService, INService
|
||||
throw new ArgumentException("Cannot perform bulk operation. Arrays are not of equal length.");
|
||||
|
||||
var userIdHashSet = new HashSet<ulong>(idArray.Length);
|
||||
using (var uow = _db.GetDbContext())
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
for (var i = 0; i < idArray.Length; i++)
|
||||
{
|
||||
@@ -124,7 +124,7 @@ public class CurrencyService : ICurrencyService, INService
|
||||
throw new ArgumentException("Cannot perform bulk operation. Arrays are not of equal length.");
|
||||
|
||||
var userIdHashSet = new HashSet<ulong>(idArray.Length);
|
||||
using (var uow = _db.GetDbContext())
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
for (var i = 0; i < idArray.Length; i++)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ public class CurrencyService : ICurrencyService, INService
|
||||
}
|
||||
|
||||
bool result;
|
||||
using (var uow = _db.GetDbContext())
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
result = InternalChange(userId, userName, userDiscrim, avatar, reason, -amount, gamble, uow);
|
||||
await uow.SaveChangesAsync();
|
||||
|
@@ -16,7 +16,7 @@ public class StatsService : IStatsService, IReadyExecutor, INService, IDisposabl
|
||||
private readonly IBotCredentials _creds;
|
||||
private readonly DateTime _started;
|
||||
|
||||
public const string BotVersion = "3.0.11";
|
||||
public const string BotVersion = "4.0.0";
|
||||
public string Author => "Kwoth#2452";
|
||||
public string Library => "Discord.Net";
|
||||
public double MessagesPerSecond => MessageCounter / GetUptime().TotalSeconds;
|
||||
@@ -42,7 +42,7 @@ public class StatsService : IStatsService, IReadyExecutor, INService, IDisposabl
|
||||
|
||||
_started = DateTime.UtcNow;
|
||||
_client.MessageReceived += _ => Task.FromResult(Interlocked.Increment(ref _messageCounter));
|
||||
cmdHandler.CommandExecuted += (_, e) => Task.FromResult(Interlocked.Increment(ref _commandsRan));
|
||||
cmdHandler.CommandExecuted += (_, _) => Task.FromResult(Interlocked.Increment(ref _commandsRan));
|
||||
|
||||
_client.ChannelCreated += c =>
|
||||
{
|
||||
|
Reference in New Issue
Block a user