feat: watchlist repository, remove ef core from all bot code
This commit is contained in:
parent
da4dfae27c
commit
f0511a560c
19 changed files with 155 additions and 97 deletions
|
|
@ -16,6 +16,8 @@
|
|||
using System.Diagnostics;
|
||||
using Catalogger.Backend.Cache.InMemoryCache;
|
||||
using Catalogger.Backend.Database;
|
||||
using Catalogger.Backend.Database.Dapper;
|
||||
using Dapper;
|
||||
using Humanizer;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Prometheus;
|
||||
|
|
@ -39,8 +41,9 @@ public class MetricsCollectionService(
|
|||
|
||||
await using var scope = services.CreateAsyncScope();
|
||||
await using var db = scope.ServiceProvider.GetRequiredService<DatabaseContext>();
|
||||
await using var conn = scope.ServiceProvider.GetRequiredService<DatabaseConnection>();
|
||||
|
||||
var messageCount = await db.Messages.CountAsync(ct);
|
||||
var messageCount = await conn.ExecuteScalarAsync<int>("select count(id) from messages");
|
||||
|
||||
CataloggerMetrics.GuildsCached.Set(guildCache.Size);
|
||||
CataloggerMetrics.ChannelsCached.Set(channelCache.Size);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public class WebhookExecutorService(
|
|||
public void QueueLog(Guild guildConfig, LogChannelType logChannelType, IEmbed embed)
|
||||
{
|
||||
var logChannel = GetLogChannel(guildConfig, logChannelType, channelId: null, userId: null);
|
||||
_logger.Debug("Channel to log {Type} to: {LogChannel}", logChannelType, logChannel);
|
||||
if (logChannel == null)
|
||||
return;
|
||||
|
||||
|
|
@ -72,6 +73,7 @@ public class WebhookExecutorService(
|
|||
/// </summary>
|
||||
public void QueueLog(ulong channelId, IEmbed embed)
|
||||
{
|
||||
_logger.Debug("Channel to log to: {LogChannel}", channelId);
|
||||
if (channelId == 0)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue