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:
@@ -6,14 +6,12 @@ using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Common.AnimalRacing;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common.AnimalRacing;
|
||||
using NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Gambling.Common.AnimalRacing.Exceptions;
|
||||
using NadekoBot.Modules.Games.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
|
@@ -1,14 +1,16 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Common.Blackjack;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common.Blackjack;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Extensions;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
|
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Common.AnimalRacing;
|
||||
using NadekoBot.Modules.Gambling.Common.AnimalRacing;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Extensions;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using CommandLine;
|
||||
using NadekoBot.Core.Common;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.AnimalRacing
|
||||
namespace NadekoBot.Modules.Gambling.Common.AnimalRacing
|
||||
{
|
||||
public class RaceOptions : INadekoCommandOptions
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common
|
||||
namespace NadekoBot.Modules.Gambling.Common
|
||||
{
|
||||
public class Betroll
|
||||
{
|
||||
|
@@ -8,7 +8,7 @@ using NadekoBot.Core.Services;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Blackjack
|
||||
namespace NadekoBot.Modules.Gambling.Common.Blackjack
|
||||
{
|
||||
public class Blackjack
|
||||
{
|
||||
|
@@ -4,7 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Blackjack
|
||||
namespace NadekoBot.Modules.Gambling.Common.Blackjack
|
||||
{
|
||||
public abstract class Player
|
||||
{
|
||||
|
@@ -3,7 +3,7 @@ using NadekoBot.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common
|
||||
namespace NadekoBot.Modules.Gambling.Common
|
||||
{
|
||||
public class CurrencyRaffleGame
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using CommandLine;
|
||||
using NadekoBot.Core.Common;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Events
|
||||
namespace NadekoBot.Modules.Gambling.Common.Events
|
||||
{
|
||||
public class EventOptions : INadekoCommandOptions
|
||||
{
|
||||
|
@@ -13,7 +13,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Events
|
||||
namespace NadekoBot.Modules.Gambling.Common.Events
|
||||
{
|
||||
public class GameStatusEvent : ICurrencyEvent
|
||||
{
|
||||
|
@@ -11,10 +11,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Events
|
||||
namespace NadekoBot.Modules.Gambling.Common.Events
|
||||
{
|
||||
public class ReactionEvent : ICurrencyEvent
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using NadekoBot.Common.Yml;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common
|
||||
namespace NadekoBot.Modules.Gambling.Common
|
||||
{
|
||||
public sealed class GamblingConfig
|
||||
{
|
||||
|
@@ -3,9 +3,9 @@ using Discord;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Modules;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common
|
||||
namespace NadekoBot.Modules.Gambling.Common
|
||||
{
|
||||
public abstract class GamblingModule<TService> : NadekoModule<TService>
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common
|
||||
namespace NadekoBot.Modules.Gambling.Common
|
||||
{
|
||||
public class Payout
|
||||
{
|
||||
|
@@ -5,7 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common
|
||||
namespace NadekoBot.Modules.Gambling.Common
|
||||
{
|
||||
public class RollDuelGame
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
|
||||
namespace NadekoBot.Modules.Gambling.Common.Waifu
|
||||
{
|
||||
public enum AffinityTitle
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
|
||||
namespace NadekoBot.Modules.Gambling.Common.Waifu
|
||||
{
|
||||
public enum ClaimTitle
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
|
||||
namespace NadekoBot.Modules.Gambling.Common.Waifu
|
||||
{
|
||||
public enum DivorceResult
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
|
||||
namespace NadekoBot.Modules.Gambling.Common.Waifu
|
||||
{
|
||||
public enum WaifuClaimResult
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
|
||||
namespace NadekoBot.Modules.Gambling.Common.Waifu
|
||||
{
|
||||
public struct WaifuProfileTitle
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Common.WheelOfFortune
|
||||
|
@@ -2,16 +2,15 @@
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Gambling.Common.Connect4;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
|
@@ -4,12 +4,11 @@ using NadekoBot.Extensions;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using NadekoBot.Modules.Gambling.Common.Events;
|
||||
using System;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Core.Modules.Gambling.Common.Events;
|
||||
using System;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
|
@@ -1,11 +1,11 @@
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using NadekoBot.Extensions;
|
||||
using System.Linq;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Common;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
|
@@ -2,7 +2,7 @@ using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Extensions;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
@@ -11,6 +11,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Services;
|
||||
using Image = SixLabors.ImageSharp.Image;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
|
@@ -7,11 +7,12 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using Image = SixLabors.ImageSharp.Image;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
|
@@ -2,9 +2,7 @@ using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using SixLabors.ImageSharp;
|
||||
@@ -12,7 +10,8 @@ using SixLabors.ImageSharp.PixelFormats;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
using Image = SixLabors.ImageSharp.Image;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
|
@@ -3,10 +3,8 @@ using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using System;
|
||||
@@ -15,8 +13,10 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Core.Services.Database;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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>
|
||||
{
|
||||
|
@@ -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
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Core.Modules.Gambling.Services
|
||||
namespace NadekoBot.Modules.Gambling.Services
|
||||
{
|
||||
public interface IShopService
|
||||
{
|
||||
|
@@ -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)
|
||||
)
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -8,11 +8,12 @@ using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Common.Collections;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Services;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Administration;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
@@ -48,7 +49,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
throw new ArgumentOutOfRangeException(nameof(page));
|
||||
|
||||
using var uow = _db.GetDbContext();
|
||||
var entries = uow.GuildConfigs.ForId(ctx.Guild.Id,
|
||||
var entries = uow._context.GuildConfigsForId(ctx.Guild.Id,
|
||||
set => set.Include(x => x.ShopEntries)
|
||||
.ThenInclude(x => x.Items)).ShopEntries
|
||||
.ToIndexed();
|
||||
@@ -94,7 +95,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
ShopEntry entry;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow.GuildConfigs.ForId(ctx.Guild.Id, set => set
|
||||
var config = uow._context.GuildConfigsForId(ctx.Guild.Id, set => set
|
||||
.Include(x => x.ShopEntries)
|
||||
.ThenInclude(x => x.Items));
|
||||
var entries = new IndexedCollection<ShopEntry>(config.ShopEntries);
|
||||
@@ -188,7 +189,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
entry.Price).ConfigureAwait(false);
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var entries = new IndexedCollection<ShopEntry>(uow.GuildConfigs.ForId(ctx.Guild.Id,
|
||||
var entries = new IndexedCollection<ShopEntry>(uow._context.GuildConfigsForId(ctx.Guild.Id,
|
||||
set => set.Include(x => x.ShopEntries)
|
||||
.ThenInclude(x => x.Items)).ShopEntries);
|
||||
entry = entries.ElementAtOrDefault(index);
|
||||
@@ -234,13 +235,13 @@ namespace NadekoBot.Modules.Gambling
|
||||
};
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var entries = new IndexedCollection<ShopEntry>(uow.GuildConfigs.ForId(ctx.Guild.Id,
|
||||
var entries = new IndexedCollection<ShopEntry>(uow._context.GuildConfigsForId(ctx.Guild.Id,
|
||||
set => set.Include(x => x.ShopEntries)
|
||||
.ThenInclude(x => x.Items)).ShopEntries)
|
||||
{
|
||||
entry
|
||||
};
|
||||
uow.GuildConfigs.ForId(ctx.Guild.Id, set => set).ShopEntries = entries;
|
||||
uow._context.GuildConfigsForId(ctx.Guild.Id, set => set).ShopEntries = entries;
|
||||
uow.SaveChanges();
|
||||
}
|
||||
await ctx.Channel.EmbedAsync(EntryToEmbed(entry)
|
||||
@@ -262,13 +263,13 @@ namespace NadekoBot.Modules.Gambling
|
||||
};
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var entries = new IndexedCollection<ShopEntry>(uow.GuildConfigs.ForId(ctx.Guild.Id,
|
||||
var entries = new IndexedCollection<ShopEntry>(uow._context.GuildConfigsForId(ctx.Guild.Id,
|
||||
set => set.Include(x => x.ShopEntries)
|
||||
.ThenInclude(x => x.Items)).ShopEntries)
|
||||
{
|
||||
entry
|
||||
};
|
||||
uow.GuildConfigs.ForId(ctx.Guild.Id, set => set).ShopEntries = entries;
|
||||
uow._context.GuildConfigsForId(ctx.Guild.Id, set => set).ShopEntries = entries;
|
||||
uow.SaveChanges();
|
||||
}
|
||||
await ctx.Channel.EmbedAsync(EntryToEmbed(entry)
|
||||
@@ -292,7 +293,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
bool added = false;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var entries = new IndexedCollection<ShopEntry>(uow.GuildConfigs.ForId(ctx.Guild.Id,
|
||||
var entries = new IndexedCollection<ShopEntry>(uow._context.GuildConfigsForId(ctx.Guild.Id,
|
||||
set => set.Include(x => x.ShopEntries)
|
||||
.ThenInclude(x => x.Items)).ShopEntries);
|
||||
entry = entries.ElementAtOrDefault(index);
|
||||
@@ -325,7 +326,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
ShopEntry removed;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow.GuildConfigs.ForId(ctx.Guild.Id, set => set
|
||||
var config = uow._context.GuildConfigsForId(ctx.Guild.Id, set => set
|
||||
.Include(x => x.ShopEntries)
|
||||
.ThenInclude(x => x.Items));
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Core.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -11,9 +10,9 @@ using System.Threading.Tasks;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Services;
|
||||
using Image = SixLabors.ImageSharp.Image;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using SixLabors.ImageSharp;
|
||||
|
@@ -1,16 +1,13 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Core.Modules.Gambling.Common.Waifu;
|
||||
using NadekoBot.Modules.Gambling.Common.Waifu;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
|
@@ -1,14 +1,13 @@
|
||||
using Discord;
|
||||
using NadekoBot.Common.Attributes;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Core.Services;
|
||||
using System.Threading.Tasks;
|
||||
using Wof = NadekoBot.Modules.Gambling.Common.WheelOfFortune.WheelOfFortuneGame;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Modules.Gambling.Common;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using System.Collections.Immutable;
|
||||
using NadekoBot.Core.Modules.Gambling.Services;
|
||||
using NadekoBot.Core.Common;
|
||||
using NadekoBot.Core.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
|
Reference in New Issue
Block a user