mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Updated some namespaces, finished some todos. v5 should be cancelled probably as the code is too intertwined to make it modular
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using LinqToDB.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Db.Models;
|
||||
using NadekoBot.Services.Database;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using LinqToDB;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
@@ -29,10 +29,8 @@ public static class QuoteExtensions
|
||||
ulong guildId,
|
||||
string keyword)
|
||||
{
|
||||
// todo figure shuffle out
|
||||
return (await quotes.AsQueryable().Where(q => q.GuildId == guildId && q.Keyword == keyword).ToListAsync())
|
||||
.Shuffle()
|
||||
.FirstOrDefault();
|
||||
return (await quotes.AsQueryable().Where(q => q.GuildId == guildId && q.Keyword == keyword).ToArrayAsync())
|
||||
.RandomOrDefault();
|
||||
}
|
||||
|
||||
public static async Task<Quote> SearchQuoteKeywordTextAsync(
|
||||
@@ -41,15 +39,13 @@ public static class QuoteExtensions
|
||||
string keyword,
|
||||
string text)
|
||||
{
|
||||
var rngk = new NadekoRandom();
|
||||
return (await quotes.AsQueryable()
|
||||
.Where(q => q.GuildId == guildId
|
||||
&& (keyword == null || q.Keyword == keyword)
|
||||
&& (EF.Functions.Like(q.Text.ToUpper(), $"%{text.ToUpper()}%")
|
||||
|| EF.Functions.Like(q.AuthorName, text)))
|
||||
.ToListAsync())
|
||||
.OrderBy(_ => rngk.Next())
|
||||
.FirstOrDefault();
|
||||
.ToArrayAsync())
|
||||
.RandomOrDefault();
|
||||
}
|
||||
|
||||
public static void RemoveAllByKeyword(this DbSet<Quote> quotes, ulong guildId, string keyword)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
|
@@ -2,8 +2,8 @@
|
||||
using LinqToDB;
|
||||
using LinqToDB.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
|
@@ -7,12 +7,11 @@
|
||||
//
|
||||
// // nadekobot
|
||||
global using NadekoBot;
|
||||
global using NadekoBot.Services;
|
||||
global using Nadeko.Common;
|
||||
// global using NadekoBot.Common; // old + nadekobot specific things
|
||||
// global using NadekoBot.Common.Attributes;
|
||||
// global using NadekoBot.Extensions;
|
||||
// global using Nadeko.Snake;
|
||||
// global using Nadeko.Medusa;
|
||||
|
||||
// // discord
|
||||
// global using Discord;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class AutoCommand : DbEntity
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class AutoTranslateChannel : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class AutoTranslateUser : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class BlacklistEntry : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class CommandAlias : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class CommandCooldown : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class CurrencyTransaction : DbEntity
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class DelMsgOnCmdChannel : DbEntity
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using Nadeko.Bot.Db;
|
||||
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class DiscordPermOverride : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class CurrencyEvent
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class FeedSub : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class GCChannelId : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class GamblingStats : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class GroupName : DbEntity
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class GuildConfig : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class IgnoredLogItem : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class IgnoredVoicePresenceChannel : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class ImageOnlyChannel : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class LogSetting : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class NsfwBlacklistedTag : DbEntity
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
[DebuggerDisplay("{PrimaryTarget}{SecondaryTarget} {SecondaryTargetName} {State} {PrimaryTargetId}")]
|
||||
public class Permissionv2 : DbEntity, IIndexed
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class PlantedCurrency : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class PlaylistSong : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class Poll : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class PollVote : DbEntity
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class ReactionRoleV2 : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class Reminder : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class Repeater
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using Nadeko.Bot.Db;
|
||||
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class RotatingPlayingStatus : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class SelfAssignedRole : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public enum ShopEntryType
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class StreamRoleSettings : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class VcRoleInfo : DbEntity
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class AntiAltSetting
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
|
||||
// todo db required, nullable?
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class AntiSpamIgnore : DbEntity
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class AntiSpamSetting : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class NadekoExpression : DbEntity
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class Quote : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class FilterChannelId : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class FilterLinksChannelId : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class FilteredWord : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class BanTemplate : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class MutedUserId : DbEntity
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public enum PunishmentAction
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public enum WarnExpireAction
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class Warning : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class WarningPunishment : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class SlowmodeIgnoredRole : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class SlowmodeIgnoredUser : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class RewardedUser : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class UnbanTimer : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class UnmuteTimer : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class UnroleTimer : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class UserXpStats : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
|
||||
public class XpSettings : DbEntity
|
||||
{
|
||||
|
Reference in New Issue
Block a user