Global usings and file scoped namespaces

This commit is contained in:
Kwoth
2021-12-19 05:14:11 +01:00
parent bc31dae965
commit ee33313519
548 changed files with 47528 additions and 49115 deletions

View File

@@ -1,68 +1,65 @@
using System;
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class AntiRaidSetting : DbEntity
{
public class AntiRaidSetting : DbEntity
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public int UserThreshold { get; set; }
public int Seconds { get; set; }
public PunishmentAction Action { get; set; }
public int UserThreshold { get; set; }
public int Seconds { get; set; }
public PunishmentAction Action { get; set; }
/// <summary>
/// Duration of the punishment, in minutes. This works only for supported Actions, like:
/// Mute, Chatmute, Voicemute, etc...
/// </summary>
public int PunishDuration { get; set; }
}
public class AntiSpamSetting : DbEntity
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public PunishmentAction Action { get; set; }
public int MessageThreshold { get; set; } = 3;
public int MuteTime { get; set; } = 0;
public ulong? RoleId { get; set; }
public HashSet<AntiSpamIgnore> IgnoredChannels { get; set; } = new HashSet<AntiSpamIgnore>();
}
public class AntiAltSetting
{
public int Id { get; set; }
public int GuildConfigId { get; set; }
public TimeSpan MinAge { get; set; }
public PunishmentAction Action { get; set; }
public int ActionDurationMinutes { get; set; }
public ulong? RoleId { get; set; }
}
public enum PunishmentAction
{
Mute,
Kick,
Ban,
Softban,
RemoveRoles,
ChatMute,
VoiceMute,
AddRole
}
public class AntiSpamIgnore : DbEntity
{
public ulong ChannelId { get; set; }
public override int GetHashCode() => ChannelId.GetHashCode();
public override bool Equals(object obj)
{
return obj is AntiSpamIgnore inst
? inst.ChannelId == ChannelId
: false;
}
}
/// <summary>
/// Duration of the punishment, in minutes. This works only for supported Actions, like:
/// Mute, Chatmute, Voicemute, etc...
/// </summary>
public int PunishDuration { get; set; }
}
public class AntiSpamSetting : DbEntity
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public PunishmentAction Action { get; set; }
public int MessageThreshold { get; set; } = 3;
public int MuteTime { get; set; } = 0;
public ulong? RoleId { get; set; }
public HashSet<AntiSpamIgnore> IgnoredChannels { get; set; } = new HashSet<AntiSpamIgnore>();
}
public class AntiAltSetting
{
public int Id { get; set; }
public int GuildConfigId { get; set; }
public TimeSpan MinAge { get; set; }
public PunishmentAction Action { get; set; }
public int ActionDurationMinutes { get; set; }
public ulong? RoleId { get; set; }
}
public enum PunishmentAction
{
Mute,
Kick,
Ban,
Softban,
RemoveRoles,
ChatMute,
VoiceMute,
AddRole
}
public class AntiSpamIgnore : DbEntity
{
public ulong ChannelId { get; set; }
public override int GetHashCode() => ChannelId.GetHashCode();
public override bool Equals(object obj)
{
return obj is AntiSpamIgnore inst
? inst.ChannelId == ChannelId
: false;
}
}

View File

@@ -1,14 +1,13 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class AutoCommand : DbEntity
{
public class AutoCommand : DbEntity
{
public string CommandText { get; set; }
public ulong ChannelId { get; set; }
public string ChannelName { get; set; }
public ulong? GuildId { get; set; }
public string GuildName { get; set; }
public ulong? VoiceChannelId {get; set; }
public string VoiceChannelName { get; set; }
public int Interval { get; set; }
}
public string CommandText { get; set; }
public ulong ChannelId { get; set; }
public string ChannelName { get; set; }
public ulong? GuildId { get; set; }
public string GuildName { get; set; }
public ulong? VoiceChannelId {get; set; }
public string VoiceChannelName { get; set; }
public int Interval { get; set; }
}

View File

@@ -1,12 +1,9 @@
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class AutoTranslateChannel : DbEntity
{
public class AutoTranslateChannel : DbEntity
{
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public bool AutoDelete { get; set; }
public IList<AutoTranslateUser> Users { get; set; } = new List<AutoTranslateUser>();
}
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public bool AutoDelete { get; set; }
public IList<AutoTranslateUser> Users { get; set; } = new List<AutoTranslateUser>();
}

View File

@@ -1,11 +1,10 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class AutoTranslateUser : DbEntity
{
public class AutoTranslateUser : DbEntity
{
public int ChannelId { get; set; }
public AutoTranslateChannel Channel { get; set; }
public ulong UserId { get; set; }
public string Source { get; set; }
public string Target { get; set; }
}
public int ChannelId { get; set; }
public AutoTranslateChannel Channel { get; set; }
public ulong UserId { get; set; }
public string Source { get; set; }
public string Target { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class BanTemplate : DbEntity
{
public class BanTemplate : DbEntity
{
public ulong GuildId { get; set; }
public string Text { get; set; }
}
public ulong GuildId { get; set; }
public string Text { get; set; }
}

View File

@@ -1,18 +1,14 @@
using System;
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class BlacklistEntry : DbEntity
{
public class BlacklistEntry : DbEntity
{
public ulong ItemId { get; set; }
public BlacklistType Type { get; set; }
}
public ulong ItemId { get; set; }
public BlacklistType Type { get; set; }
}
public enum BlacklistType
{
Server,
Channel,
User
}
public enum BlacklistType
{
Server,
Channel,
User
}

View File

@@ -1,49 +1,47 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Db.Models
namespace NadekoBot.Db.Models;
public class ClubInfo : DbEntity
{
public class ClubInfo : DbEntity
{
[MaxLength(20)]
public string Name { get; set; }
public int Discrim { get; set; }
[MaxLength(20)]
public string Name { get; set; }
public int Discrim { get; set; }
public string ImageUrl { get; set; } = "";
public int MinimumLevelReq { get; set; } = 5;
public int Xp { get; set; } = 0;
public string ImageUrl { get; set; } = "";
public int MinimumLevelReq { get; set; } = 5;
public int Xp { get; set; } = 0;
public int OwnerId { get; set; }
public DiscordUser Owner { get; set; }
public int OwnerId { get; set; }
public DiscordUser Owner { get; set; }
public List<DiscordUser> Users { get; set; } = new List<DiscordUser>();
public List<DiscordUser> Users { get; set; } = new List<DiscordUser>();
public List<ClubApplicants> Applicants { get; set; } = new List<ClubApplicants>();
public List<ClubBans> Bans { get; set; } = new List<ClubBans>();
public string Description { get; set; }
public List<ClubApplicants> Applicants { get; set; } = new List<ClubApplicants>();
public List<ClubBans> Bans { get; set; } = new List<ClubBans>();
public string Description { get; set; }
public override string ToString()
{
return Name + "#" + Discrim;
}
}
public class ClubApplicants
public override string ToString()
{
public int ClubId { get; set; }
public ClubInfo Club { get; set; }
public int UserId { get; set; }
public DiscordUser User { get; set; }
}
public class ClubBans
{
public int ClubId { get; set; }
public ClubInfo Club { get; set; }
public int UserId { get; set; }
public DiscordUser User { get; set; }
return Name + "#" + Discrim;
}
}
public class ClubApplicants
{
public int ClubId { get; set; }
public ClubInfo Club { get; set; }
public int UserId { get; set; }
public DiscordUser User { get; set; }
}
public class ClubBans
{
public int ClubId { get; set; }
public ClubInfo Club { get; set; }
public int UserId { get; set; }
public DiscordUser User { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class CommandAlias : DbEntity
{
public class CommandAlias : DbEntity
{
public string Trigger { get; set; }
public string Mapping { get; set; }
}
}
public string Trigger { get; set; }
public string Mapping { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class CommandCooldown : DbEntity
{
public class CommandCooldown : DbEntity
{
public int Seconds { get; set; }
public string CommandName { get; set; }
}
}
public int Seconds { get; set; }
public string CommandName { get; set; }
}

View File

@@ -1,16 +1,15 @@
namespace NadekoBot.Services.Database.Models
{
public class CurrencyTransaction : DbEntity
{
public long Amount { get; set; }
public string Reason { get; set; }
public ulong UserId { get; set; }
namespace NadekoBot.Services.Database.Models;
public CurrencyTransaction Clone() => new CurrencyTransaction
{
Amount = Amount,
Reason = Reason,
UserId = UserId,
};
}
}
public class CurrencyTransaction : DbEntity
{
public long Amount { get; set; }
public string Reason { get; set; }
public ulong UserId { get; set; }
public CurrencyTransaction Clone() => new CurrencyTransaction
{
Amount = Amount,
Reason = Reason,
UserId = UserId,
};
}

View File

@@ -1,33 +1,27 @@
using Newtonsoft.Json;
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.RegularExpressions;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class CustomReaction : DbEntity
{
public class CustomReaction : DbEntity
{
public ulong? GuildId { get; set; }
public string Response { get; set; }
public string Trigger { get; set; }
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 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(Reactions)
? Array.Empty<string>()
: Reactions.Split("@@@");
public string[] GetReactions() =>
string.IsNullOrWhiteSpace(Reactions)
? Array.Empty<string>()
: Reactions.Split("@@@");
public bool IsGlobal() => GuildId is null || GuildId == 0;
}
public class ReactionResponse : DbEntity
{
public bool OwnerOnly { get; set; }
public string Text { get; set; }
}
public bool IsGlobal() => GuildId is null || GuildId == 0;
}
public class ReactionResponse : DbEntity
{
public bool OwnerOnly { get; set; }
public string Text { get; set; }
}

View File

@@ -1,12 +1,10 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class DbEntity
{
public class DbEntity
{
[Key]
public int Id { get; set; }
public DateTime? DateAdded { get; set; } = DateTime.UtcNow;
}
}
[Key]
public int Id { get; set; }
public DateTime? DateAdded { get; set; } = DateTime.UtcNow;
}

View File

@@ -1,19 +1,18 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class DelMsgOnCmdChannel : DbEntity
{
public class DelMsgOnCmdChannel : DbEntity
public ulong ChannelId { get; set; }
public bool State { get; set; }
public override int GetHashCode()
{
public ulong ChannelId { get; set; }
public bool State { get; set; }
public override int GetHashCode()
{
return ChannelId.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is DelMsgOnCmdChannel x
&& x.ChannelId == ChannelId;
}
return ChannelId.GetHashCode();
}
}
public override bool Equals(object obj)
{
return obj is DelMsgOnCmdChannel x
&& x.ChannelId == ChannelId;
}
}

View File

@@ -1,12 +1,11 @@
using Discord;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class DiscordPermOverride : DbEntity
{
public class DiscordPermOverride : DbEntity
{
public GuildPerm Perm { get; set; }
public GuildPerm Perm { get; set; }
public ulong? GuildId { get; set; }
public string Command { get; set; }
}
public ulong? GuildId { get; set; }
public string Command { get; set; }
}

View File

@@ -1,38 +1,36 @@
using System;
using NadekoBot.Services.Database.Models;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Db.Models
namespace NadekoBot.Db.Models;
public class DiscordUser : DbEntity
{
public class DiscordUser : DbEntity
public ulong UserId { get; set; }
public string Username { get; set; }
public string Discriminator { get; set; }
public string AvatarId { get; set; }
public ClubInfo Club { get; set; }
public bool IsClubAdmin { get; set; }
public int TotalXp { get; set; }
public DateTime LastLevelUp { get; set; } = DateTime.UtcNow;
public DateTime LastXpGain { get; set; } = DateTime.MinValue;
public XpNotificationLocation NotifyOnLevelUp { get; set; }
public long CurrencyAmount { get; set; }
public override bool Equals(object obj)
{
public ulong UserId { get; set; }
public string Username { get; set; }
public string Discriminator { get; set; }
public string AvatarId { get; set; }
public ClubInfo Club { get; set; }
public bool IsClubAdmin { get; set; }
public int TotalXp { get; set; }
public DateTime LastLevelUp { get; set; } = DateTime.UtcNow;
public DateTime LastXpGain { get; set; } = DateTime.MinValue;
public XpNotificationLocation NotifyOnLevelUp { get; set; }
public long CurrencyAmount { get; set; }
public override bool Equals(object obj)
{
return obj is DiscordUser du
? du.UserId == UserId
: false;
}
public override int GetHashCode()
{
return UserId.GetHashCode();
}
public override string ToString() =>
Username + "#" + Discriminator;
return obj is DiscordUser du
? du.UserId == UserId
: false;
}
}
public override int GetHashCode()
{
return UserId.GetHashCode();
}
public override string ToString() =>
Username + "#" + Discriminator;
}

View File

@@ -1,47 +1,44 @@
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class CurrencyEvent
{
public class CurrencyEvent
public enum Type
{
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; }
/// <summary>
/// Amount of currency that the user will be rewarded.
/// </summary>
public long Amount { get; set; }
/// <summary>
/// Maximum amount of currency that can be handed out.
/// </summary>
public long PotSize { get; set; }
public List<AwardedUser> AwardedUsers { get; set; }
/// <summary>
/// Used as extra data storage for events which need it.
/// </summary>
public ulong ExtraId { get; set; }
/// <summary>
/// May be used for some future event.
/// </summary>
public ulong ExtraId2 { get; set; }
/// <summary>
/// May be used for some future event.
/// </summary>
public string ExtraString { get; set; }
Reaction,
GameStatus,
//NotRaid,
}
public class AwardedUser
{
public ulong ServerId { get; set; }
public ulong ChannelId { get; set; }
public ulong MessageId { get; set; }
public Type EventType { get; set; }
}
/// <summary>
/// Amount of currency that the user will be rewarded.
/// </summary>
public long Amount { get; set; }
/// <summary>
/// Maximum amount of currency that can be handed out.
/// </summary>
public long PotSize { get; set; }
public List<AwardedUser> AwardedUsers { get; set; }
/// <summary>
/// Used as extra data storage for events which need it.
/// </summary>
public ulong ExtraId { get; set; }
/// <summary>
/// May be used for some future event.
/// </summary>
public ulong ExtraId2 { get; set; }
/// <summary>
/// May be used for some future event.
/// </summary>
public string ExtraString { get; set; }
}
public class AwardedUser
{
}

View File

@@ -1,25 +1,22 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class FeedSub : DbEntity
{
public class FeedSub : DbEntity
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public ulong ChannelId { get; set; }
public string Url { get; set; }
public override int GetHashCode()
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public ulong ChannelId { get; set; }
public string Url { get; set; }
public override int GetHashCode()
{
return Url.GetHashCode(StringComparison.InvariantCulture) ^ GuildConfigId.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is FeedSub s
&& s.Url.ToLower() == Url.ToLower()
&& s.GuildConfigId == GuildConfigId;
}
return Url.GetHashCode(StringComparison.InvariantCulture) ^ GuildConfigId.GetHashCode();
}
}
public override bool Equals(object obj)
{
return obj is FeedSub s
&& s.Url.ToLower() == Url.ToLower()
&& s.GuildConfigId == GuildConfigId;
}
}

View File

@@ -1,19 +1,18 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class FilterChannelId : DbEntity
{
public class FilterChannelId : DbEntity
public ulong ChannelId { get; set; }
public override bool Equals(object obj)
{
public ulong ChannelId { get; set; }
public override bool Equals(object obj)
{
return obj is FilterChannelId f
? f.ChannelId == ChannelId
: false;
}
public override int GetHashCode()
{
return ChannelId.GetHashCode();
}
return obj is FilterChannelId f
? f.ChannelId == ChannelId
: false;
}
}
public override int GetHashCode()
{
return ChannelId.GetHashCode();
}
}

View File

@@ -1,19 +1,18 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class FilterLinksChannelId : DbEntity
{
public class FilterLinksChannelId : DbEntity
public ulong ChannelId { get; set; }
public override bool Equals(object obj)
{
public ulong ChannelId { get; set; }
public override bool Equals(object obj)
{
return obj is FilterLinksChannelId f
? f.ChannelId == ChannelId
: false;
}
public override int GetHashCode()
{
return ChannelId.GetHashCode();
}
return obj is FilterLinksChannelId f
? f.ChannelId == ChannelId
: false;
}
}
public override int GetHashCode()
{
return ChannelId.GetHashCode();
}
}

View File

@@ -1,7 +1,6 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class FilteredWord : DbEntity
{
public class FilteredWord : DbEntity
{
public string Word { get; set; }
}
}
public string Word { get; set; }
}

View File

@@ -1,50 +1,48 @@
using System;
using NadekoBot.Services.Database.Models;
using NadekoBot.Services.Database.Models;
using NadekoBot.Modules.Searches.Common;
namespace NadekoBot.Db.Models
namespace NadekoBot.Db.Models;
public class FollowedStream : DbEntity
{
public class FollowedStream : DbEntity
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public string Username { get; set; }
public FType Type { get; set; }
public string Message { get; set; }
public enum FType
{
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public string Username { get; set; }
public FType Type { get; set; }
public string Message { get; set; }
public enum FType
{
Twitch = 0,
[Obsolete("No longer supported.")]
Smashcast = 1,
[Obsolete("No longer supported.")]
Mixer = 2,
Picarto = 3,
Youtube = 4,
Facebook = 5,
}
protected bool Equals(FollowedStream other)
{
return ChannelId == other.ChannelId
&& Username.Trim().ToUpperInvariant() == other.Username.Trim().ToUpperInvariant()
&& Type == other.Type;
}
public override int GetHashCode()
{
return HashCode.Combine(ChannelId, Username, (int) Type);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((FollowedStream) obj);
}
public StreamDataKey CreateKey() =>
new StreamDataKey(Type, Username.ToLower());
Twitch = 0,
[Obsolete("No longer supported.")]
Smashcast = 1,
[Obsolete("No longer supported.")]
Mixer = 2,
Picarto = 3,
Youtube = 4,
Facebook = 5,
}
protected bool Equals(FollowedStream other)
{
return ChannelId == other.ChannelId
&& Username.Trim().ToUpperInvariant() == other.Username.Trim().ToUpperInvariant()
&& Type == other.Type;
}
public override int GetHashCode()
{
return HashCode.Combine(ChannelId, Username, (int) Type);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((FollowedStream) obj);
}
public StreamDataKey CreateKey() =>
new StreamDataKey(Type, Username.ToLower());
}

View File

@@ -1,18 +1,17 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class GCChannelId : DbEntity
{
public class GCChannelId : DbEntity
public GuildConfig GuildConfig { get; set; }
public ulong ChannelId { get; set; }
public override bool Equals(object obj)
{
public GuildConfig GuildConfig { get; set; }
public ulong ChannelId { get; set; }
public override bool Equals(object obj)
{
return obj is GCChannelId gc
? gc.ChannelId == ChannelId
: false;
}
public override int GetHashCode() =>
this.ChannelId.GetHashCode();
return obj is GCChannelId gc
? gc.ChannelId == ChannelId
: false;
}
}
public override int GetHashCode() =>
this.ChannelId.GetHashCode();
}

View File

@@ -1,11 +1,10 @@
namespace NadekoBot.Services.Database.Models
{
public class GroupName : DbEntity
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
namespace NadekoBot.Services.Database.Models;
public int Number { get; set; }
public string Name { get; set; }
}
}
public class GroupName : DbEntity
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public int Number { get; set; }
public string Name { get; set; }
}

View File

@@ -1,109 +1,106 @@
using System;
using NadekoBot.Common.Collections;
using System.Collections.Generic;
using NadekoBot.Common.Collections;
using NadekoBot.Db.Models;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class GuildConfig : DbEntity
{
public class GuildConfig : DbEntity
{
public ulong GuildId { get; set; }
public ulong GuildId { get; set; }
public string Prefix { get; set; } = null;
public string Prefix { get; set; } = null;
public bool DeleteMessageOnCommand { get; set; }
public HashSet<DelMsgOnCmdChannel> DelMsgOnCmdChannels { get; set; } = new HashSet<DelMsgOnCmdChannel>();
public string AutoAssignRoleIds { get; set; }
//greet stuff
public bool AutoDeleteGreetMessages { get; set; } //unused
public bool AutoDeleteByeMessages { get; set; } // unused
public int AutoDeleteGreetMessagesTimer { get; set; } = 30;
public int AutoDeleteByeMessagesTimer { get; set; } = 30;
public bool DeleteMessageOnCommand { get; set; }
public HashSet<DelMsgOnCmdChannel> DelMsgOnCmdChannels { get; set; } = new HashSet<DelMsgOnCmdChannel>();
public string AutoAssignRoleIds { get; set; }
//greet stuff
public bool AutoDeleteGreetMessages { get; set; } //unused
public bool AutoDeleteByeMessages { get; set; } // unused
public int AutoDeleteGreetMessagesTimer { get; set; } = 30;
public int AutoDeleteByeMessagesTimer { get; set; } = 30;
public ulong GreetMessageChannelId { get; set; }
public ulong ByeMessageChannelId { get; set; }
public ulong GreetMessageChannelId { get; set; }
public ulong ByeMessageChannelId { get; set; }
public bool SendDmGreetMessage { get; set; }
public string DmGreetMessageText { get; set; } = "Welcome to the %server% server, %user%!";
public bool SendDmGreetMessage { get; set; }
public string DmGreetMessageText { get; set; } = "Welcome to the %server% server, %user%!";
public bool SendChannelGreetMessage { get; set; }
public string ChannelGreetMessageText { get; set; } = "Welcome to the %server% server, %user%!";
public bool SendChannelGreetMessage { get; set; }
public string ChannelGreetMessageText { get; set; } = "Welcome to the %server% server, %user%!";
#region Boost Message
#region Boost Message
public bool SendBoostMessage { get; set; }
public string BoostMessage { get; set; } = "%user% just boosted this server!";
public ulong BoostMessageChannelId { get; set; }
public int BoostMessageDeleteAfter { get; set; }
public bool SendBoostMessage { get; set; }
public string BoostMessage { get; set; } = "%user% just boosted this server!";
public ulong BoostMessageChannelId { get; set; }
public int BoostMessageDeleteAfter { get; set; }
#endregion
#endregion
public bool SendChannelByeMessage { get; set; }
public string ChannelByeMessageText { get; set; } = "%user% has left!";
public bool SendChannelByeMessage { get; set; }
public string ChannelByeMessageText { get; set; } = "%user% has left!";
//self assignable roles
public bool ExclusiveSelfAssignedRoles { get; set; }
public bool AutoDeleteSelfAssignedRoleMessages { get; set; }
//self assignable roles
public bool ExclusiveSelfAssignedRoles { get; set; }
public bool AutoDeleteSelfAssignedRoleMessages { get; set; }
//stream notifications
public HashSet<FollowedStream> FollowedStreams { get; set; } = new HashSet<FollowedStream>();
//stream notifications
public HashSet<FollowedStream> FollowedStreams { get; set; } = new HashSet<FollowedStream>();
//currencyGeneration
public HashSet<GCChannelId> GenerateCurrencyChannelIds { get; set; } = new HashSet<GCChannelId>();
//currencyGeneration
public HashSet<GCChannelId> GenerateCurrencyChannelIds { get; set; } = new HashSet<GCChannelId>();
public List<Permissionv2> Permissions { get; set; }
public bool VerbosePermissions { get; set; } = true;
public string PermissionRole { get; set; } = null;
public List<Permissionv2> Permissions { get; set; }
public bool VerbosePermissions { get; set; } = true;
public string PermissionRole { get; set; } = null;
public HashSet<CommandCooldown> CommandCooldowns { get; set; } = new HashSet<CommandCooldown>();
public HashSet<CommandCooldown> CommandCooldowns { get; set; } = new HashSet<CommandCooldown>();
//filtering
public bool FilterInvites { get; set; }
public bool FilterLinks { get; set; }
public HashSet<FilterChannelId> FilterInvitesChannelIds { get; set; } = new HashSet<FilterChannelId>();
public HashSet<FilterLinksChannelId> FilterLinksChannelIds { get; set; } = new HashSet<FilterLinksChannelId>();
//filtering
public bool FilterInvites { get; set; }
public bool FilterLinks { get; set; }
public HashSet<FilterChannelId> FilterInvitesChannelIds { get; set; } = new HashSet<FilterChannelId>();
public HashSet<FilterLinksChannelId> FilterLinksChannelIds { get; set; } = new HashSet<FilterLinksChannelId>();
//public bool FilterLinks { get; set; }
//public HashSet<FilterLinksChannelId> FilterLinksChannels { get; set; } = new HashSet<FilterLinksChannelId>();
//public bool FilterLinks { get; set; }
//public HashSet<FilterLinksChannelId> FilterLinksChannels { get; set; } = new HashSet<FilterLinksChannelId>();
public bool FilterWords { get; set; }
public HashSet<FilteredWord> FilteredWords { get; set; } = new HashSet<FilteredWord>();
public HashSet<FilterChannelId> FilterWordsChannelIds { get; set; } = new HashSet<FilterChannelId>();
public bool FilterWords { get; set; }
public HashSet<FilteredWord> FilteredWords { get; set; } = new HashSet<FilteredWord>();
public HashSet<FilterChannelId> FilterWordsChannelIds { get; set; } = new HashSet<FilterChannelId>();
public HashSet<MutedUserId> MutedUsers { get; set; } = new HashSet<MutedUserId>();
public HashSet<MutedUserId> MutedUsers { get; set; } = new HashSet<MutedUserId>();
public string MuteRoleName { get; set; }
public bool CleverbotEnabled { get; set; }
public string MuteRoleName { get; set; }
public bool CleverbotEnabled { get; set; }
public AntiRaidSetting AntiRaidSetting { get; set; }
public AntiSpamSetting AntiSpamSetting { get; set; }
public AntiAltSetting AntiAltSetting { get; set; }
public AntiRaidSetting AntiRaidSetting { get; set; }
public AntiSpamSetting AntiSpamSetting { get; set; }
public AntiAltSetting AntiAltSetting { get; set; }
public string Locale { get; set; } = null;
public string TimeZoneId { get; set; } = null;
public string Locale { get; set; } = null;
public string TimeZoneId { get; set; } = null;
public HashSet<UnmuteTimer> UnmuteTimers { get; set; } = new HashSet<UnmuteTimer>();
public HashSet<UnbanTimer> UnbanTimer { get; set; } = new HashSet<UnbanTimer>();
public HashSet<UnroleTimer> UnroleTimer { get; set; } = new HashSet<UnroleTimer>();
public HashSet<VcRoleInfo> VcRoleInfos { get; set; }
public HashSet<CommandAlias> CommandAliases { get; set; } = new HashSet<CommandAlias>();
public List<WarningPunishment> WarnPunishments { get; set; } = new List<WarningPunishment>();
public bool WarningsInitialized { get; set; }
public HashSet<SlowmodeIgnoredUser> SlowmodeIgnoredUsers { get; set; }
public HashSet<SlowmodeIgnoredRole> SlowmodeIgnoredRoles { get; set; }
public HashSet<UnmuteTimer> UnmuteTimers { get; set; } = new HashSet<UnmuteTimer>();
public HashSet<UnbanTimer> UnbanTimer { get; set; } = new HashSet<UnbanTimer>();
public HashSet<UnroleTimer> UnroleTimer { get; set; } = new HashSet<UnroleTimer>();
public HashSet<VcRoleInfo> VcRoleInfos { get; set; }
public HashSet<CommandAlias> CommandAliases { get; set; } = new HashSet<CommandAlias>();
public List<WarningPunishment> WarnPunishments { get; set; } = new List<WarningPunishment>();
public bool WarningsInitialized { get; set; }
public HashSet<SlowmodeIgnoredUser> SlowmodeIgnoredUsers { get; set; }
public HashSet<SlowmodeIgnoredRole> SlowmodeIgnoredRoles { get; set; }
public List<ShopEntry> ShopEntries { get; set; }
public ulong? GameVoiceChannel { get; set; } = null;
public bool VerboseErrors { get; set; } = false;
public List<ShopEntry> ShopEntries { get; set; }
public ulong? GameVoiceChannel { get; set; } = null;
public bool VerboseErrors { get; set; } = false;
public StreamRoleSettings StreamRole { get; set; }
public StreamRoleSettings StreamRole { get; set; }
public XpSettings XpSettings { get; set; }
public List<FeedSub> FeedSubs { get; set; } = new List<FeedSub>();
public IndexedCollection<ReactionRoleMessage> ReactionRoleMessages { get; set; } = new IndexedCollection<ReactionRoleMessage>();
public bool NotifyStreamOffline { get; set; }
public List<GroupName> SelfAssignableRoleGroupNames { get; set; }
public int WarnExpireHours { get; set; } = 0;
public WarnExpireAction WarnExpireAction { get; set; } = WarnExpireAction.Clear;
}
}
public XpSettings XpSettings { get; set; }
public List<FeedSub> FeedSubs { get; set; } = new List<FeedSub>();
public IndexedCollection<ReactionRoleMessage> ReactionRoleMessages { get; set; } = new IndexedCollection<ReactionRoleMessage>();
public bool NotifyStreamOffline { get; set; }
public List<GroupName> SelfAssignableRoleGroupNames { get; set; }
public int WarnExpireHours { get; set; } = 0;
public WarnExpireAction WarnExpireAction { get; set; } = WarnExpireAction.Clear;
}

View File

@@ -1,16 +1,15 @@
namespace NadekoBot.Services.Database.Models
{
public class IgnoredLogItem : DbEntity
{
public int LogSettingId { get; set; }
public LogSetting LogSetting { get; set; }
public ulong LogItemId { get; set; }
public IgnoredItemType ItemType { get; set; }
}
namespace NadekoBot.Services.Database.Models;
public enum IgnoredItemType
{
Channel,
User,
}
public class IgnoredLogItem : DbEntity
{
public int LogSettingId { get; set; }
public LogSetting LogSetting { get; set; }
public ulong LogItemId { get; set; }
public IgnoredItemType ItemType { get; set; }
}
public enum IgnoredItemType
{
Channel,
User,
}

View File

@@ -1,8 +1,7 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class IgnoredVoicePresenceChannel : DbEntity
{
public class IgnoredVoicePresenceChannel : DbEntity
{
public LogSetting LogSetting { get; set; }
public ulong ChannelId { get; set; }
}
}
public LogSetting LogSetting { get; set; }
public ulong ChannelId { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class ImageOnlyChannel : DbEntity
{
public class ImageOnlyChannel : DbEntity
{
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
}
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
}

View File

@@ -1,34 +1,31 @@
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class LogSetting : DbEntity
{
public class LogSetting : DbEntity
{
public List<IgnoredLogItem> LogIgnores { get; set; } = new List<IgnoredLogItem>();
public List<IgnoredLogItem> LogIgnores { get; set; } = new List<IgnoredLogItem>();
public ulong GuildId { get; set; }
public ulong? LogOtherId { get; set; }
public ulong? MessageUpdatedId { get; set; }
public ulong? MessageDeletedId { get; set; }
public ulong GuildId { get; set; }
public ulong? LogOtherId { get; set; }
public ulong? MessageUpdatedId { get; set; }
public ulong? MessageDeletedId { get; set; }
public ulong? UserJoinedId { get; set; }
public ulong? UserLeftId { get; set; }
public ulong? UserBannedId { get; set; }
public ulong? UserUnbannedId { get; set; }
public ulong? UserUpdatedId { get; set; }
public ulong? UserJoinedId { get; set; }
public ulong? UserLeftId { get; set; }
public ulong? UserBannedId { get; set; }
public ulong? UserUnbannedId { get; set; }
public ulong? UserUpdatedId { get; set; }
public ulong? ChannelCreatedId { get; set; }
public ulong? ChannelDestroyedId { get; set; }
public ulong? ChannelUpdatedId { get; set; }
public ulong? ChannelCreatedId { get; set; }
public ulong? ChannelDestroyedId { get; set; }
public ulong? ChannelUpdatedId { get; set; }
public ulong? UserMutedId { get; set; }
public ulong? UserMutedId { get; set; }
//userpresence
public ulong? LogUserPresenceId { get; set; }
//userpresence
public ulong? LogUserPresenceId { get; set; }
//voicepresence
//voicepresence
public ulong? LogVoicePresenceId { get; set; }
public ulong? LogVoicePresenceTTSId { get; set; }
}
}
public ulong? LogVoicePresenceId { get; set; }
public ulong? LogVoicePresenceTTSId { get; set; }
}

View File

@@ -1,12 +1,9 @@
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class MusicPlaylist : DbEntity
{
public class MusicPlaylist : DbEntity
{
public string Name { get; set; }
public string Author { get; set; }
public ulong AuthorId { get; set; }
public List<PlaylistSong> Songs { get; set; } = new List<PlaylistSong>();
}
}
public string Name { get; set; }
public string Author { get; set; }
public ulong AuthorId { get; set; }
public List<PlaylistSong> Songs { get; set; } = new List<PlaylistSong>();
}

View File

@@ -1,56 +1,55 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class MusicPlayerSettings
{
public class MusicPlayerSettings
{
/// <summary>
/// Auto generated Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// Auto generated Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// Id of the guild
/// </summary>
public ulong GuildId { get; set; }
/// <summary>
/// Id of the guild
/// </summary>
public ulong GuildId { get; set; }
/// <summary>
/// Queue repeat type
/// </summary>
public PlayerRepeatType PlayerRepeat { get; set; } = PlayerRepeatType.Queue;
/// <summary>
/// Queue repeat type
/// </summary>
public PlayerRepeatType PlayerRepeat { get; set; } = PlayerRepeatType.Queue;
/// <summary>
/// Channel id the bot will always try to send track related messages to
/// </summary>
public ulong? MusicChannelId { get; set; } = null;
/// <summary>
/// Channel id the bot will always try to send track related messages to
/// </summary>
public ulong? MusicChannelId { get; set; } = null;
/// <summary>
/// Default volume player will be created with
/// </summary>
public int Volume { get; set; } = 100;
/// <summary>
/// Default volume player will be created with
/// </summary>
public int Volume { get; set; } = 100;
/// <summary>
/// Whether the bot should auto disconnect from the voice channel once the queue is done
/// This only has effect if
/// </summary>
public bool AutoDisconnect { get; set; } = false;
/// <summary>
/// Whether the bot should auto disconnect from the voice channel once the queue is done
/// This only has effect if
/// </summary>
public bool AutoDisconnect { get; set; } = false;
/// <summary>
/// Selected quality preset for the music player
/// </summary>
public QualityPreset QualityPreset { get; set; }
}
public enum QualityPreset
{
Highest,
High,
Medium,
Low
}
public enum PlayerRepeatType
{
None,
Track,
Queue
}
/// <summary>
/// Selected quality preset for the music player
/// </summary>
public QualityPreset QualityPreset { get; set; }
}
public enum QualityPreset
{
Highest,
High,
Medium,
Low
}
public enum PlayerRepeatType
{
None,
Track,
Queue
}

View File

@@ -1,19 +1,18 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class MutedUserId : DbEntity
{
public class MutedUserId : DbEntity
public ulong UserId { get; set; }
public override int GetHashCode()
{
public ulong UserId { get; set; }
public override int GetHashCode()
{
return UserId.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is MutedUserId mui
? mui.UserId == UserId
: false;
}
return UserId.GetHashCode();
}
}
public override bool Equals(object obj)
{
return obj is MutedUserId mui
? mui.UserId == UserId
: false;
}
}

View File

@@ -1,16 +1,13 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class NsfwBlacklistedTag : DbEntity
{
public class NsfwBlacklistedTag : DbEntity
{
public ulong GuildId { get; set; }
public string Tag { get; set; }
public ulong GuildId { get; set; }
public string Tag { get; set; }
public override int GetHashCode()
=> Tag.GetHashCode(StringComparison.InvariantCulture);
public override int GetHashCode()
=> Tag.GetHashCode(StringComparison.InvariantCulture);
public override bool Equals(object obj)
=> obj is NsfwBlacklistedTag x && x.Tag == Tag;
}
}
public override bool Equals(object obj)
=> obj is NsfwBlacklistedTag x && x.Tag == Tag;
}

View File

@@ -1,60 +1,58 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public interface IIndexed
{
public interface IIndexed
{
int Index { get; set; }
}
[DebuggerDisplay("{PrimaryTarget}{SecondaryTarget} {SecondaryTargetName} {State} {PrimaryTargetId}")]
public class Permissionv2 : DbEntity, IIndexed
{
public int? GuildConfigId { get; set; }
public int Index { get; set; }
public PrimaryPermissionType PrimaryTarget { get; set; }
public ulong PrimaryTargetId { get; set; }
public SecondaryPermissionType SecondaryTarget { get; set; }
public string SecondaryTargetName { get; set; }
public bool IsCustomCommand { get; set; }
public bool State { get; set; }
[NotMapped]
public static Permissionv2 AllowAllPerm => new Permissionv2()
{
PrimaryTarget = PrimaryPermissionType.Server,
PrimaryTargetId = 0,
SecondaryTarget = SecondaryPermissionType.AllModules,
SecondaryTargetName = "*",
State = true,
Index = 0,
};
public static List<Permissionv2> GetDefaultPermlist =>
new List<Permissionv2>
{
AllowAllPerm
};
}
public enum PrimaryPermissionType
{
User,
Channel,
Role,
Server
}
public enum SecondaryPermissionType
{
Module,
Command,
AllModules
}
int Index { get; set; }
}
[DebuggerDisplay("{PrimaryTarget}{SecondaryTarget} {SecondaryTargetName} {State} {PrimaryTargetId}")]
public class Permissionv2 : DbEntity, IIndexed
{
public int? GuildConfigId { get; set; }
public int Index { get; set; }
public PrimaryPermissionType PrimaryTarget { get; set; }
public ulong PrimaryTargetId { get; set; }
public SecondaryPermissionType SecondaryTarget { get; set; }
public string SecondaryTargetName { get; set; }
public bool IsCustomCommand { get; set; }
public bool State { get; set; }
[NotMapped]
public static Permissionv2 AllowAllPerm => new Permissionv2()
{
PrimaryTarget = PrimaryPermissionType.Server,
PrimaryTargetId = 0,
SecondaryTarget = SecondaryPermissionType.AllModules,
SecondaryTargetName = "*",
State = true,
Index = 0,
};
public static List<Permissionv2> GetDefaultPermlist =>
new List<Permissionv2>
{
AllowAllPerm
};
}
public enum PrimaryPermissionType
{
User,
Channel,
Role,
Server
}
public enum SecondaryPermissionType
{
Module,
Command,
AllModules
}

View File

@@ -1,12 +1,11 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class PlantedCurrency : DbEntity
{
public class PlantedCurrency : DbEntity
{
public long Amount { get; set; }
public string Password { get; set; }
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public ulong UserId { get; set; }
public ulong MessageId { get; set; }
}
}
public long Amount { get; set; }
public string Password { get; set; }
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public ulong UserId { get; set; }
public ulong MessageId { get; set; }
}

View File

@@ -1,19 +1,18 @@
namespace NadekoBot.Services.Database.Models
{
public class PlaylistSong : DbEntity
{
public string Provider { get; set; }
public MusicType ProviderType { get; set; }
public string Title { get; set; }
public string Uri { get; set; }
public string Query { get; set; }
}
namespace NadekoBot.Services.Database.Models;
public enum MusicType
{
Radio,
YouTube,
Local,
Soundcloud
}
public class PlaylistSong : DbEntity
{
public string Provider { get; set; }
public MusicType ProviderType { get; set; }
public string Title { get; set; }
public string Uri { get; set; }
public string Query { get; set; }
}
public enum MusicType
{
Radio,
YouTube,
Local,
Soundcloud
}

View File

@@ -1,20 +1,18 @@
using NadekoBot.Common.Collections;
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class Poll : DbEntity
{
public class Poll : DbEntity
{
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public string Question { get; set; }
public IndexedCollection<PollAnswer> Answers { get; set; }
public HashSet<PollVote> Votes { get; set; } = new HashSet<PollVote>();
}
public class PollAnswer : DbEntity, IIndexed
{
public int Index { get; set; }
public string Text { get; set; }
}
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public string Question { get; set; }
public IndexedCollection<PollAnswer> Answers { get; set; }
public HashSet<PollVote> Votes { get; set; } = new HashSet<PollVote>();
}
public class PollAnswer : DbEntity, IIndexed
{
public int Index { get; set; }
public string Text { get; set; }
}

View File

@@ -1,20 +1,19 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class PollVote : DbEntity
{
public class PollVote : DbEntity
public ulong UserId { get; set; }
public int VoteIndex { get; set; }
public override int GetHashCode()
{
public ulong UserId { get; set; }
public int VoteIndex { get; set; }
public override int GetHashCode()
{
return UserId.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is PollVote p
? p.UserId == UserId
: false;
}
return UserId.GetHashCode();
}
}
public override bool Equals(object obj)
{
return obj is PollVote p
? p.UserId == UserId
: false;
}
}

View File

@@ -1,23 +1,22 @@
using System.ComponentModel.DataAnnotations;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class Quote : DbEntity
{
public class Quote : DbEntity
{
public ulong GuildId { get; set; }
[Required]
public string Keyword { get; set; }
[Required]
public string AuthorName { get; set; }
public ulong AuthorId { get; set; }
[Required]
public string Text { get; set; }
}
public enum OrderType
{
Id = -1,
Keyword = -2
}
public ulong GuildId { get; set; }
[Required]
public string Keyword { get; set; }
[Required]
public string AuthorName { get; set; }
public ulong AuthorId { get; set; }
[Required]
public string Text { get; set; }
}
public enum OrderType
{
Id = -1,
Keyword = -2
}

View File

@@ -1,24 +1,21 @@
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class ReactionRoleMessage : DbEntity, IIndexed
{
public class ReactionRoleMessage : DbEntity, IIndexed
{
public int Index { get; set; }
public int Index { get; set; }
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public ulong ChannelId { get; set; }
public ulong MessageId { get; set; }
public ulong ChannelId { get; set; }
public ulong MessageId { get; set; }
public List<ReactionRole> ReactionRoles { get; set; }
public bool Exclusive { get; set; }
}
public class ReactionRole : DbEntity
{
public string EmoteName { get; set; }
public ulong RoleId { get; set; }
}
public List<ReactionRole> ReactionRoles { get; set; }
public bool Exclusive { get; set; }
}
public class ReactionRole : DbEntity
{
public string EmoteName { get; set; }
public ulong RoleId { get; set; }
}

View File

@@ -1,14 +1,11 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class Reminder : DbEntity
{
public class Reminder : DbEntity
{
public DateTime When { get; set; }
public ulong ChannelId { get; set; }
public ulong ServerId { get; set; }
public ulong UserId { get; set; }
public string Message { get; set; }
public bool IsPrivate { get; set; }
}
}
public DateTime When { get; set; }
public ulong ChannelId { get; set; }
public ulong ServerId { get; set; }
public ulong UserId { get; set; }
public string Message { get; set; }
public bool IsPrivate { get; set; }
}

View File

@@ -1,17 +1,14 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class Repeater
{
public class Repeater
{
public int Id { get; set; }
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public ulong? LastMessageId { get; set; }
public string Message { get; set; }
public TimeSpan Interval { get; set; }
public TimeSpan? StartTimeOfDay { get; set; }
public bool NoRedundant { get; set; }
public DateTime DateAdded { get; set; }
}
}
public int Id { get; set; }
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
public ulong? LastMessageId { get; set; }
public string Message { get; set; }
public TimeSpan Interval { get; set; }
public TimeSpan? StartTimeOfDay { get; set; }
public bool NoRedundant { get; set; }
public DateTime DateAdded { get; set; }
}

View File

@@ -1,12 +1,9 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class RewardedUser : DbEntity
{
public class RewardedUser : DbEntity
{
public ulong UserId { get; set; }
public string PatreonUserId { get; set; }
public int AmountRewardedThisMonth { get; set; }
public DateTime LastReward { get; set; }
}
}
public ulong UserId { get; set; }
public string PatreonUserId { get; set; }
public int AmountRewardedThisMonth { get; set; }
public DateTime LastReward { get; set; }
}

View File

@@ -1,10 +1,9 @@
using Discord;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class RotatingPlayingStatus : DbEntity
{
public class RotatingPlayingStatus : DbEntity
{
public string Status { get; set; }
public ActivityType Type { get; set; }
}
public string Status { get; set; }
public ActivityType Type { get; set; }
}

View File

@@ -1,11 +1,10 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class SelfAssignedRole : DbEntity
{
public class SelfAssignedRole : DbEntity
{
public ulong GuildId { get; set; }
public ulong RoleId { get; set; }
public ulong GuildId { get; set; }
public ulong RoleId { get; set; }
public int Group { get; set; }
public int LevelRequirement { get; set; }
}
}
public int Group { get; set; }
public int LevelRequirement { get; set; }
}

View File

@@ -1,46 +1,42 @@
using System;
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public enum ShopEntryType
{
public enum ShopEntryType
{
Role,
List,
//Infinite_List,
}
public class ShopEntry : DbEntity, IIndexed
{
public int Index { get; set; }
public int Price { get; set; }
public string Name { get; set; }
public ulong AuthorId { get; set; }
public ShopEntryType Type { get; set; }
//role
public string RoleName { get; set; }
public ulong RoleId { get; set; }
//list
public HashSet<ShopEntryItem> Items { get; set; } = new HashSet<ShopEntryItem>();
}
public class ShopEntryItem : DbEntity
{
public string Text { get; set; }
public override bool Equals(object obj)
{
if (obj is null || GetType() != obj.GetType())
{
return false;
}
return ((ShopEntryItem)obj).Text == Text;
}
public override int GetHashCode() =>
Text.GetHashCode(StringComparison.InvariantCulture);
}
Role,
List,
//Infinite_List,
}
public class ShopEntry : DbEntity, IIndexed
{
public int Index { get; set; }
public int Price { get; set; }
public string Name { get; set; }
public ulong AuthorId { get; set; }
public ShopEntryType Type { get; set; }
//role
public string RoleName { get; set; }
public ulong RoleId { get; set; }
//list
public HashSet<ShopEntryItem> Items { get; set; } = new HashSet<ShopEntryItem>();
}
public class ShopEntryItem : DbEntity
{
public string Text { get; set; }
public override bool Equals(object obj)
{
if (obj is null || GetType() != obj.GetType())
{
return false;
}
return ((ShopEntryItem)obj).Text == Text;
}
public override int GetHashCode() =>
Text.GetHashCode(StringComparison.InvariantCulture);
}

View File

@@ -1,24 +1,23 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class SlowmodeIgnoredRole : DbEntity
{
public class SlowmodeIgnoredRole : DbEntity
public ulong RoleId { get; set; }
// override object.Equals
public override bool Equals(object obj)
{
public ulong RoleId { get; set; }
// override object.Equals
public override bool Equals(object obj)
if (obj is null || GetType() != obj.GetType())
{
if (obj is null || GetType() != obj.GetType())
{
return false;
}
return ((SlowmodeIgnoredRole)obj).RoleId == RoleId;
return false;
}
// override object.GetHashCode
public override int GetHashCode()
{
return RoleId.GetHashCode();
}
return ((SlowmodeIgnoredRole)obj).RoleId == RoleId;
}
}
// override object.GetHashCode
public override int GetHashCode()
{
return RoleId.GetHashCode();
}
}

View File

@@ -1,24 +1,23 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class SlowmodeIgnoredUser : DbEntity
{
public class SlowmodeIgnoredUser : DbEntity
public ulong UserId { get; set; }
// override object.Equals
public override bool Equals(object obj)
{
public ulong UserId { get; set; }
// override object.Equals
public override bool Equals(object obj)
if (obj is null || GetType() != obj.GetType())
{
if (obj is null || GetType() != obj.GetType())
{
return false;
}
return ((SlowmodeIgnoredUser)obj).UserId == UserId;
return false;
}
// override object.GetHashCode
public override int GetHashCode()
{
return UserId.GetHashCode();
}
return ((SlowmodeIgnoredUser)obj).UserId == UserId;
}
}
// override object.GetHashCode
public override int GetHashCode()
{
return UserId.GetHashCode();
}
}

View File

@@ -1,78 +1,75 @@
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class StreamRoleSettings : DbEntity
{
public class StreamRoleSettings : DbEntity
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
/// <summary>
/// Whether the feature is enabled in the guild.
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// Id of the role to give to the users in the role 'FromRole' when they start streaming
/// </summary>
public ulong AddRoleId { get; set; }
/// <summary>
/// Id of the role whose users are eligible to get the 'AddRole'
/// </summary>
public ulong FromRoleId { get; set; }
/// <summary>
/// If set, feature will only apply to users who have this keyword in their streaming status.
/// </summary>
public string Keyword { get; set; }
/// <summary>
/// A collection of whitelisted users' IDs. Whitelisted users don't require 'keyword' in
/// order to get the stream role.
/// </summary>
public HashSet<StreamRoleWhitelistedUser> Whitelist { get; set; } = new HashSet<StreamRoleWhitelistedUser>();
/// <summary>
/// A collection of blacklisted users' IDs. Blacklisted useres will never get the stream role.
/// </summary>
public HashSet<StreamRoleBlacklistedUser> Blacklist { get; set; } = new HashSet<StreamRoleBlacklistedUser>();
}
public class StreamRoleBlacklistedUser : DbEntity
{
public ulong UserId { get; set; }
public string Username { get; set; }
public override bool Equals(object obj)
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
if (!(obj is StreamRoleBlacklistedUser x))
return false;
/// <summary>
/// Whether the feature is enabled in the guild.
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// Id of the role to give to the users in the role 'FromRole' when they start streaming
/// </summary>
public ulong AddRoleId { get; set; }
/// <summary>
/// Id of the role whose users are eligible to get the 'AddRole'
/// </summary>
public ulong FromRoleId { get; set; }
/// <summary>
/// If set, feature will only apply to users who have this keyword in their streaming status.
/// </summary>
public string Keyword { get; set; }
/// <summary>
/// A collection of whitelisted users' IDs. Whitelisted users don't require 'keyword' in
/// order to get the stream role.
/// </summary>
public HashSet<StreamRoleWhitelistedUser> Whitelist { get; set; } = new HashSet<StreamRoleWhitelistedUser>();
/// <summary>
/// A collection of blacklisted users' IDs. Blacklisted useres will never get the stream role.
/// </summary>
public HashSet<StreamRoleBlacklistedUser> Blacklist { get; set; } = new HashSet<StreamRoleBlacklistedUser>();
return x.UserId == UserId;
}
public class StreamRoleBlacklistedUser : DbEntity
public override int GetHashCode()
{
public ulong UserId { get; set; }
public string Username { get; set; }
public override bool Equals(object obj)
{
if (!(obj is StreamRoleBlacklistedUser x))
return false;
return x.UserId == UserId;
}
public override int GetHashCode()
{
return UserId.GetHashCode();
}
}
public class StreamRoleWhitelistedUser : DbEntity
{
public ulong UserId { get; set; }
public string Username { get; set; }
public override bool Equals(object obj)
{
return obj is StreamRoleWhitelistedUser x
? x.UserId == UserId
: false;
}
public override int GetHashCode()
{
return UserId.GetHashCode();
}
return UserId.GetHashCode();
}
}
public class StreamRoleWhitelistedUser : DbEntity
{
public ulong UserId { get; set; }
public string Username { get; set; }
public override bool Equals(object obj)
{
return obj is StreamRoleWhitelistedUser x
? x.UserId == UserId
: false;
}
public override int GetHashCode()
{
return UserId.GetHashCode();
}
}

View File

@@ -1,20 +1,17 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class UnbanTimer : DbEntity
{
public class UnbanTimer : DbEntity
public ulong UserId { get; set; }
public DateTime UnbanAt { get; set; }
public override int GetHashCode() =>
UserId.GetHashCode();
public override bool Equals(object obj)
{
public ulong UserId { get; set; }
public DateTime UnbanAt { get; set; }
public override int GetHashCode() =>
UserId.GetHashCode();
public override bool Equals(object obj)
{
return obj is UnbanTimer ut
? ut.UserId == UserId
: false;
}
return obj is UnbanTimer ut
? ut.UserId == UserId
: false;
}
}
}

View File

@@ -1,20 +1,17 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class UnmuteTimer : DbEntity
{
public class UnmuteTimer : DbEntity
public ulong UserId { get; set; }
public DateTime UnmuteAt { get; set; }
public override int GetHashCode() =>
UserId.GetHashCode();
public override bool Equals(object obj)
{
public ulong UserId { get; set; }
public DateTime UnmuteAt { get; set; }
public override int GetHashCode() =>
UserId.GetHashCode();
public override bool Equals(object obj)
{
return obj is UnmuteTimer ut
? ut.UserId == UserId
: false;
}
return obj is UnmuteTimer ut
? ut.UserId == UserId
: false;
}
}
}

View File

@@ -1,21 +1,18 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class UnroleTimer : DbEntity
{
public class UnroleTimer : DbEntity
public ulong UserId { get; set; }
public ulong RoleId { get; set; }
public DateTime UnbanAt { get; set; }
public override int GetHashCode() =>
UserId.GetHashCode() ^ RoleId.GetHashCode();
public override bool Equals(object obj)
{
public ulong UserId { get; set; }
public ulong RoleId { get; set; }
public DateTime UnbanAt { get; set; }
public override int GetHashCode() =>
UserId.GetHashCode() ^ RoleId.GetHashCode();
public override bool Equals(object obj)
{
return obj is UnroleTimer ut
? ut.UserId == UserId && ut.RoleId == RoleId
: false;
}
return obj is UnroleTimer ut
? ut.UserId == UserId && ut.RoleId == RoleId
: false;
}
}
}

View File

@@ -1,16 +1,13 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class UserXpStats : DbEntity
{
public class UserXpStats : DbEntity
{
public ulong UserId { get; set; }
public ulong GuildId { get; set; }
public int Xp { get; set; }
public int AwardedXp { get; set; }
public XpNotificationLocation NotifyOnLevelUp { get; set; }
public DateTime LastLevelUp { get; set; } = DateTime.UtcNow;
}
public enum XpNotificationLocation { None, Dm, Channel }
public ulong UserId { get; set; }
public ulong GuildId { get; set; }
public int Xp { get; set; }
public int AwardedXp { get; set; }
public XpNotificationLocation NotifyOnLevelUp { get; set; }
public DateTime LastLevelUp { get; set; } = DateTime.UtcNow;
}
public enum XpNotificationLocation { None, Dm, Channel }

View File

@@ -1,8 +1,7 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class VcRoleInfo : DbEntity
{
public class VcRoleInfo : DbEntity
{
public ulong VoiceChannelId { get; set; }
public ulong RoleId { get; set; }
}
}
public ulong VoiceChannelId { get; set; }
public ulong RoleId { get; set; }
}

View File

@@ -1,90 +1,87 @@
using NadekoBot.Extensions;
using System.Collections.Generic;
using NadekoBot.Modules.Gambling.Common;
using NadekoBot.Db.Models;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class WaifuInfo : DbEntity
{
public class WaifuInfo : DbEntity
public int WaifuId { get; set; }
public DiscordUser Waifu { get; set; }
public int? ClaimerId { get; set; }
public DiscordUser Claimer { get; set; }
public int? AffinityId { get; set; }
public DiscordUser Affinity { get; set; }
public int Price { get; set; }
public List<WaifuItem> Items { get; set; } = new List<WaifuItem>();
public override string ToString()
{
public int WaifuId { get; set; }
public DiscordUser Waifu { get; set; }
var claimer = "no one";
var status = "";
public int? ClaimerId { get; set; }
public DiscordUser Claimer { get; set; }
var waifuUsername = Waifu.Username.TrimTo(20);
var claimerUsername = Claimer?.Username.TrimTo(20);
public int? AffinityId { get; set; }
public DiscordUser Affinity { get; set; }
public int Price { get; set; }
public List<WaifuItem> Items { get; set; } = new List<WaifuItem>();
public override string ToString()
if (ClaimerId != null)
{
var claimer = "no one";
var status = "";
var waifuUsername = Waifu.Username.TrimTo(20);
var claimerUsername = Claimer?.Username.TrimTo(20);
if (ClaimerId != null)
{
claimer = $"{ claimerUsername }#{Claimer.Discriminator}";
}
if (AffinityId is null)
{
status = $"... but {waifuUsername}'s heart is empty";
}
else if (AffinityId == ClaimerId)
{
status = $"... and {waifuUsername} likes {claimerUsername} too <3";
}
else
{
status = $"... but {waifuUsername}'s heart belongs to {Affinity.Username.TrimTo(20)}#{Affinity.Discriminator}";
}
return $"**{waifuUsername}#{Waifu.Discriminator}** - claimed by **{claimer}**\n\t{status}";
claimer = $"{ claimerUsername }#{Claimer.Discriminator}";
}
if (AffinityId is null)
{
status = $"... but {waifuUsername}'s heart is empty";
}
else if (AffinityId == ClaimerId)
{
status = $"... and {waifuUsername} likes {claimerUsername} too <3";
}
else
{
status = $"... but {waifuUsername}'s heart belongs to {Affinity.Username.TrimTo(20)}#{Affinity.Discriminator}";
}
return $"**{waifuUsername}#{Waifu.Discriminator}** - claimed by **{claimer}**\n\t{status}";
}
}
public class WaifuLbResult
public class WaifuLbResult
{
public string Username { get; set; }
public string Discrim { get; set; }
public string Claimer { get; set; }
public string ClaimerDiscrim { get; set; }
public string Affinity { get; set; }
public string AffinityDiscrim { get; set; }
public int Price { get; set; }
public override string ToString()
{
public string Username { get; set; }
public string Discrim { get; set; }
var claimer = "no one";
var status = "";
public string Claimer { get; set; }
public string ClaimerDiscrim { get; set; }
var waifuUsername = Username.TrimTo(20);
var claimerUsername = Claimer?.TrimTo(20);
public string Affinity { get; set; }
public string AffinityDiscrim { get; set; }
public int Price { get; set; }
public override string ToString()
if (Claimer != null)
{
var claimer = "no one";
var status = "";
var waifuUsername = Username.TrimTo(20);
var claimerUsername = Claimer?.TrimTo(20);
if (Claimer != null)
{
claimer = $"{ claimerUsername }#{ClaimerDiscrim}";
}
if (Affinity is null)
{
status = $"... but {waifuUsername}'s heart is empty";
}
else if (Affinity + AffinityDiscrim == Claimer + ClaimerDiscrim)
{
status = $"... and {waifuUsername} likes {claimerUsername} too <3";
}
else
{
status = $"... but {waifuUsername}'s heart belongs to {Affinity.TrimTo(20)}#{AffinityDiscrim}";
}
return $"**{waifuUsername}#{Discrim}** - claimed by **{claimer}**\n\t{status}";
claimer = $"{ claimerUsername }#{ClaimerDiscrim}";
}
if (Affinity is null)
{
status = $"... but {waifuUsername}'s heart is empty";
}
else if (Affinity + AffinityDiscrim == Claimer + ClaimerDiscrim)
{
status = $"... and {waifuUsername} likes {claimerUsername} too <3";
}
else
{
status = $"... but {waifuUsername}'s heart belongs to {Affinity.TrimTo(20)}#{AffinityDiscrim}";
}
return $"**{waifuUsername}#{Discrim}** - claimed by **{claimer}**\n\t{status}";
}
}

View File

@@ -1,11 +1,8 @@
using System;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class WaifuItem : DbEntity
{
public class WaifuItem : DbEntity
{
public int? WaifuInfoId { get; set; }
public string ItemEmoji { get; set; }
public string Name { get; set; }
}
public int? WaifuInfoId { get; set; }
public string ItemEmoji { get; set; }
public string Name { get; set; }
}

View File

@@ -1,23 +1,22 @@
using NadekoBot.Db.Models;
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class WaifuUpdate : DbEntity
{
public class WaifuUpdate : DbEntity
{
public int UserId { get; set; }
public DiscordUser User { get; set; }
public WaifuUpdateType UpdateType { get; set; }
public int UserId { get; set; }
public DiscordUser User { get; set; }
public WaifuUpdateType UpdateType { get; set; }
public int? OldId { get; set; }
public DiscordUser Old { get; set; }
public int? OldId { get; set; }
public DiscordUser Old { get; set; }
public int? NewId { get; set; }
public DiscordUser New { get; set; }
}
public enum WaifuUpdateType
{
AffinityChanged,
Claimed
}
public int? NewId { get; set; }
public DiscordUser New { get; set; }
}
public enum WaifuUpdateType
{
AffinityChanged,
Claimed
}

View File

@@ -1,8 +1,7 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public enum WarnExpireAction
{
public enum WarnExpireAction
{
Clear,
Delete
}
}
Clear,
Delete
}

View File

@@ -1,13 +1,12 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class Warning : DbEntity
{
public class Warning : DbEntity
{
public ulong GuildId { get; set; }
public ulong UserId { get; set; }
public string Reason { get; set; }
public bool Forgiven { get; set; }
public string ForgivenBy { get; set; }
public string Moderator { get; set; }
public int Weight { get; set; }
}
}
public ulong GuildId { get; set; }
public ulong UserId { get; set; }
public string Reason { get; set; }
public bool Forgiven { get; set; }
public string ForgivenBy { get; set; }
public string Moderator { get; set; }
public int Weight { get; set; }
}

View File

@@ -1,10 +1,9 @@
namespace NadekoBot.Services.Database.Models
namespace NadekoBot.Services.Database.Models;
public class WarningPunishment : DbEntity
{
public class WarningPunishment : DbEntity
{
public int Count { get; set; }
public PunishmentAction Punishment { get; set; }
public int Time { get; set; }
public ulong? RoleId { get; set; }
}
}
public int Count { get; set; }
public PunishmentAction Punishment { get; set; }
public int Time { get; set; }
public ulong? RoleId { get; set; }
}

View File

@@ -1,76 +1,73 @@
using System.Collections.Generic;
namespace NadekoBot.Services.Database.Models;
namespace NadekoBot.Services.Database.Models
public class XpSettings : DbEntity
{
public class XpSettings : DbEntity
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public HashSet<XpRoleReward> RoleRewards { get; set; } = new HashSet<XpRoleReward>();
public HashSet<XpCurrencyReward> CurrencyRewards { get; set; } = new HashSet<XpCurrencyReward>();
public HashSet<ExcludedItem> ExclusionList { get; set; } = new HashSet<ExcludedItem>();
public bool ServerExcluded { get; set; }
}
public HashSet<XpRoleReward> RoleRewards { get; set; } = new HashSet<XpRoleReward>();
public HashSet<XpCurrencyReward> CurrencyRewards { get; set; } = new HashSet<XpCurrencyReward>();
public HashSet<ExcludedItem> ExclusionList { get; set; } = new HashSet<ExcludedItem>();
public bool ServerExcluded { get; set; }
}
public enum ExcludedItemType { Channel, Role }
public enum ExcludedItemType { Channel, Role }
public class XpRoleReward : DbEntity
{
public int XpSettingsId { get; set; }
public XpSettings XpSettings { get; set; }
public class XpRoleReward : DbEntity
{
public int XpSettingsId { get; set; }
public XpSettings XpSettings { get; set; }
public int Level { get; set; }
public ulong RoleId { get; set; }
public int Level { get; set; }
public ulong RoleId { get; set; }
/// <summary>
/// Whether the role should be removed (true) or added (false)
/// </summary>
public bool Remove { get; set; }
/// <summary>
/// Whether the role should be removed (true) or added (false)
/// </summary>
public bool Remove { get; set; }
public override int GetHashCode()
{
return Level.GetHashCode() ^ XpSettingsId.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is XpRoleReward xrr && xrr.Level == Level && xrr.XpSettingsId == XpSettingsId;
}
public override int GetHashCode()
{
return Level.GetHashCode() ^ XpSettingsId.GetHashCode();
}
public class XpCurrencyReward : DbEntity
public override bool Equals(object obj)
{
public int XpSettingsId { get; set; }
public XpSettings XpSettings { get; set; }
public int Level { get; set; }
public int Amount { get; set; }
public override int GetHashCode()
{
return Level.GetHashCode() ^ XpSettingsId.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is XpCurrencyReward xrr && xrr.Level == Level && xrr.XpSettingsId == XpSettingsId;
}
}
public class ExcludedItem : DbEntity
{
public ulong ItemId { get; set; }
public ExcludedItemType ItemType { get; set; }
public override int GetHashCode()
{
return ItemId.GetHashCode() ^ ItemType.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is ExcludedItem ei && ei.ItemId == ItemId && ei.ItemType == ItemType;
}
return obj is XpRoleReward xrr && xrr.Level == Level && xrr.XpSettingsId == XpSettingsId;
}
}
public class XpCurrencyReward : DbEntity
{
public int XpSettingsId { get; set; }
public XpSettings XpSettings { get; set; }
public int Level { get; set; }
public int Amount { get; set; }
public override int GetHashCode()
{
return Level.GetHashCode() ^ XpSettingsId.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is XpCurrencyReward xrr && xrr.Level == Level && xrr.XpSettingsId == XpSettingsId;
}
}
public class ExcludedItem : DbEntity
{
public ulong ItemId { get; set; }
public ExcludedItemType ItemType { get; set; }
public override int GetHashCode()
{
return ItemId.GetHashCode() ^ ItemType.GetHashCode();
}
public override bool Equals(object obj)
{
return obj is ExcludedItem ei && ei.ItemId == ItemId && ei.ItemType == ItemType;
}
}