Massive cleanup

- Removed GuildConfigs repository, moved to extensions
- Moved StreamSettings extension to GuildConfig extensions
- namespace NadekoBot.Core has been simplified to NadekoBot in many places (more to come)
- Replaced some raw delete queries with simple linqtodb queries
This commit is contained in:
Kwoth
2021-06-19 03:32:48 +02:00
parent c7ff982ec1
commit 15dac7e3ed
191 changed files with 563 additions and 571 deletions

View File

@@ -1,8 +1,8 @@
using NadekoBot.Core.Modules.Gambling.Common.Blackjack;
using NadekoBot.Modules.Gambling.Common.Blackjack;
using NadekoBot.Core.Services;
using System.Collections.Concurrent;
namespace NadekoBot.Core.Modules.Gambling.Services
namespace NadekoBot.Modules.Gambling.Services
{
public class BlackJackService : INService
{

View File

@@ -1,5 +1,5 @@
using NadekoBot.Core.Services;
using NadekoBot.Core.Modules.Gambling.Common.Events;
using NadekoBot.Modules.Gambling.Common.Events;
using System.Collections.Concurrent;
using NadekoBot.Modules.Gambling.Common;
using Discord;
@@ -10,7 +10,7 @@ using NadekoBot.Core.Services.Database.Models;
using System.Net.Http;
using Newtonsoft.Json;
using System.Linq;
using NadekoBot.Core.Modules.Gambling.Services;
using NadekoBot.Modules.Gambling.Services;
using Serilog;
namespace NadekoBot.Modules.Gambling.Services

View File

@@ -1,13 +1,13 @@
using System.Threading.Tasks;
using NadekoBot.Core.Services;
using NadekoBot.Core.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Common;
using System.Threading;
using System.Linq;
using System.Collections.Generic;
using Discord;
using System;
namespace NadekoBot.Core.Modules.Gambling.Services
namespace NadekoBot.Modules.Gambling.Services
{
public class CurrencyRaffleService : INService
{

View File

@@ -1,9 +1,9 @@
using NadekoBot.Core.Common;
using NadekoBot.Core.Common.Configs;
using NadekoBot.Core.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Core.Services;
namespace NadekoBot.Core.Modules.Gambling.Services
namespace NadekoBot.Modules.Gambling.Services
{
public sealed class GamblingConfigService : ConfigServiceBase<GamblingConfig>
{

View File

@@ -1,5 +1,5 @@
using Discord.WebSocket;
using NadekoBot.Core.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Core.Services;
using NadekoBot.Modules.Gambling.Common.Connect4;
using NadekoBot.Modules.Gambling.Common.WheelOfFortune;
@@ -10,7 +10,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Core.Modules.Gambling.Services;
using NadekoBot.Modules.Gambling.Services;
using Serilog;
namespace NadekoBot.Modules.Gambling.Services

View File

@@ -1,6 +1,6 @@
using System.Threading.Tasks;
namespace NadekoBot.Core.Modules.Gambling.Services
namespace NadekoBot.Modules.Gambling.Services
{
public interface IShopService
{

View File

@@ -6,8 +6,9 @@ using NadekoBot.Core.Services;
using NadekoBot.Core.Services.Database;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Extensions;
using NadekoBot.Modules.Administration;
namespace NadekoBot.Core.Modules.Gambling.Services
namespace NadekoBot.Modules.Gambling.Services
{
public class ShopService : IShopService
{
@@ -19,7 +20,7 @@ namespace NadekoBot.Core.Modules.Gambling.Services
}
private IndexedCollection<ShopEntry> GetEntriesInternal(IUnitOfWork uow, ulong guildId) =>
uow.GuildConfigs.ForId(
uow._context.GuildConfigsForId(
guildId,
set => set.Include(x => x.ShopEntries).ThenInclude(x => x.Items)
)

View File

@@ -5,7 +5,6 @@ using NadekoBot.Common;
using NadekoBot.Common.Collections;
using NadekoBot.Core.Services;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Core.Services.Database.Repositories;
using NadekoBot.Core.Services.Impl;
using NadekoBot.Extensions;
using SixLabors.Fonts;
@@ -20,7 +19,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using NadekoBot.Core.Modules.Gambling.Services;
using NadekoBot.Modules.Administration;
using Image = SixLabors.ImageSharp.Image;
using Color = SixLabors.ImageSharp.Color;
@@ -80,7 +79,7 @@ namespace NadekoBot.Modules.Gambling.Services
bool enabled;
using (var uow = _db.GetDbContext())
{
var guildConfig = uow.GuildConfigs.ForId(gid, set => set.Include(gc => gc.GenerateCurrencyChannelIds));
var guildConfig = uow._context.GuildConfigsForId(gid, set => set.Include(gc => gc.GenerateCurrencyChannelIds));
var toAdd = new GCChannelId() { ChannelId = cid };
if (!guildConfig.GenerateCurrencyChannelIds.Contains(toAdd))
@@ -104,11 +103,11 @@ namespace NadekoBot.Modules.Gambling.Services
return enabled;
}
public IEnumerable<GeneratingChannel> GetAllGeneratingChannels()
public IEnumerable<GuildConfigExtensions.GeneratingChannel> GetAllGeneratingChannels()
{
using (var uow = _db.GetDbContext())
{
var chs = uow.GuildConfigs.GetGeneratingChannels();
var chs = uow._context.GuildConfigs.GetGeneratingChannels();
return chs;
}
}

View File

@@ -1,6 +1,6 @@
using Discord;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Core.Modules.Gambling.Common.Waifu;
using NadekoBot.Modules.Gambling.Common.Waifu;
using NadekoBot.Core.Services;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Core.Services.Database.Repositories;
@@ -8,8 +8,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NadekoBot.Core.Modules.Gambling.Common;
using NadekoBot.Core.Modules.Gambling.Services;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Modules.Gambling.Services;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Modules.Gambling.Services
{