fixed some bugs, removed some todos, cleanup

This commit is contained in:
Toastie 2025-01-29 23:14:56 +13:00
parent 5cb344455a
commit de8da558f7
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
10 changed files with 31 additions and 10 deletions
src/EllieBot
Db/Models
EllieBot.csprojEllieBot.csproj.DotSettings
Modules
Administration
Permissions/Filter
Searches
SearchesService.cs
_common/StreamNotifications/Providers
_common/Services

View file

@ -1,7 +1,7 @@
#nullable disable
using EllieBot.Db.Models;
namespace Ellieices.Database.Models;
namespace EllieBot.Services.Database.Models;
public class WaifuInfo : DbEntity
{

View file

@ -121,6 +121,10 @@
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Migrations/**/*.sql">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="creds_example.yml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

View file

@ -0,0 +1,17 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Canti/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cbtnrole/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cclub/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Ccurrency/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cexpr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cfilter/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cgiveaway/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cncanvas/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cpunish/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Croles/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cslowmode/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Csupport/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Ctodo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cuntimer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=db_005Cmodels_005Cxp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=modules_005Cadministration_005Cnotify_005Cmodels/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View file

@ -2,12 +2,13 @@
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using EllieBot.Common.ModuleBehaviors;
using EllieBot.Db.Models;
using EllieBot.Modules.Administration._common.results;
namespace EllieBot.Modules.Administration;
public class AdministrationService : IEService
public class AdministrationService : IEService, IReadyExecutor
{
private ConcurrentHashSet<ulong> deleteMessagesOnCommand;
private ConcurrentDictionary<ulong, bool> delMsgOnCmdChannels;
@ -35,7 +36,7 @@ public class AdministrationService : IEService
_cmdHandler = cmdHandler;
}
public async Task ReadyAsync()
public async Task OnReadyAsync()
{
await using var uow = _db.GetDbContext();
deleteMessagesOnCommand = new(await uow.GetTable<GuildConfig>()

View file

@ -5,10 +5,11 @@ using System.Threading.Channels;
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using EllieBot.Common.ModuleBehaviors;
namespace EllieBot.Modules.Administration.Services;
public sealed class AutoAssignRoleService : IEService
public sealed class AutoAssignRoleService : IEService, IReadyExecutor
{
private readonly DiscordSocketClient _client;
private readonly DbService _db;

View file

@ -403,12 +403,13 @@ public sealed class FilterService : IExecOnMessage, IReadyExecutor
});
await uow.SaveChangesAsync();
return true;
}
sfw.TryRemove(word);
fc.FilteredWords.RemoveWhere(x => x.Word == word);
await uow.SaveChangesAsync();
return true;
return false;
}
}

View file

@ -611,6 +611,5 @@ public class SearchesService : IEService
}
return shortLink;
throw new NotImplementedException();
}
}

View file

@ -45,6 +45,8 @@ namespace EllieBot.Modules.Searches.Common.StreamNotifications.Providers;
// }
// }
//
// todo check client id or whatever
public sealed class TwitchHelixProvider : Provider
{
private readonly IHttpClientFactory _httpClientFactory;

View file

@ -49,7 +49,6 @@ public interface IStatsService
/// </summary>
double GetPrivateMemoryMegabytes();
GuildInfo GetGuildInfoAsync(string name);
Task<GuildInfo> GetGuildInfoAsync(ulong id);
}

View file

@ -180,9 +180,6 @@ public sealed class StatsService : IStatsService, IReadyExecutor, IEService
return _currentProcess.PrivateMemorySize64 / 1.Megabytes();
}
public GuildInfo GetGuildInfoAsync(string name)
=> throw new NotImplementedException();
public async Task<GuildInfo> GetGuildInfoAsync(ulong id)
{
var g = _client.GetGuild(id);