diff --git a/src/EllieBot/Db/EllieContext.cs b/src/EllieBot/Db/EllieContext.cs index f995daa..b5fffda 100644 --- a/src/EllieBot/Db/EllieContext.cs +++ b/src/EllieBot/Db/EllieContext.cs @@ -11,7 +11,7 @@ namespace EllieBot.Services.Database; public abstract class EllieContext : DbContext { public DbSet GuildConfigs { get; set; } - + public DbSet Quotes { get; set; } public DbSet Reminders { get; set; } public DbSet SelfAssignableRoles { get; set; } @@ -60,8 +60,8 @@ public abstract class EllieContext : DbContext public DbSet PatronQuotas { get; set; } public DbSet StreamOnlineMessages { get; set; } - - + + #region Mandatory Provider-Specific Values protected abstract string CurrencyTransactionOtherIdDefaultValue { get; } diff --git a/src/EllieBot/Db/Extensions/ClubExtensions.cs b/src/EllieBot/Db/Extensions/ClubExtensions.cs index d8183fc..88a851b 100644 --- a/src/EllieBot/Db/Extensions/ClubExtensions.cs +++ b/src/EllieBot/Db/Extensions/ClubExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using Microsoft.EntityFrameworkCore; using EllieBot.Db.Models; diff --git a/src/EllieBot/Db/Extensions/CurrencyTransactionExtensions.cs b/src/EllieBot/Db/Extensions/CurrencyTransactionExtensions.cs index c6659ca..4bd2439 100644 --- a/src/EllieBot/Db/Extensions/CurrencyTransactionExtensions.cs +++ b/src/EllieBot/Db/Extensions/CurrencyTransactionExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database.Models; @@ -12,9 +12,9 @@ public static class CurrencyTransactionExtensions ulong userId, int page) => set.ToLinqToDBTable() - .Where(x => x.UserId == userId) - .OrderByDescending(x => x.DateAdded) - .Skip(15 * page) - .Take(15) - .ToListAsyncLinqToDB(); + .Where(x => x.UserId == userId) + .OrderByDescending(x => x.DateAdded) + .Skip(15 * page) + .Take(15) + .ToListAsyncLinqToDB(); } \ No newline at end of file diff --git a/src/EllieBot/Db/Extensions/DbExtensions.cs b/src/EllieBot/Db/Extensions/DbExtensions.cs index 6878b31..568643b 100644 --- a/src/EllieBot/Db/Extensions/DbExtensions.cs +++ b/src/EllieBot/Db/Extensions/DbExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database.Models; diff --git a/src/EllieBot/Db/Extensions/DiscordUserExtensions.cs b/src/EllieBot/Db/Extensions/DiscordUserExtensions.cs index fc165c5..8d94814 100644 --- a/src/EllieBot/Db/Extensions/DiscordUserExtensions.cs +++ b/src/EllieBot/Db/Extensions/DiscordUserExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using LinqToDB; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; diff --git a/src/EllieBot/Db/Extensions/EllieExpressionExtensions.cs b/src/EllieBot/Db/Extensions/EllieExpressionExtensions.cs index 7eaf707..658a631 100644 --- a/src/EllieBot/Db/Extensions/EllieExpressionExtensions.cs +++ b/src/EllieBot/Db/Extensions/EllieExpressionExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using LinqToDB; using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database.Models; diff --git a/src/EllieBot/Db/Extensions/MusicPlayerSettingsExtensions.cs b/src/EllieBot/Db/Extensions/MusicPlayerSettingsExtensions.cs index bbefa11..d8a3d12 100644 --- a/src/EllieBot/Db/Extensions/MusicPlayerSettingsExtensions.cs +++ b/src/EllieBot/Db/Extensions/MusicPlayerSettingsExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database.Models; diff --git a/src/EllieBot/Db/Extensions/MusicPlaylistExtensions.cs b/src/EllieBot/Db/Extensions/MusicPlaylistExtensions.cs index 747d218..e7ac6aa 100644 --- a/src/EllieBot/Db/Extensions/MusicPlaylistExtensions.cs +++ b/src/EllieBot/Db/Extensions/MusicPlaylistExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database.Models; @@ -8,7 +8,7 @@ public static class MusicPlaylistExtensions { public static List GetPlaylistsOnPage(this DbSet playlists, int num) { - if (num < 0) + if (num < 1) throw new ArgumentOutOfRangeException(nameof(num)); return playlists.AsQueryable().Skip((num - 1) * 20).Take(20).Include(pl => pl.Songs).ToList(); diff --git a/src/EllieBot/Db/Extensions/PollExtensions.cs b/src/EllieBot/Db/Extensions/PollExtensions.cs index abbf992..8491d65 100644 --- a/src/EllieBot/Db/Extensions/PollExtensions.cs +++ b/src/EllieBot/Db/Extensions/PollExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database; using EllieBot.Services.Database.Models; @@ -20,9 +20,15 @@ public static class PollExtensions if (p.Votes is not null) { ctx.RemoveRange(p.Votes); + p.Votes.Clear(); + } + + if (p.Answers is not null) + { + ctx.RemoveRange(p.Answers); p.Answers.Clear(); } - + ctx.Poll.Remove(p); } } \ No newline at end of file diff --git a/src/EllieBot/Db/Extensions/ReminderExtensions.cs b/src/EllieBot/Db/Extensions/ReminderExtensions.cs index 33a79ca..1fd519f 100644 --- a/src/EllieBot/Db/Extensions/ReminderExtensions.cs +++ b/src/EllieBot/Db/Extensions/ReminderExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database.Models; diff --git a/src/EllieBot/Db/Extensions/SelfAssignableRolesExtensions.cs b/src/EllieBot/Db/Extensions/SelfAssignableRolesExtensions.cs index ee6ef7b..b2e3e39 100644 --- a/src/EllieBot/Db/Extensions/SelfAssignableRolesExtensions.cs +++ b/src/EllieBot/Db/Extensions/SelfAssignableRolesExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database.Models; diff --git a/src/EllieBot/Db/Extensions/UserXpExtensions.cs b/src/EllieBot/Db/Extensions/UserXpExtensions.cs index be1d97f..a20071b 100644 --- a/src/EllieBot/Db/Extensions/UserXpExtensions.cs +++ b/src/EllieBot/Db/Extensions/UserXpExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using LinqToDB; using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database; diff --git a/src/EllieBot/Db/Extensions/WaifuExtensions.cs b/src/EllieBot/Db/Extensions/WaifuExtensions.cs index ee1fddf..97d9cf4 100644 --- a/src/EllieBot/Db/Extensions/WaifuExtensions.cs +++ b/src/EllieBot/Db/Extensions/WaifuExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using LinqToDB; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; diff --git a/src/EllieBot/Db/Extensions/WarningExtensions.cs b/src/EllieBot/Db/Extensions/WarningExtensions.cs index 59474d2..76d0815 100644 --- a/src/EllieBot/Db/Extensions/WarningExtensions.cs +++ b/src/EllieBot/Db/Extensions/WarningExtensions.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using Microsoft.EntityFrameworkCore; using EllieBot.Services.Database.Models; diff --git a/src/EllieBot/Db/Models/AntiProtection.cs b/src/EllieBot/Db/Models/AntiProtection.cs index 2301b42..8539496 100644 --- a/src/EllieBot/Db/Models/AntiProtection.cs +++ b/src/EllieBot/Db/Models/AntiProtection.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class AntiRaidSetting : DbEntity @@ -11,10 +11,10 @@ public class AntiRaidSetting : DbEntity public PunishmentAction Action { get; set; } /// - /// Duration of the punishment, in minutes. This works only in supported Actions, like: - /// Mute, ChatMute, VoiceMute, etc... + /// Duration of the punishment, in minutes. This works only for supported Actions, like: + /// Mute, Chatmute, Voicemute, etc... /// - public int PunishmentDuration { get; set; } + public int PunishDuration { get; set; } } public class AntiSpamSetting : DbEntity @@ -57,9 +57,9 @@ public class AntiSpamIgnore : DbEntity { public ulong ChannelId { get; set; } - public override int GetHashCode() + public override int GetHashCode() => ChannelId.GetHashCode(); - public override bool Equals(object obj) + public override bool Equals(object obj) => obj is AntiSpamIgnore inst ? inst.ChannelId == ChannelId : false; } \ No newline at end of file diff --git a/src/EllieBot/Db/Models/AutoCommand.cs b/src/EllieBot/Db/Models/AutoCommand.cs index 3738c37..8bcae05 100644 --- a/src/EllieBot/Db/Models/AutoCommand.cs +++ b/src/EllieBot/Db/Models/AutoCommand.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class AutoCommand : DbEntity diff --git a/src/EllieBot/Db/Models/AutoPublishChannel.cs b/src/EllieBot/Db/Models/AutoPublishChannel.cs index fa81769..a19fd28 100644 --- a/src/EllieBot/Db/Models/AutoPublishChannel.cs +++ b/src/EllieBot/Db/Models/AutoPublishChannel.cs @@ -1,4 +1,4 @@ -using EllieBot.Services.Database.Models; +using EllieBot.Services.Database.Models; namespace EllieBot.Db.Models; diff --git a/src/EllieBot/Db/Models/AutoTranslateChannel.cs b/src/EllieBot/Db/Models/AutoTranslateChannel.cs index a90df1e..6f6ef58 100644 --- a/src/EllieBot/Db/Models/AutoTranslateChannel.cs +++ b/src/EllieBot/Db/Models/AutoTranslateChannel.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class AutoTranslateChannel : DbEntity diff --git a/src/EllieBot/Db/Models/AutoTranslateUser.cs b/src/EllieBot/Db/Models/AutoTranslateUser.cs index ebe6754..6e36404 100644 --- a/src/EllieBot/Db/Models/AutoTranslateUser.cs +++ b/src/EllieBot/Db/Models/AutoTranslateUser.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class AutoTranslateUser : DbEntity diff --git a/src/EllieBot/Db/Models/BanTemplate.cs b/src/EllieBot/Db/Models/BanTemplate.cs index cc72275..d32f4c7 100644 --- a/src/EllieBot/Db/Models/BanTemplate.cs +++ b/src/EllieBot/Db/Models/BanTemplate.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class BanTemplate : DbEntity diff --git a/src/EllieBot/Db/Models/BlacklistEntry.cs b/src/EllieBot/Db/Models/BlacklistEntry.cs index 849c3f7..3ecf999 100644 --- a/src/EllieBot/Db/Models/BlacklistEntry.cs +++ b/src/EllieBot/Db/Models/BlacklistEntry.cs @@ -1,3 +1,4 @@ +#nullable disable namespace EllieBot.Services.Database.Models; public class BlacklistEntry : DbEntity diff --git a/src/EllieBot/Db/Models/ClubInfo.cs b/src/EllieBot/Db/Models/ClubInfo.cs index 75d2d1b..8c8f85c 100644 --- a/src/EllieBot/Db/Models/ClubInfo.cs +++ b/src/EllieBot/Db/Models/ClubInfo.cs @@ -9,8 +9,8 @@ public class ClubInfo : DbEntity [MaxLength(20)] public string Name { get; set; } public string Description { get; set; } - public string ImageUrl { get; set; } - + public string ImageUrl { get; set; } = string.Empty; + public int Xp { get; set; } = 0; public int? OwnerId { get; set; } public DiscordUser Owner { get; set; } @@ -27,7 +27,7 @@ public class ClubApplicants { public int ClubId { get; set; } public ClubInfo Club { get; set; } - + public int UserId { get; set; } public DiscordUser User { get; set; } } @@ -36,7 +36,7 @@ public class ClubBans { public int ClubId { get; set; } public ClubInfo Club { get; set; } - + public int UserId { get; set; } public DiscordUser User { get; set; } } \ No newline at end of file diff --git a/src/EllieBot/Db/Models/CommandAlias.cs b/src/EllieBot/Db/Models/CommandAlias.cs index be2a6f1..b3d6fc4 100644 --- a/src/EllieBot/Db/Models/CommandAlias.cs +++ b/src/EllieBot/Db/Models/CommandAlias.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class CommandAlias : DbEntity diff --git a/src/EllieBot/Db/Models/CommandCooldown.cs b/src/EllieBot/Db/Models/CommandCooldown.cs index 2b824ef..f25cd08 100644 --- a/src/EllieBot/Db/Models/CommandCooldown.cs +++ b/src/EllieBot/Db/Models/CommandCooldown.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class CommandCooldown : DbEntity diff --git a/src/EllieBot/Db/Models/DelMsgOnCmdChannel.cs b/src/EllieBot/Db/Models/DelMsgOnCmdChannel.cs index 59ac41d..6a24297 100644 --- a/src/EllieBot/Db/Models/DelMsgOnCmdChannel.cs +++ b/src/EllieBot/Db/Models/DelMsgOnCmdChannel.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class DelMsgOnCmdChannel : DbEntity @@ -9,6 +9,6 @@ public class DelMsgOnCmdChannel : DbEntity public override int GetHashCode() => ChannelId.GetHashCode(); - public override bool Equals(object obj) + public override bool Equals(object obj) => obj is DelMsgOnCmdChannel x && x.ChannelId == ChannelId; } \ No newline at end of file diff --git a/src/EllieBot/Db/Models/DiscordPermOverride.cs b/src/EllieBot/Db/Models/DiscordPemOverride.cs similarity index 100% rename from src/EllieBot/Db/Models/DiscordPermOverride.cs rename to src/EllieBot/Db/Models/DiscordPemOverride.cs diff --git a/src/EllieBot/Db/Models/DiscordUser.cs b/src/EllieBot/Db/Models/DiscordUser.cs index aa52e19..5f8cc7b 100644 --- a/src/EllieBot/Db/Models/DiscordUser.cs +++ b/src/EllieBot/Db/Models/DiscordUser.cs @@ -10,20 +10,20 @@ public class DiscordUser : DbEntity public string Username { get; set; } public string Discriminator { get; set; } public string AvatarId { get; set; } - + public int? ClubId { get; set; } public ClubInfo Club { get; set; } public bool IsClubAdmin { get; set; } - + public long TotalXp { get; set; } public XpNotificationLocation NotifyOnLevelUp { get; set; } - + public long CurrencyAmount { get; set; } public override bool Equals(object obj) => obj is DiscordUser du ? du.UserId == UserId : false; - public override int GetHashCode() + public override int GetHashCode() => UserId.GetHashCode(); public override string ToString() diff --git a/src/EllieBot/Db/Models/EllieExpression.cs b/src/EllieBot/Db/Models/EllieExpression.cs index 9218e0c..28c75f1 100644 --- a/src/EllieBot/Db/Models/EllieExpression.cs +++ b/src/EllieBot/Db/Models/EllieExpression.cs @@ -6,14 +6,15 @@ public class EllieExpression : DbEntity public ulong? GuildId { get; set; } public string Response { get; set; } public string Trigger { get; set; } - + public bool AutoDeleteTrigger { get; set; } public bool DmResponse { get; set; } public bool ContainsAnywhere { get; set; } public bool AllowTarget { get; set; } + public string Reactions { get; set; } public string[] GetReactions() - => string.IsNullOrWhiteSpace(Reaactions) ? Array.Empty() : Reaactions.Split("@@@"); + => string.IsNullOrWhiteSpace(Reactions) ? Array.Empty() : Reactions.Split("@@@"); public bool IsGlobal() => GuildId is null or 0; diff --git a/src/EllieBot/Db/Models/Event.cs b/src/EllieBot/Db/Models/Event.cs new file mode 100644 index 0000000..bface52 --- /dev/null +++ b/src/EllieBot/Db/Models/Event.cs @@ -0,0 +1,49 @@ +#nullable disable +namespace EllieBot.Services.Database.Models; + +public class CurrencyEvent +{ + public enum Type + { + Reaction, + + GameStatus + //NotRaid, + } + + public ulong ServerId { get; set; } + public ulong ChannelId { get; set; } + public ulong MessageId { get; set; } + public Type EventType { get; set; } + + /// + /// Amount of currency that the user will be rewarded. + /// + public long Amount { get; set; } + + /// + /// Maximum amount of currency that can be handed out. + /// + public long PotSize { get; set; } + + public List AwardedUsers { get; set; } + + /// + /// Used as extra data storage for events which need it. + /// + public ulong ExtraId { get; set; } + + /// + /// May be used for some future event. + /// + public ulong ExtraId2 { get; set; } + + /// + /// May be used for some future event. + /// + public string ExtraString { get; set; } +} + +public class AwardedUser +{ +} \ No newline at end of file diff --git a/src/EllieBot/Db/Models/FeedSub.cs b/src/EllieBot/Db/Models/FeedSub.cs index f15aa81..f5fccc6 100644 --- a/src/EllieBot/Db/Models/FeedSub.cs +++ b/src/EllieBot/Db/Models/FeedSub.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class FeedSub : DbEntity @@ -8,7 +8,7 @@ public class FeedSub : DbEntity public ulong ChannelId { get; set; } public string Url { get; set; } - + public string Message { get; set; } public override int GetHashCode() diff --git a/src/EllieBot/Db/Models/FilterChannelId.cs b/src/EllieBot/Db/Models/FilterChannelId.cs index e674ec2..9eaf8fa 100644 --- a/src/EllieBot/Db/Models/FilterChannelId.cs +++ b/src/EllieBot/Db/Models/FilterChannelId.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class FilterChannelId : DbEntity @@ -11,7 +11,7 @@ public class FilterChannelId : DbEntity public override bool Equals(object obj) => obj is FilterChannelId fci && Equals(fci); - public override int GetHashCode() + public override int GetHashCode() => ChannelId.GetHashCode(); } @@ -22,7 +22,7 @@ public class FilterWordsChannelId : DbEntity public bool Equals(FilterWordsChannelId other) => ChannelId == other.ChannelId; - public override bool Equals(object obj) + public override bool Equals(object obj) => obj is FilterWordsChannelId fci && Equals(fci); public override int GetHashCode() diff --git a/src/EllieBot/Db/Models/FilterLinksChannelId.cs b/src/EllieBot/Db/Models/FilterLinksChannelId.cs index 440085e..f48d9b4 100644 --- a/src/EllieBot/Db/Models/FilterLinksChannelId.cs +++ b/src/EllieBot/Db/Models/FilterLinksChannelId.cs @@ -1,13 +1,13 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class FilterLinksChannelId : DbEntity { public ulong ChannelId { get; set; } - public override bool Equals(object obj) + public override bool Equals(object obj) => obj is FilterLinksChannelId f && f.ChannelId == ChannelId; - public override int GetHashCode() + public override int GetHashCode() => ChannelId.GetHashCode(); } \ No newline at end of file diff --git a/src/EllieBot/Db/Models/FilteredWord.cs b/src/EllieBot/Db/Models/FilteredWord.cs index 5a5ee93..4ff32f7 100644 --- a/src/EllieBot/Db/Models/FilteredWord.cs +++ b/src/EllieBot/Db/Models/FilteredWord.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class FilteredWord : DbEntity diff --git a/src/EllieBot/Db/Models/FollowedStream.cs b/src/EllieBot/Db/Models/FollowedStream.cs index 3a96846..ca119b4 100644 --- a/src/EllieBot/Db/Models/FollowedStream.cs +++ b/src/EllieBot/Db/Models/FollowedStream.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using EllieBot.Modules.Searches.Common; using EllieBot.Services.Database.Models; diff --git a/src/EllieBot/Db/Models/GCChannelId.cs b/src/EllieBot/Db/Models/GCChannelId.cs index 387605c..1f265d7 100644 --- a/src/EllieBot/Db/Models/GCChannelId.cs +++ b/src/EllieBot/Db/Models/GCChannelId.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class GCChannelId : DbEntity @@ -6,9 +6,9 @@ public class GCChannelId : DbEntity public GuildConfig GuildConfig { get; set; } public ulong ChannelId { get; set; } - public override bool Equals(object obj) + public override bool Equals(object obj) => obj is GCChannelId gc && gc.ChannelId == ChannelId; - public override int GetHashCode() + public override int GetHashCode() => ChannelId.GetHashCode(); } \ No newline at end of file diff --git a/src/EllieBot/Db/Models/GroupName.cs b/src/EllieBot/Db/Models/GroupName.cs index 52ef07b..de88717 100644 --- a/src/EllieBot/Db/Models/GroupName.cs +++ b/src/EllieBot/Db/Models/GroupName.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class GroupName : DbEntity diff --git a/src/EllieBot/Db/Models/GuildConfig.cs b/src/EllieBot/Db/Models/GuildConfig.cs index 5346489..b05df52 100644 --- a/src/EllieBot/Db/Models/GuildConfig.cs +++ b/src/EllieBot/Db/Models/GuildConfig.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using EllieBot.Db.Models; namespace EllieBot.Services.Database.Models; diff --git a/src/EllieBot/Db/Models/LogSetting.cs b/src/EllieBot/Db/Models/LogSetting.cs index b09371a..93228ca 100644 --- a/src/EllieBot/Db/Models/LogSetting.cs +++ b/src/EllieBot/Db/Models/LogSetting.cs @@ -26,10 +26,10 @@ public class LogSetting : DbEntity public ulong? UserMutedId { get; set; } - // userpresence + //userpresence public ulong? LogUserPresenceId { get; set; } - // voicepresence + //voicepresence public ulong? LogVoicePresenceId { get; set; } public ulong? LogVoicePresenceTTSId { get; set; } diff --git a/src/EllieBot/Db/Models/MutedUserId.cs b/src/EllieBot/Db/Models/MutedUserId.cs index 2d752f6..78fc9f3 100644 --- a/src/EllieBot/Db/Models/MutedUserId.cs +++ b/src/EllieBot/Db/Models/MutedUserId.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class MutedUserId : DbEntity diff --git a/src/EllieBot/Db/Models/PatronQuota.cs b/src/EllieBot/Db/Models/PatronQuota.cs index ba5129d..1ebd2fd 100644 --- a/src/EllieBot/Db/Models/PatronQuota.cs +++ b/src/EllieBot/Db/Models/PatronQuota.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Db.Models; /// diff --git a/src/EllieBot/Db/Models/Permission.cs b/src/EllieBot/Db/Models/Permission.cs index 61089f6..24a8186 100644 --- a/src/EllieBot/Db/Models/Permission.cs +++ b/src/EllieBot/Db/Models/Permission.cs @@ -1,10 +1,9 @@ -#nullable disable +#nullable disable using System.ComponentModel.DataAnnotations.Schema; using System.Diagnostics; namespace EllieBot.Services.Database.Models; - [DebuggerDisplay("{PrimaryTarget}{SecondaryTarget} {SecondaryTargetName} {State} {PrimaryTargetId}")] public class Permissionv2 : DbEntity, IIndexed { diff --git a/src/EllieBot/Db/Models/SelfAssignableRole.cs b/src/EllieBot/Db/Models/SelfAssignableRole.cs index df6cd48..c68fd32 100644 --- a/src/EllieBot/Db/Models/SelfAssignableRole.cs +++ b/src/EllieBot/Db/Models/SelfAssignableRole.cs @@ -5,7 +5,7 @@ public class SelfAssignedRole : DbEntity { public ulong GuildId { get; set; } public ulong RoleId { get; set; } - + public int Group { get; set; } public int LevelRequirement { get; set; } } \ No newline at end of file diff --git a/src/EllieBot/Db/Models/ShopEntry.cs b/src/EllieBot/Db/Models/ShopEntry.cs index ed83cb1..6d08ab3 100644 --- a/src/EllieBot/Db/Models/ShopEntry.cs +++ b/src/EllieBot/Db/Models/ShopEntry.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public enum ShopEntryType diff --git a/src/EllieBot/Db/Models/SlowmodeIgnoredRole.cs b/src/EllieBot/Db/Models/SlowmodeIgnoredRole.cs index a2d6bdd..4e55546 100644 --- a/src/EllieBot/Db/Models/SlowmodeIgnoredRole.cs +++ b/src/EllieBot/Db/Models/SlowmodeIgnoredRole.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class SlowmodeIgnoredRole : DbEntity diff --git a/src/EllieBot/Db/Models/SlowmodeIgnoredUser.cs b/src/EllieBot/Db/Models/SlowmodeIgnoredUser.cs index 92597c3..c6a62f2 100644 --- a/src/EllieBot/Db/Models/SlowmodeIgnoredUser.cs +++ b/src/EllieBot/Db/Models/SlowmodeIgnoredUser.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class SlowmodeIgnoredUser : DbEntity diff --git a/src/EllieBot/Db/Models/StreamOnlineMessage.cs b/src/EllieBot/Db/Models/StreamOnlineMessage.cs index e9b1e24..2f8c821 100644 --- a/src/EllieBot/Db/Models/StreamOnlineMessage.cs +++ b/src/EllieBot/Db/Models/StreamOnlineMessage.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable using EllieBot.Services.Database.Models; namespace EllieBot.Db.Models; diff --git a/src/EllieBot/Db/Models/StreamRoleSettings.cs b/src/EllieBot/Db/Models/StreamRoleSettings.cs index dbab2d0..8b9b379 100644 --- a/src/EllieBot/Db/Models/StreamRoleSettings.cs +++ b/src/EllieBot/Db/Models/StreamRoleSettings.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class StreamRoleSettings : DbEntity diff --git a/src/EllieBot/Db/Models/UnbanTimer.cs b/src/EllieBot/Db/Models/UnbanTimer.cs index b017624..6878b00 100644 --- a/src/EllieBot/Db/Models/UnbanTimer.cs +++ b/src/EllieBot/Db/Models/UnbanTimer.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class UnbanTimer : DbEntity diff --git a/src/EllieBot/Db/Models/UnmuteTimer.cs b/src/EllieBot/Db/Models/UnmuteTimer.cs index 4619b68..54638ad 100644 --- a/src/EllieBot/Db/Models/UnmuteTimer.cs +++ b/src/EllieBot/Db/Models/UnmuteTimer.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class UnmuteTimer : DbEntity @@ -9,6 +9,6 @@ public class UnmuteTimer : DbEntity public override int GetHashCode() => UserId.GetHashCode(); - public override bool Equals(object obj) + public override bool Equals(object obj) => obj is UnmuteTimer ut ? ut.UserId == UserId : false; } \ No newline at end of file diff --git a/src/EllieBot/Db/Models/UnroleTimer.cs b/src/EllieBot/Db/Models/UnroleTimer.cs index f7c7f8d..ceb0d4c 100644 --- a/src/EllieBot/Db/Models/UnroleTimer.cs +++ b/src/EllieBot/Db/Models/UnroleTimer.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class UnroleTimer : DbEntity diff --git a/src/EllieBot/Db/Models/VcRoleInfo.cs b/src/EllieBot/Db/Models/VcRoleInfo.cs index b80fc17..3f6155e 100644 --- a/src/EllieBot/Db/Models/VcRoleInfo.cs +++ b/src/EllieBot/Db/Models/VcRoleInfo.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class VcRoleInfo : DbEntity diff --git a/src/EllieBot/Db/Models/WaifuItem.cs b/src/EllieBot/Db/Models/WaifuItem.cs index 32df5ba..53b8f8e 100644 --- a/src/EllieBot/Db/Models/WaifuItem.cs +++ b/src/EllieBot/Db/Models/WaifuItem.cs @@ -1,10 +1,10 @@ #nullable disable namespace EllieBot.Services.Database.Models; -public class WaifuItem +public class WaifuItem : DbEntity { public WaifuInfo WaifuInfo { get; set; } public int? WaifuInfoId { get; set; } public string ItemEmoji { get; set; } public string Name { get; set; } -} \ No newline at end of file +} diff --git a/src/EllieBot/Db/Models/WarnExpireAction.cs b/src/EllieBot/Db/Models/WarnExpireAction.cs index caa595f..69d90b8 100644 --- a/src/EllieBot/Db/Models/WarnExpireAction.cs +++ b/src/EllieBot/Db/Models/WarnExpireAction.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public enum WarnExpireAction diff --git a/src/EllieBot/Db/Models/WarningPunishment.cs b/src/EllieBot/Db/Models/WarningPunishment.cs index 02590cd..a0aa731 100644 --- a/src/EllieBot/Db/Models/WarningPunishment.cs +++ b/src/EllieBot/Db/Models/WarningPunishment.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class WarningPunishment : DbEntity diff --git a/src/EllieBot/Db/Models/XpSettings.cs b/src/EllieBot/Db/Models/XpSettings.cs index 066cd07..a0cae1e 100644 --- a/src/EllieBot/Db/Models/XpSettings.cs +++ b/src/EllieBot/Db/Models/XpSettings.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable namespace EllieBot.Services.Database.Models; public class XpSettings : DbEntity diff --git a/src/EllieBot/Db/Models/XpShotOwnedItem.cs b/src/EllieBot/Db/Models/XpShopOwnedItem.cs similarity index 91% rename from src/EllieBot/Db/Models/XpShotOwnedItem.cs rename to src/EllieBot/Db/Models/XpShopOwnedItem.cs index aaba2f6..dc0f641 100644 --- a/src/EllieBot/Db/Models/XpShotOwnedItem.cs +++ b/src/EllieBot/Db/Models/XpShopOwnedItem.cs @@ -1,4 +1,4 @@ -#nullable disable +#nullable disable warnings using EllieBot.Services.Database.Models; namespace EllieBot.Db.Models; diff --git a/src/EllieBot/Db/MysqlContext.cs b/src/EllieBot/Db/MysqlContext.cs index 5406c1d..1474b30 100644 --- a/src/EllieBot/Db/MysqlContext.cs +++ b/src/EllieBot/Db/MysqlContext.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using EllieBot.Db.Models; namespace EllieBot.Services.Database; @@ -8,7 +8,7 @@ public sealed class MysqlContext : EllieContext private readonly string _connStr; private readonly string _version; - protected override string CurrencyTransactionOtherIdDefaultValue + protected override string CurrencyTransactionOtherIdDefaultValue => "NULL"; public MysqlContext(string connStr = "Server=localhost", string version = "8.0") diff --git a/src/EllieBot/Db/PostgreSqlContext.cs b/src/EllieBot/Db/PostgreSqlContext.cs index f254aaf..dba46f6 100644 --- a/src/EllieBot/Db/PostgreSqlContext.cs +++ b/src/EllieBot/Db/PostgreSqlContext.cs @@ -1,12 +1,12 @@ -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; namespace EllieBot.Services.Database; -public class PostgreSqlContext : EllieContext +public sealed class PostgreSqlContext : EllieContext { private readonly string _connStr; - protected override string CurrencyTransactionOtherIdDefaultValue + protected override string CurrencyTransactionOtherIdDefaultValue => "NULL"; public PostgreSqlContext(string connStr = "Host=localhost") diff --git a/src/EllieBot/Db/SqliteContext.cs b/src/EllieBot/Db/SqliteContext.cs index 6744423..530bfb4 100644 --- a/src/EllieBot/Db/SqliteContext.cs +++ b/src/EllieBot/Db/SqliteContext.cs @@ -1,4 +1,4 @@ -using Microsoft.Data.Sqlite; +using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; namespace EllieBot.Services.Database; @@ -7,7 +7,7 @@ public sealed class SqliteContext : EllieContext { private readonly string _connectionString; - protected override string CurrencyTransactionOtherIdDefaultValue + protected override string CurrencyTransactionOtherIdDefaultValue => "NULL"; public SqliteContext(string connectionString = "Data Source=data/EllieBot.db", int commandTimeout = 60)