mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
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:
@@ -1,6 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class BibleVerses
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class CryptoResponse
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public sealed class Tag
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class UserData
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class UserStats
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class HearthstoneCardData
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class MtgData
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public static class NhentaiApiModel
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class OmdbMovie
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class OsuUserData
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
|
||||
public class Account
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class PicartoChannelResponse
|
||||
{
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class StreamData
|
||||
{
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public readonly struct StreamDataKey
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
//
|
||||
// public class TwitchResponse
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class TwitchResponseV5
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class TwitchUsersResponseV5
|
||||
{
|
||||
|
@@ -3,14 +3,15 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Modules.Searches.Common.StreamNotifications.Providers;
|
||||
using NadekoBot.Modules.Searches.Common.StreamNotifications.Providers;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
using StackExchange.Redis;
|
||||
|
||||
#nullable enable
|
||||
namespace NadekoBot.Core.Modules.Searches.Common.StreamNotifications
|
||||
namespace NadekoBot.Modules.Searches.Common.StreamNotifications
|
||||
{
|
||||
public class NotifChecker
|
||||
{
|
||||
|
@@ -6,11 +6,12 @@ using System.Net.Http.Headers;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
|
||||
#nullable enable
|
||||
namespace NadekoBot.Core.Modules.Searches.Common.StreamNotifications.Providers
|
||||
namespace NadekoBot.Modules.Searches.Common.StreamNotifications.Providers
|
||||
{
|
||||
public class PicartoProvider : Provider
|
||||
{
|
||||
|
@@ -4,9 +4,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
#nullable enable
|
||||
namespace NadekoBot.Core.Modules.Searches.Common.StreamNotifications.Providers
|
||||
namespace NadekoBot.Modules.Searches.Common.StreamNotifications.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract class implemented by providers of all supported platforms
|
||||
|
@@ -11,7 +11,7 @@
|
||||
// using Serilog;
|
||||
// using JsonSerializer = System.Text.Json.JsonSerializer;
|
||||
//
|
||||
// namespace NadekoBot.Core.Modules.Searches.Common.StreamNotifications.Providers
|
||||
// namespace NadekoBot.Modules.Searches.Common.StreamNotifications.Providers
|
||||
// {
|
||||
// public sealed class TwitchHelixProvider : Provider
|
||||
// {
|
||||
|
@@ -5,11 +5,12 @@ using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
|
||||
#nullable enable
|
||||
namespace NadekoBot.Core.Modules.Searches.Common.StreamNotifications.Providers
|
||||
namespace NadekoBot.Modules.Searches.Common.StreamNotifications.Providers
|
||||
{
|
||||
public class TwitchProvider : Provider
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class TimeData
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Searches.Common
|
||||
namespace NadekoBot.Modules.Searches.Common
|
||||
{
|
||||
public class UrbanResponse
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Discord;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Modules.Searches.Services;
|
||||
using NadekoBot.Modules.Searches.Services;
|
||||
using NadekoBot.Extensions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@@ -9,7 +9,7 @@ using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Modules.Searches.Common;
|
||||
using NadekoBot.Modules.Searches.Common;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Modules.Searches.Common;
|
||||
using NadekoBot.Modules.Searches.Common;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Searches.Services;
|
||||
using Newtonsoft.Json;
|
||||
|
@@ -5,10 +5,9 @@ using Discord.Commands;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Modules.Searches.Common;
|
||||
using NadekoBot.Modules.Searches.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Searches.Common;
|
||||
using NadekoBot.Modules.Searches.Services;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using NadekoBot.Core.Modules.Searches.Common;
|
||||
using NadekoBot.Modules.Searches.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
@@ -10,7 +10,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Services
|
||||
namespace NadekoBot.Modules.Searches.Services
|
||||
{
|
||||
public class CryptoService : INService
|
||||
{
|
||||
|
@@ -10,6 +10,7 @@ using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Modules.Administration;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Services
|
||||
{
|
||||
@@ -166,7 +167,7 @@ namespace NadekoBot.Modules.Searches.Services
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
return uow.GuildConfigs.ForId(guildId,
|
||||
return uow._context.GuildConfigsForId(guildId,
|
||||
set => set.Include(x => x.FeedSubs)
|
||||
.ThenInclude(x => x.GuildConfig))
|
||||
.FeedSubs
|
||||
@@ -187,7 +188,7 @@ namespace NadekoBot.Modules.Searches.Services
|
||||
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var gc = uow.GuildConfigs.ForId(guildId,
|
||||
var gc = uow._context.GuildConfigsForId(guildId,
|
||||
set => set.Include(x => x.FeedSubs)
|
||||
.ThenInclude(x => x.GuildConfig));
|
||||
|
||||
@@ -223,7 +224,7 @@ namespace NadekoBot.Modules.Searches.Services
|
||||
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var items = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.FeedSubs))
|
||||
var items = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.FeedSubs))
|
||||
.FeedSubs
|
||||
.OrderBy(x => x.Id)
|
||||
.ToList();
|
||||
|
@@ -2,12 +2,11 @@
|
||||
using Discord.WebSocket;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Core.Modules.Searches.Common;
|
||||
using NadekoBot.Modules.Searches.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Core.Services.Impl;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Searches.Common;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SixLabors.ImageSharp;
|
||||
@@ -21,16 +20,14 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AngleSharp.Html.Dom;
|
||||
using AngleSharp.Html.Parser;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using NadekoBot.Modules.Administration;
|
||||
using Serilog;
|
||||
using HorizontalAlignment = SixLabors.Fonts.HorizontalAlignment;
|
||||
using Image = SixLabors.ImageSharp.Image;
|
||||
using JsonSerializer = System.Text.Json.JsonSerializer;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Services
|
||||
{
|
||||
@@ -413,7 +410,7 @@ namespace NadekoBot.Modules.Searches.Services
|
||||
bool added;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(y => y.NsfwBlacklistedTags));
|
||||
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(y => y.NsfwBlacklistedTags));
|
||||
if (gc.NsfwBlacklistedTags.Add(tagObj))
|
||||
added = true;
|
||||
else
|
||||
|
@@ -6,8 +6,8 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Core.Modules.Searches.Common;
|
||||
using NadekoBot.Core.Modules.Searches.Common.StreamNotifications;
|
||||
using NadekoBot.Modules.Searches.Common;
|
||||
using NadekoBot.Modules.Searches.Common.StreamNotifications;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Extensions;
|
||||
@@ -17,6 +17,8 @@ using Discord;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Common.Collections;
|
||||
using NadekoBot.Common.Replacements;
|
||||
using NadekoBot.Modules.Administration;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Services
|
||||
@@ -318,7 +320,7 @@ namespace NadekoBot.Modules.Searches.Services
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var gc = uow.GuildConfigs.ForId(guild.Id, set => set.Include(x => x.FollowedStreams));
|
||||
var gc = uow._context.GuildConfigsForId(guild.Id, set => set.Include(x => x.FollowedStreams));
|
||||
|
||||
_offlineNotificationServers.TryRemove(gc.GuildId);
|
||||
|
||||
@@ -340,7 +342,7 @@ namespace NadekoBot.Modules.Searches.Services
|
||||
int count;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.FollowedStreams));
|
||||
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.FollowedStreams));
|
||||
count = gc.FollowedStreams.Count;
|
||||
gc.FollowedStreams.Clear();
|
||||
uow.SaveChanges();
|
||||
@@ -409,7 +411,7 @@ namespace NadekoBot.Modules.Searches.Services
|
||||
FollowedStream fs;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.FollowedStreams));
|
||||
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.FollowedStreams));
|
||||
|
||||
// add it to the database
|
||||
fs = new FollowedStream()
|
||||
@@ -479,7 +481,7 @@ namespace NadekoBot.Modules.Searches.Services
|
||||
bool newValue;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var gc = uow.GuildConfigs.ForId(guildId, set => set);
|
||||
var gc = uow._context.GuildConfigsForId(guildId, set => set);
|
||||
newValue = gc.NotifyStreamOffline = !gc.NotifyStreamOffline;
|
||||
uow.SaveChanges();
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using NadekoBot.Core.Services;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches.Services
|
||||
namespace NadekoBot.Modules.Searches.Services
|
||||
{
|
||||
// public class YtTrackService : INService
|
||||
// {
|
||||
@@ -88,7 +88,7 @@ namespace NadekoBot.Core.Modules.Searches.Services
|
||||
//
|
||||
// using(var uow = _db.GetDbContext())
|
||||
// {
|
||||
// var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.YtFollowedChannels));
|
||||
// var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.YtFollowedChannels));
|
||||
//
|
||||
// // see if this yt channel was already followed on this discord channel
|
||||
// var oldObj = gc.YtFollowedChannels
|
||||
|
@@ -10,6 +10,8 @@ using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Searches.Services;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Modules.Administration;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
@@ -87,8 +89,8 @@ namespace NadekoBot.Modules.Searches
|
||||
List<FollowedStream> streams = new List<FollowedStream>();
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var all = uow.GuildConfigs
|
||||
.ForId(ctx.Guild.Id, set => set.Include(gc => gc.FollowedStreams))
|
||||
var all = uow._context
|
||||
.GuildConfigsForId(ctx.Guild.Id, set => set.Include(gc => gc.FollowedStreams))
|
||||
.FollowedStreams
|
||||
.OrderBy(x => x.Id)
|
||||
.ToList();
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Core.Modules.Searches.Services;
|
||||
using NadekoBot.Modules.Searches.Services;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Searches
|
||||
namespace NadekoBot.Modules.Searches
|
||||
{
|
||||
public partial class Searches
|
||||
{
|
||||
|
Reference in New Issue
Block a user