mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Cleanup
This commit is contained in:
@@ -12,10 +12,4 @@ public static class NadekoExpressionExtensions
|
|||||||
|
|
||||||
public static IEnumerable<NadekoExpression> ForId(this DbSet<NadekoExpression> exprs, ulong id)
|
public static IEnumerable<NadekoExpression> ForId(this DbSet<NadekoExpression> exprs, ulong id)
|
||||||
=> exprs.AsNoTracking().AsQueryable().Where(x => x.GuildId == id).ToList();
|
=> exprs.AsNoTracking().AsQueryable().Where(x => x.GuildId == id).ToList();
|
||||||
|
|
||||||
public static NadekoExpression GetByGuildIdAndInput(
|
|
||||||
this DbSet<NadekoExpression> exprs,
|
|
||||||
ulong? guildId,
|
|
||||||
string input)
|
|
||||||
=> exprs.FirstOrDefault(x => x.GuildId == guildId && x.Trigger.ToUpper() == input);
|
|
||||||
}
|
}
|
@@ -57,8 +57,8 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
|
|||||||
// 1. expressions are almost never added (compared to how many times they are being looped through)
|
// 1. expressions are almost never added (compared to how many times they are being looped through)
|
||||||
// 2. only need write locks for this as we'll rebuild+replace the array on every edit
|
// 2. only need write locks for this as we'll rebuild+replace the array on every edit
|
||||||
// 3. there's never many of them (at most a thousand, usually < 100)
|
// 3. there's never many of them (at most a thousand, usually < 100)
|
||||||
private NadekoExpression[] globalExpressions;
|
private NadekoExpression[] globalExpressions = Array.Empty<NadekoExpression>();
|
||||||
private ConcurrentDictionary<ulong, NadekoExpression[]> newguildExpressions;
|
private ConcurrentDictionary<ulong, NadekoExpression[]> newguildExpressions = new();
|
||||||
|
|
||||||
private readonly DbService _db;
|
private readonly DbService _db;
|
||||||
private readonly DiscordSocketClient _client;
|
private readonly DiscordSocketClient _client;
|
||||||
|
Reference in New Issue
Block a user