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,6 +1,6 @@
using System;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface ICachableTrackData
{

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface ILocalTrackResolver : IPlatformQueryResolver
{

View File

@@ -4,7 +4,7 @@ using System.Threading.Tasks;
using NadekoBot.Core.Services.Database.Models;
#nullable enable
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface IMusicPlayer : IDisposable
{

View File

@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface IMusicQueue
{

View File

@@ -1,7 +1,7 @@
#nullable enable
using System.Threading.Tasks;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface IPlatformQueryResolver
{

View File

@@ -1,4 +1,4 @@
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface IQueuedTrackInfo : ITrackInfo
{

View File

@@ -1,4 +1,4 @@
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface IRadioResolver : IPlatformQueryResolver
{

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface ISoundcloudResolver : IPlatformQueryResolver
{

View File

@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface ITrackCacher
{

View File

@@ -2,7 +2,7 @@
using System;
using System.Threading.Tasks;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface ITrackInfo
{

View File

@@ -1,7 +1,7 @@
#nullable enable
using System.Threading.Tasks;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface ITrackResolveProvider
{

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public interface IYoutubeResolver : IPlatformQueryResolver
{

View File

@@ -1,7 +1,7 @@
using System;
using System.Text.Json.Serialization;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public sealed class CachableTrackData : ICachableTrackData
{

View File

@@ -2,7 +2,7 @@
using System.Runtime.InteropServices;
using Serilog;
namespace NadekoBot.Core.Modules.Music.Common
namespace NadekoBot.Modules.Music.Common
{
public sealed class MultimediaTimer : IDisposable
{

View File

@@ -2,7 +2,7 @@
using Discord;
using NadekoBot.Extensions;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public static class MusicExtensions
{

View File

@@ -1,4 +1,4 @@
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public enum MusicPlatform
{

View File

@@ -10,13 +10,13 @@ using System.Threading;
using System.Threading.Tasks;
using Ayu.Discord.Voice;
using NadekoBot.Common;
using NadekoBot.Core.Modules.Music.Common;
using NadekoBot.Modules.Music.Common;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Extensions;
using NadekoBot.Modules.Music;
using Serilog;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public sealed class MusicPlayer : IMusicPlayer
{

View File

@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public sealed partial class MusicQueue
{

View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using Serilog;
using StackExchange.Redis;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public sealed class RedisTrackCacher : ITrackCacher
{

View File

@@ -2,7 +2,7 @@
using System;
using System.Threading.Tasks;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public sealed class RemoteTrackInfo : ITrackInfo
{

View File

@@ -2,7 +2,7 @@
using System;
using System.Threading.Tasks;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public sealed class SimpleTrackInfo : ITrackInfo
{

View File

@@ -6,7 +6,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Core.Modules.Music;
using NadekoBot.Modules.Music;
using NadekoBot.Extensions;
using Serilog;

View File

@@ -2,7 +2,7 @@
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using NadekoBot.Core.Modules.Music;
using NadekoBot.Modules.Music;
using NadekoBot.Extensions;
using Serilog;

View File

@@ -3,9 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Runtime.CompilerServices;
using NadekoBot.Core.Services.Impl;
using System.Threading.Tasks;
using NadekoBot.Core.Modules.Music;
using NadekoBot.Core.Services.Impl;
using NadekoBot.Extensions;
using Newtonsoft.Json.Linq;

View File

@@ -3,7 +3,7 @@ using System;
using System.Threading.Tasks;
using Serilog;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public sealed class TrackResolveProvider : ITrackResolveProvider
{

View File

@@ -10,7 +10,7 @@ using NadekoBot.Core.Services.Impl;
using NadekoBot.Extensions;
using Serilog;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public sealed class YtdlYoutubeResolver : IYoutubeResolver
{

View File

@@ -13,7 +13,7 @@ using NadekoBot.Modules;
using NadekoBot.Modules.Administration.Services;
using NadekoBot.Modules.Music.Services;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
[NoPublicBot]
public sealed partial class Music : NadekoModule<IMusicService>

View File

@@ -8,13 +8,15 @@ using Discord.Commands;
using NadekoBot.Common.Attributes;
using NadekoBot.Core.Services;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Services;
using NadekoBot.Services.Database.Models;
using NadekoBot.Extensions;
using NadekoBot.Modules;
using NadekoBot.Modules.Music;
using NadekoBot.Modules.Music.Services;
using Serilog;
namespace NadekoBot.Core.Modules.Music
namespace NadekoBot.Modules.Music
{
public sealed partial class Music
{

View File

@@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Discord;
using NadekoBot.Core.Common;
using NadekoBot.Core.Modules.Music;
using NadekoBot.Modules.Music;
using NadekoBot.Core.Services.Database.Models;
namespace NadekoBot.Modules.Music.Services

View File

@@ -7,10 +7,13 @@ using System.Linq;
using System.Threading.Tasks;
using Discord;
using Discord.WebSocket;
using NadekoBot.Core.Modules.Music;
using NadekoBot.Core.Services;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Core.Services.Database.Repositories.Impl;
using NadekoBot.Modules.Music;
using NadekoBot.Services;
using NadekoBot.Services.Database.Models;
using NadekoBot.Services.Database.Repositories.Impl;
using NadekoBot.Extensions;
using Serilog;

View File

@@ -82,7 +82,7 @@
// {
// using (var uow = _db.GetDbContext())
// {
// return uow.GuildConfigs.ForId(guildId, set => set).DefaultMusicVolume;
// return uow._context.GuildConfigsForId(guildId, set => set).DefaultMusicVolume;
// }
// });
// }
@@ -256,7 +256,7 @@
// bool val;
// using (var uow = _db.GetDbContext())
// {
// var gc = uow.GuildConfigs.ForId(id, set => set);
// var gc = uow._context.GuildConfigsForId(id, set => set);
// val = gc.AutoDcFromVc = !gc.AutoDcFromVc;
// uow.SaveChanges();
// }
@@ -278,7 +278,7 @@
// {
// using (var uow = _db.GetDbContext())
// {
// var ms = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.MusicSettings)).MusicSettings;
// var ms = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.MusicSettings)).MusicSettings;
// ms.MusicChannelId = cid;
// uow.SaveChanges();
// }
@@ -288,7 +288,7 @@
// {
// using (var uow = _db.GetDbContext())
// {
// var ms = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.MusicSettings)).MusicSettings;
// var ms = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.MusicSettings)).MusicSettings;
// ms.SongAutoDelete = val;
// uow.SaveChanges();
// }

View File

@@ -395,7 +395,7 @@
// }
// using (var uow = _db.GetDbContext())
// {
// uow.GuildConfigs.ForId(ctx.Guild.Id, set => set).DefaultMusicVolume = val / 100.0f;
// uow._context.GuildConfigsForId(ctx.Guild.Id, set => set).DefaultMusicVolume = val / 100.0f;
// uow.SaveChanges();
// }
// await ReplyConfirmLocalizedAsync("defvol_set", val).ConfigureAwait(false);