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

@@ -3,7 +3,7 @@ using System.Linq;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using NadekoBot.Core.Common;
using NadekoBot.Core.Modules.Music;
using NadekoBot.Modules.Music;
using NadekoBot.Core.Services;
using NadekoBot.Modules.Administration.Services;
using NadekoBot.Modules.Music.Resolvers;

View File

@@ -5,7 +5,7 @@ using NadekoBot.Core.Services;
using System;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using NadekoBot.Core.Modules.Gambling.Services;
using NadekoBot.Modules.Gambling.Services;
namespace NadekoBot.Core.Common.TypeReaders
{

View File

@@ -4,7 +4,7 @@ using NadekoBot.Extensions;
using System;
using System.Threading.Tasks;
using Discord;
using NadekoBot.Core.Modules.Administration.Services;
using NadekoBot.Modules.Administration.Services;
using System.Linq;
#if !GLOBAL_NADEKO

View File

@@ -4,7 +4,7 @@ using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using NadekoBot.Common.Attributes;
using NadekoBot.Core.Modules.Administration.Services;
using NadekoBot.Modules.Administration.Services;
using NadekoBot.Extensions;
namespace NadekoBot.Modules.Administration

View File

@@ -12,6 +12,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NadekoBot.Core.Services.Database.Repositories.Impl;
namespace NadekoBot.Modules.Administration.Services
{
@@ -45,7 +46,7 @@ namespace NadekoBot.Modules.Administration.Services
{
using (var uow = _db.GetDbContext())
{
var conf = uow.GuildConfigs.ForId(guildId,
var conf = uow._context.GuildConfigsForId(guildId,
set => set.Include(x => x.DelMsgOnCmdChannels));
return (conf.DeleteMessageOnCommand, conf.DelMsgOnCmdChannels);
@@ -83,7 +84,7 @@ namespace NadekoBot.Modules.Administration.Services
bool enabled;
using (var uow = _db.GetDbContext())
{
var conf = uow.GuildConfigs.ForId(guildId, set => set);
var conf = uow._context.GuildConfigsForId(guildId, set => set);
enabled = conf.DeleteMessageOnCommand = !conf.DeleteMessageOnCommand;
uow.SaveChanges();
@@ -95,7 +96,7 @@ namespace NadekoBot.Modules.Administration.Services
{
using (var uow = _db.GetDbContext())
{
var conf = uow.GuildConfigs.ForId(guildId,
var conf = uow._context.GuildConfigsForId(guildId,
set => set.Include(x => x.DelMsgOnCmdChannels));
var old = conf.DelMsgOnCmdChannels.FirstOrDefault(x => x.ChannelId == chId);

View File

@@ -9,6 +9,7 @@ using System.Threading.Channels;
using LinqToDB;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Core.Services.Database.Repositories.Impl;
using NadekoBot.Extensions;
using Serilog;
@@ -107,7 +108,7 @@ namespace NadekoBot.Modules.Administration.Services
public async Task<IReadOnlyList<ulong>> ToggleAarAsync(ulong guildId, ulong roleId)
{
using var uow = _db.GetDbContext();
var gc = uow.GuildConfigs.ForId(guildId, set => set);
var gc = uow._context.GuildConfigsForId(guildId, set => set);
var roles = gc.GetAutoAssignableRoles();
if(!roles.Remove(roleId) && roles.Count < 3)
roles.Add(roleId);
@@ -142,7 +143,7 @@ namespace NadekoBot.Modules.Administration.Services
{
using var uow = _db.GetDbContext();
var gc = uow.GuildConfigs.ForId(guildId, set => set);
var gc = uow._context.GuildConfigsForId(guildId, set => set);
gc.SetAutoAssignableRoles(newRoles);
await uow.SaveChangesAsync();

View File

@@ -7,7 +7,7 @@ using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using NadekoBot.Core.Services.Database.Models;
namespace NadekoBot.Core.Modules.Administration.Services
namespace NadekoBot.Modules.Administration.Services
{
public class DangerousCommandsService : INService
{

View File

@@ -5,6 +5,7 @@ using Discord.WebSocket;
using NadekoBot.Common.Collections;
using NadekoBot.Extensions;
using NadekoBot.Core.Services;
using NadekoBot.Core.Services.Database.Repositories.Impl;
using Serilog;
namespace NadekoBot.Modules.Administration.Services
@@ -63,7 +64,7 @@ namespace NadekoBot.Modules.Administration.Services
ulong? id;
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guildId, set => set);
var gc = uow._context.GuildConfigsForId(guildId, set => set);
if (gc.GameVoiceChannel == vchId)
{

View File

@@ -67,7 +67,7 @@ namespace NadekoBot.Modules.Administration.Services
{
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guildId, set => set);
var gc = uow._context.GuildConfigsForId(guildId, set => set);
gc.TimeZoneId = tz?.Id;
uow.SaveChanges();

View File

@@ -124,7 +124,7 @@ namespace NadekoBot.Modules.Administration.Services
int removed = 0;
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.LogSettingsFor(gid);
var config = uow._context.LogSettingsFor(gid);
LogSetting logSetting = GuildLogSettings.GetOrAdd(gid, (id) => config.LogSetting);
removed = logSetting.IgnoredChannels.RemoveWhere(ilc => ilc.ChannelId == cid);
config.LogSetting.IgnoredChannels.RemoveWhere(ilc => ilc.ChannelId == cid);
@@ -167,7 +167,7 @@ namespace NadekoBot.Modules.Administration.Services
LogSetting logSetting;
using (var uow = _db.GetDbContext())
{
logSetting = uow.GuildConfigs.LogSettingsFor(guildId).LogSetting;
logSetting = uow._context.LogSettingsFor(guildId).LogSetting;
GuildLogSettings.AddOrUpdate(guildId, (id) => logSetting, (id, old) => logSetting);
logSetting.LogOtherId =
logSetting.MessageUpdatedId =
@@ -256,7 +256,7 @@ namespace NadekoBot.Modules.Administration.Services
ulong? channelId = null;
using (var uow = _db.GetDbContext())
{
var logSetting = uow.GuildConfigs.LogSettingsFor(gid).LogSetting;
var logSetting = uow._context.LogSettingsFor(gid).LogSetting;
GuildLogSettings.AddOrUpdate(gid, (id) => logSetting, (id, old) => logSetting);
switch (type)
{
@@ -1220,7 +1220,7 @@ namespace NadekoBot.Modules.Administration.Services
{
using (var uow = _db.GetDbContext())
{
var newLogSetting = uow.GuildConfigs.LogSettingsFor(guildId).LogSetting;
var newLogSetting = uow._context.LogSettingsFor(guildId).LogSetting;
switch (logChannelType)
{
case LogType.Other:

View File

@@ -173,7 +173,7 @@ namespace NadekoBot.Modules.Administration.Services
{
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(guildId, set => set);
var config = uow._context.GuildConfigsForId(guildId, set => set);
config.MuteRoleName = name;
GuildMuteRoles.AddOrUpdate(guildId, name, (id, old) => name);
await uow.SaveChangesAsync();
@@ -191,7 +191,7 @@ namespace NadekoBot.Modules.Administration.Services
StopTimer(usr.GuildId, usr.Id, TimerType.Mute);
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(usr.Guild.Id,
var config = uow._context.GuildConfigsForId(usr.Guild.Id,
set => set.Include(gc => gc.MutedUsers)
.Include(gc => gc.UnmuteTimers));
config.MutedUsers.Add(new MutedUserId()
@@ -231,7 +231,7 @@ namespace NadekoBot.Modules.Administration.Services
StopTimer(guildId, usrId, TimerType.Mute);
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(guildId, set => set.Include(gc => gc.MutedUsers)
var config = uow._context.GuildConfigsForId(guildId, set => set.Include(gc => gc.MutedUsers)
.Include(gc => gc.UnmuteTimers));
var match = new MutedUserId()
{
@@ -326,7 +326,7 @@ namespace NadekoBot.Modules.Administration.Services
await MuteUser(user, mod, muteType, reason).ConfigureAwait(false); // mute the user. This will also remove any previous unmute timers
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(user.GuildId, set => set.Include(x => x.UnmuteTimers));
var config = uow._context.GuildConfigsForId(user.GuildId, set => set.Include(x => x.UnmuteTimers));
config.UnmuteTimers.Add(new UnmuteTimer()
{
UserId = user.Id,
@@ -343,7 +343,7 @@ namespace NadekoBot.Modules.Administration.Services
await guild.AddBanAsync(user.Id, 0, reason).ConfigureAwait(false);
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(guild.Id, set => set.Include(x => x.UnbanTimer));
var config = uow._context.GuildConfigsForId(guild.Id, set => set.Include(x => x.UnbanTimer));
config.UnbanTimer.Add(new UnbanTimer()
{
UserId = user.Id,
@@ -360,7 +360,7 @@ namespace NadekoBot.Modules.Administration.Services
await user.AddRoleAsync(role).ConfigureAwait(false);
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(user.GuildId, set => set.Include(x => x.UnroleTimer));
var config = uow._context.GuildConfigsForId(user.GuildId, set => set.Include(x => x.UnroleTimer));
config.UnroleTimer.Add(new UnroleTimer()
{
UserId = user.Id,
@@ -458,12 +458,12 @@ namespace NadekoBot.Modules.Administration.Services
object toDelete;
if (type == TimerType.Mute)
{
var config = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.UnmuteTimers));
var config = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.UnmuteTimers));
toDelete = config.UnmuteTimers.FirstOrDefault(x => x.UserId == userId);
}
else
{
var config = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.UnbanTimer));
var config = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.UnbanTimer));
toDelete = config.UnbanTimer.FirstOrDefault(x => x.UserId == userId);
}
if (toDelete != null)

View File

@@ -114,7 +114,7 @@ namespace NadekoBot.Modules.Administration.Services
private Task _bot_JoinedGuild(GuildConfig gc)
{
using var uow = _db.GetDbContext();
var gcWithData = uow.GuildConfigs.ForId(gc.GuildId,
var gcWithData = uow._context.GuildConfigsForId(gc.GuildId,
set => set
.Include(x => x.AntiRaidSetting)
.Include(x => x.AntiAltSetting)
@@ -304,7 +304,7 @@ namespace NadekoBot.Modules.Administration.Services
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.AntiRaidSetting));
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.AntiRaidSetting));
gc.AntiRaidSetting = stats.AntiRaidSettings;
await uow.SaveChangesAsync();
@@ -319,7 +319,7 @@ namespace NadekoBot.Modules.Administration.Services
{
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.AntiRaidSetting));
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.AntiRaidSetting));
gc.AntiRaidSetting = null;
uow.SaveChanges();
@@ -336,7 +336,7 @@ namespace NadekoBot.Modules.Administration.Services
removed.UserStats.ForEach(x => x.Value.Dispose());
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.AntiSpamSetting)
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.AntiSpamSetting)
.ThenInclude(x => x.IgnoredChannels));
gc.AntiSpamSetting = null;
@@ -375,7 +375,7 @@ namespace NadekoBot.Modules.Administration.Services
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.AntiSpamSetting));
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.AntiSpamSetting));
if (gc.AntiSpamSetting != null)
{
@@ -402,7 +402,7 @@ namespace NadekoBot.Modules.Administration.Services
bool added;
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.AntiSpamSetting).ThenInclude(x => x.IgnoredChannels));
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.AntiSpamSetting).ThenInclude(x => x.IgnoredChannels));
var spam = gc.AntiSpamSetting;
if (spam is null)
{
@@ -459,7 +459,7 @@ namespace NadekoBot.Modules.Administration.Services
int actionDurationMinutes = 0, ulong? roleId = null)
{
using var uow = _db.GetDbContext();
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.AntiAltSetting));
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.AntiAltSetting));
gc.AntiAltSetting = new AntiAltSetting()
{
Action = action,
@@ -478,7 +478,7 @@ namespace NadekoBot.Modules.Administration.Services
return false;
using var uow = _db.GetDbContext();
var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.AntiAltSetting));
var gc = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.AntiAltSetting));
gc.AntiAltSetting = null;
await uow.SaveChangesAsync();
return true;

View File

@@ -156,7 +156,7 @@ namespace NadekoBot.Modules.Administration.Services
{
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(id, set => set
var gc = uow._context.GuildConfigsForId(id, set => set
.Include(x => x.ReactionRoleMessages)
.ThenInclude(x => x.ReactionRoles));
if (gc.ReactionRoleMessages.Count >= 10)
@@ -174,7 +174,7 @@ namespace NadekoBot.Modules.Administration.Services
{
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(id,
var gc = uow._context.GuildConfigsForId(id,
set => set.Include(x => x.ReactionRoleMessages)
.ThenInclude(x => x.ReactionRoles));
uow._context.Set<ReactionRole>()

View File

@@ -6,10 +6,12 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NadekoBot.Modules.Administration;
using NadekoBot.Modules.Xp;
using NadekoBot.Modules.Administration.Common;
using NadekoBot.Modules.Xp.Common;
namespace NadekoBot.Core.Modules.Administration.Services
namespace NadekoBot.Modules.Administration.Services
{
public class SelfAssignedRolesService : INService
{
@@ -63,7 +65,7 @@ namespace NadekoBot.Core.Modules.Administration.Services
bool newval;
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(guildId, set => set);
var config = uow._context.GuildConfigsForId(guildId, set => set);
newval = config.AutoDeleteSelfAssignedRoleMessages = !config.AutoDeleteSelfAssignedRoleMessages;
uow.SaveChanges();
}
@@ -75,7 +77,7 @@ namespace NadekoBot.Core.Modules.Administration.Services
LevelStats userLevelData;
using (var uow = _db.GetDbContext())
{
var stats = uow.Xp.GetOrCreateUser(guildUser.Guild.Id, guildUser.Id);
var stats = uow._context.GetOrCreateUserXpStats(guildUser.Guild.Id, guildUser.Id);
userLevelData = new LevelStats(stats.Xp + stats.AwardedXp);
}
@@ -137,7 +139,7 @@ namespace NadekoBot.Core.Modules.Administration.Services
bool set = false;
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guildId, y => y.Include(x => x.SelfAssignableRoleGroupNames));
var gc = uow._context.GuildConfigsForId(guildId, y => y.Include(x => x.SelfAssignableRoleGroupNames));
var toUpdate = gc.SelfAssignableRoleGroupNames.FirstOrDefault(x => x.Number == group);
if (string.IsNullOrWhiteSpace(name))
@@ -205,7 +207,7 @@ namespace NadekoBot.Core.Modules.Administration.Services
{
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guildId, set => set);
var gc = uow._context.GuildConfigsForId(guildId, set => set);
var autoDelete = gc.AutoDeleteSelfAssignedRoleMessages;
var exclusive = gc.ExclusiveSelfAssignedRoles;
var roles = uow._context.SelfAssignableRoles.GetFromGuild(guildId);
@@ -239,7 +241,7 @@ namespace NadekoBot.Core.Modules.Administration.Services
bool areExclusive;
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(guildId, set => set);
var config = uow._context.GuildConfigsForId(guildId, set => set);
areExclusive = config.ExclusiveSelfAssignedRoles = !config.ExclusiveSelfAssignedRoles;
uow.SaveChanges();
@@ -255,7 +257,7 @@ namespace NadekoBot.Core.Modules.Administration.Services
IDictionary<int, string> groupNames;
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigs.ForId(guild.Id, set => set.Include(x => x.SelfAssignableRoleGroupNames));
var gc = uow._context.GuildConfigsForId(guild.Id, set => set.Include(x => x.SelfAssignableRoleGroupNames));
exclusive = gc.ExclusiveSelfAssignedRoles;
groupNames = gc.SelfAssignableRoleGroupNames.ToDictionary(x => x.Number, x => x.Name);
var roleModels = uow._context.SelfAssignableRoles.GetFromGuild(guild.Id);

View File

@@ -61,7 +61,7 @@ namespace NadekoBot.Modules.Administration.Services
List<WarningPunishment> ps;
using (var uow = _db.GetDbContext())
{
ps = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.WarnPunishments))
ps = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.WarnPunishments))
.WarnPunishments;
warnings += uow._context
@@ -191,7 +191,7 @@ WHERE GuildId in (SELECT GuildId FROM GuildConfigs WHERE WarnExpireHours > 0 AND
{
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(guildId, inc => inc);
var config = uow._context.GuildConfigsForId(guildId, inc => inc);
if (config.WarnExpireHours == 0)
return;
@@ -220,7 +220,7 @@ WHERE GuildId={guildId}
public Task<int> GetWarnExpire(ulong guildId)
{
using var uow = _db.GetDbContext();
var config = uow.GuildConfigs.ForId(guildId);
var config = uow._context.GuildConfigsForId(guildId, set => set);
return Task.FromResult(config.WarnExpireHours / 24);
}
@@ -228,7 +228,7 @@ WHERE GuildId={guildId}
{
using (var uow = _db.GetDbContext())
{
var config = uow.GuildConfigs.ForId(guildId, inc => inc);
var config = uow._context.GuildConfigsForId(guildId, inc => inc);
config.WarnExpireHours = days * 24;
config.WarnExpireAction = delete ? WarnExpireAction.Delete : WarnExpireAction.Clear;
@@ -286,7 +286,7 @@ WHERE GuildId={guildId}
using (var uow = _db.GetDbContext())
{
var ps = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.WarnPunishments)).WarnPunishments;
var ps = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.WarnPunishments)).WarnPunishments;
var toDelete = ps.Where(x => x.Count == number);
uow._context.RemoveRange(toDelete);
@@ -310,7 +310,7 @@ WHERE GuildId={guildId}
using (var uow = _db.GetDbContext())
{
var ps = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.WarnPunishments)).WarnPunishments;
var ps = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.WarnPunishments)).WarnPunishments;
var p = ps.FirstOrDefault(x => x.Count == number);
if (p != null)
@@ -326,7 +326,7 @@ WHERE GuildId={guildId}
{
using (var uow = _db.GetDbContext())
{
return uow.GuildConfigs.ForId(guildId, gc => gc.Include(x => x.WarnPunishments))
return uow._context.GuildConfigsForId(guildId, gc => gc.Include(x => x.WarnPunishments))
.WarnPunishments
.OrderBy(x => x.Count)
.ToArray();

View File

@@ -84,7 +84,7 @@ namespace NadekoBot.Modules.Administration.Services
// need to load new guildconfig with vc role included
using (var uow = _db.GetDbContext())
{
var configWithVcRole = uow.GuildConfigs.ForId(
var configWithVcRole = uow._context.GuildConfigsForId(
arg.GuildId,
set => set.Include(x => x.VcRoleInfos)
);
@@ -144,7 +144,7 @@ namespace NadekoBot.Modules.Administration.Services
guildVcRoles.AddOrUpdate(vcId, role, (key, old) => role);
using (var uow = _db.GetDbContext())
{
var conf = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.VcRoleInfos));
var conf = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.VcRoleInfos));
var toDelete = conf.VcRoleInfos.FirstOrDefault(x => x.VoiceChannelId == vcId); // remove old one
if(toDelete != null)
{
@@ -169,7 +169,7 @@ namespace NadekoBot.Modules.Administration.Services
using (var uow = _db.GetDbContext())
{
var conf = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.VcRoleInfos));
var conf = uow._context.GuildConfigsForId(guildId, set => set.Include(x => x.VcRoleInfos));
var toRemove = conf.VcRoleInfos.Where(x => x.VoiceChannelId == vcId).ToList();
uow._context.RemoveRange(toRemove);
uow.SaveChanges();

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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
{

View File

@@ -1,7 +1,7 @@
using System;
using System.Linq;
namespace NadekoBot.Core.Modules.Gambling.Common
namespace NadekoBot.Modules.Gambling.Common
{
public class Betroll
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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>
{

View File

@@ -1,4 +1,4 @@
namespace NadekoBot.Core.Modules.Gambling.Common
namespace NadekoBot.Modules.Gambling.Common
{
public class Payout
{

View File

@@ -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
{

View File

@@ -1,4 +1,4 @@
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
namespace NadekoBot.Modules.Gambling.Common.Waifu
{
public enum AffinityTitle
{

View File

@@ -1,4 +1,4 @@
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
namespace NadekoBot.Modules.Gambling.Common.Waifu
{
public enum ClaimTitle
{

View File

@@ -1,4 +1,4 @@
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
namespace NadekoBot.Modules.Gambling.Common.Waifu
{
public enum DivorceResult
{

View File

@@ -1,4 +1,4 @@
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
namespace NadekoBot.Modules.Gambling.Common.Waifu
{
public enum WaifuClaimResult
{

View File

@@ -1,4 +1,4 @@
namespace NadekoBot.Core.Modules.Gambling.Common.Waifu
namespace NadekoBot.Modules.Gambling.Common.Waifu
{
public struct WaifuProfileTitle
{

View File

@@ -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

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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

View File

@@ -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

View File

@@ -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
{

View File

@@ -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

View File

@@ -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
{

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
{

View File

@@ -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));

View File

@@ -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;

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -1,9 +1,11 @@
using Discord;
using Discord.Commands;
using NadekoBot.Core.Services;
using NadekoBot.Services;
using System;
using System.Threading.Tasks;
using NadekoBot.Common.Attributes;
using NadekoBot.Core.Services;
using NadekoBot.Modules.Administration;
using NadekoBot.Modules.Games.Services;
using NadekoBot.Modules.Games.Common.ChatterBot;
@@ -32,7 +34,7 @@ namespace NadekoBot.Modules.Games
{
using (var uow = _db.GetDbContext())
{
uow.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, false);
uow._context.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, false);
await uow.SaveChangesAsync();
}
await ReplyConfirmLocalizedAsync("cleverbot_disabled").ConfigureAwait(false);
@@ -43,7 +45,7 @@ namespace NadekoBot.Modules.Games
using (var uow = _db.GetDbContext())
{
uow.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, true);
uow._context.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, true);
await uow.SaveChangesAsync();
}

View File

@@ -1,10 +1,12 @@
using System.Threading.Tasks;
using Discord;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Core.Services;
using NadekoBot.Services.Database.Models;
using NadekoBot.Services;
using System;
using System.Linq;
using System.Threading;
using NadekoBot.Core.Services;
using NadekoBot.Core.Services.Database.Models;
namespace NadekoBot.Modules.Games.Common
{

View File

@@ -6,8 +6,10 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using CommandLine;
using NadekoBot.Common;
using NadekoBot.Core.Common;
using NadekoBot.Core.Services;
using NadekoBot.Services;
namespace NadekoBot.Modules.Games.Common
{

View File

@@ -10,7 +10,7 @@ using Discord.Net;
using Discord.WebSocket;
using NadekoBot.Extensions;
using NadekoBot.Core.Services;
using NadekoBot.Core.Modules.Games.Common.Trivia;
using NadekoBot.Modules.Games.Common.Trivia;
using NadekoBot.Modules.Games.Services;
using Serilog;

View File

@@ -1,7 +1,7 @@
using CommandLine;
using NadekoBot.Core.Common;
namespace NadekoBot.Core.Modules.Games.Common.Trivia
namespace NadekoBot.Modules.Games.Common.Trivia
{
public class TriviaOptions : INadekoCommandOptions
{

View File

@@ -7,8 +7,7 @@ using NadekoBot.Modules.Administration.Services;
using NadekoBot.Modules.Gambling.Services;
using System.Linq;
using System.Threading.Tasks;
using NadekoBot.Core.Modules.Gambling.Common;
using NadekoBot.Core.Modules.Gambling.Services;
using NadekoBot.Modules.Gambling.Common;
namespace NadekoBot.Modules.Games
{

View File

@@ -6,9 +6,11 @@ using Discord;
using Discord.WebSocket;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Modules.Games.Common;
using NadekoBot.Services;
using NadekoBot.Services.Database.Models;
using NadekoBot.Common.Collections;
using NadekoBot.Core.Services;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Common.Collections;
using NadekoBot.Extensions;
using Serilog;

View File

@@ -8,7 +8,6 @@ using NadekoBot.Common.Attributes;
using NadekoBot.Modules.Games.Common.Trivia;
using NadekoBot.Modules.Games.Services;
using NadekoBot.Core.Common;
using NadekoBot.Core.Modules.Games.Common.Trivia;
namespace NadekoBot.Modules.Games
{

View File

@@ -1,7 +1,7 @@
using CommandLine;
using NadekoBot.Core.Common;
namespace NadekoBot.Core.Modules.Help.Common
namespace NadekoBot.Modules.Help.Common
{
public class CommandsOptions : INadekoCommandOptions
{

View File

@@ -4,7 +4,7 @@ using NadekoBot.Common;
using NadekoBot.Common.Attributes;
using NadekoBot.Common.Replacements;
using NadekoBot.Core.Common;
using NadekoBot.Core.Modules.Help.Common;
using NadekoBot.Modules.Help.Common;
using NadekoBot.Core.Services;
using NadekoBot.Extensions;
using NadekoBot.Modules.Help.Services;

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);

View File

@@ -12,7 +12,6 @@ using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using NadekoBot.Core.Modules.Searches.Common;
using Serilog;
namespace NadekoBot.Modules.NSFW

Some files were not shown because too many files have changed in this diff Show More