From 096ada367fb3e18330ef9f8961fc5891a603bba6 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 28 Feb 2023 14:49:50 +0100 Subject: [PATCH] Cleanup --- src/NadekoBot/Db/Extensions/NadekoExpressionExtensions.cs | 6 ------ .../Modules/Expressions/NadekoExpressionsService.cs | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/NadekoBot/Db/Extensions/NadekoExpressionExtensions.cs b/src/NadekoBot/Db/Extensions/NadekoExpressionExtensions.cs index 2ff117385..ffb25405d 100644 --- a/src/NadekoBot/Db/Extensions/NadekoExpressionExtensions.cs +++ b/src/NadekoBot/Db/Extensions/NadekoExpressionExtensions.cs @@ -12,10 +12,4 @@ public static class NadekoExpressionExtensions public static IEnumerable ForId(this DbSet exprs, ulong id) => exprs.AsNoTracking().AsQueryable().Where(x => x.GuildId == id).ToList(); - - public static NadekoExpression GetByGuildIdAndInput( - this DbSet exprs, - ulong? guildId, - string input) - => exprs.FirstOrDefault(x => x.GuildId == guildId && x.Trigger.ToUpper() == input); } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Expressions/NadekoExpressionsService.cs b/src/NadekoBot/Modules/Expressions/NadekoExpressionsService.cs index acf6a4cb2..b8cba84b8 100644 --- a/src/NadekoBot/Modules/Expressions/NadekoExpressionsService.cs +++ b/src/NadekoBot/Modules/Expressions/NadekoExpressionsService.cs @@ -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) // 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) - private NadekoExpression[] globalExpressions; - private ConcurrentDictionary newguildExpressions; + private NadekoExpression[] globalExpressions = Array.Empty(); + private ConcurrentDictionary newguildExpressions = new(); private readonly DbService _db; private readonly DiscordSocketClient _client;