Kotz's editorconfig styles slightly modified. Target typed new usage. Brackets in expressions used for clarity.

This commit is contained in:
Kwoth
2021-12-26 02:52:09 +01:00
parent 68741ec484
commit d18f9429c6
172 changed files with 921 additions and 494 deletions

View File

@@ -25,7 +25,7 @@ public class AntiSpamSetting : DbEntity
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 HashSet<AntiSpamIgnore> IgnoredChannels { get; set; } = new();
}
public class AntiAltSetting

View File

@@ -16,10 +16,10 @@ public class ClubInfo : DbEntity
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();
public List<ClubApplicants> Applicants { get; set; } = new List<ClubApplicants>();
public List<ClubBans> Bans { get; set; } = new List<ClubBans>();
public List<ClubApplicants> Applicants { get; set; } = new();
public List<ClubBans> Bans { get; set; } = new();
public string Description { get; set; }
public override string ToString()

View File

@@ -6,7 +6,7 @@ public class CurrencyTransaction : DbEntity
public string Reason { get; set; }
public ulong UserId { get; set; }
public CurrencyTransaction Clone() => new CurrencyTransaction
public CurrencyTransaction Clone() => new()
{
Amount = Amount,
Reason = Reason,

View File

@@ -34,6 +34,5 @@ public class FollowedStream : DbEntity
public override bool Equals(object obj)
=> obj is FollowedStream fs && Equals(fs);
public StreamDataKey CreateKey() =>
new StreamDataKey(Type, Username.ToLower());
public StreamDataKey CreateKey() => new(Type, Username.ToLower());
}

View File

@@ -10,7 +10,7 @@ public class GuildConfig : DbEntity
public string Prefix { get; set; } = null;
public bool DeleteMessageOnCommand { get; set; }
public HashSet<DelMsgOnCmdChannel> DelMsgOnCmdChannels { get; set; } = new HashSet<DelMsgOnCmdChannel>();
public HashSet<DelMsgOnCmdChannel> DelMsgOnCmdChannels { get; set; } = new();
public string AutoAssignRoleIds { get; set; }
//greet stuff
public bool AutoDeleteGreetMessages { get; set; } //unused
@@ -44,31 +44,31 @@ public class GuildConfig : DbEntity
public bool AutoDeleteSelfAssignedRoleMessages { get; set; }
//stream notifications
public HashSet<FollowedStream> FollowedStreams { get; set; } = new HashSet<FollowedStream>();
public HashSet<FollowedStream> FollowedStreams { get; set; } = new();
//currencyGeneration
public HashSet<GCChannelId> GenerateCurrencyChannelIds { get; set; } = new HashSet<GCChannelId>();
public HashSet<GCChannelId> GenerateCurrencyChannelIds { get; set; } = new();
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();
//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 HashSet<FilterChannelId> FilterInvitesChannelIds { get; set; } = new();
public HashSet<FilterLinksChannelId> FilterLinksChannelIds { get; set; } = new();
//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 HashSet<FilteredWord> FilteredWords { get; set; } = new();
public HashSet<FilterChannelId> FilterWordsChannelIds { get; set; } = new();
public HashSet<MutedUserId> MutedUsers { get; set; } = new HashSet<MutedUserId>();
public HashSet<MutedUserId> MutedUsers { get; set; } = new();
public string MuteRoleName { get; set; }
public bool CleverbotEnabled { get; set; }
@@ -80,12 +80,12 @@ public class GuildConfig : DbEntity
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<UnmuteTimer> UnmuteTimers { get; set; } = new();
public HashSet<UnbanTimer> UnbanTimer { get; set; } = new();
public HashSet<UnroleTimer> UnroleTimer { get; set; } = new();
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 HashSet<CommandAlias> CommandAliases { get; set; } = new();
public List<WarningPunishment> WarnPunishments { get; set; } = new();
public bool WarningsInitialized { get; set; }
public HashSet<SlowmodeIgnoredUser> SlowmodeIgnoredUsers { get; set; }
public HashSet<SlowmodeIgnoredRole> SlowmodeIgnoredRoles { get; set; }
@@ -97,8 +97,8 @@ public class GuildConfig : DbEntity
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 List<FeedSub> FeedSubs { get; set; } = new();
public IndexedCollection<ReactionRoleMessage> ReactionRoleMessages { get; set; } = new();
public bool NotifyStreamOffline { get; set; }
public List<GroupName> SelfAssignableRoleGroupNames { get; set; }
public int WarnExpireHours { get; set; } = 0;

View File

@@ -2,7 +2,7 @@
public class LogSetting : DbEntity
{
public List<IgnoredLogItem> LogIgnores { get; set; } = new List<IgnoredLogItem>();
public List<IgnoredLogItem> LogIgnores { get; set; } = new();
public ulong GuildId { get; set; }
public ulong? LogOtherId { get; set; }

View File

@@ -5,5 +5,5 @@ 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 List<PlaylistSong> Songs { get; set; } = new();
}

View File

@@ -25,7 +25,7 @@ public class Permissionv2 : DbEntity, IIndexed
public bool State { get; set; }
[NotMapped]
public static Permissionv2 AllowAllPerm => new Permissionv2()
public static Permissionv2 AllowAllPerm => new()
{
PrimaryTarget = PrimaryPermissionType.Server,
PrimaryTargetId = 0,
@@ -36,7 +36,7 @@ public class Permissionv2 : DbEntity, IIndexed
};
public static List<Permissionv2> GetDefaultPermlist =>
new List<Permissionv2>
new()
{
AllowAllPerm
};

View File

@@ -8,7 +8,7 @@ public class Poll : DbEntity
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 HashSet<PollVote> Votes { get; set; } = new();
}
public class PollAnswer : DbEntity, IIndexed

View File

@@ -21,7 +21,7 @@ public class ShopEntry : DbEntity, IIndexed
public ulong RoleId { get; set; }
//list
public HashSet<ShopEntryItem> Items { get; set; } = new HashSet<ShopEntryItem>();
public HashSet<ShopEntryItem> Items { get; set; } = new();
}
public class ShopEntryItem : DbEntity

View File

@@ -29,12 +29,12 @@ public class StreamRoleSettings : DbEntity
/// 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>();
public HashSet<StreamRoleWhitelistedUser> Whitelist { get; set; } = new();
/// <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 HashSet<StreamRoleBlacklistedUser> Blacklist { get; set; } = new();
}
public class StreamRoleBlacklistedUser : DbEntity
@@ -44,7 +44,7 @@ public class StreamRoleBlacklistedUser : DbEntity
public override bool Equals(object obj)
{
if (!(obj is StreamRoleBlacklistedUser x))
if (obj is not StreamRoleBlacklistedUser x)
return false;
return x.UserId == UserId;

View File

@@ -14,7 +14,7 @@ public class WaifuInfo : DbEntity
public DiscordUser Affinity { get; set; }
public int Price { get; set; }
public List<WaifuItem> Items { get; set; } = new List<WaifuItem>();
public List<WaifuItem> Items { get; set; } = new();
public override string ToString()
{

View File

@@ -5,9 +5,9 @@ public class XpSettings : DbEntity
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 HashSet<XpRoleReward> RoleRewards { get; set; } = new();
public HashSet<XpCurrencyReward> CurrencyRewards { get; set; } = new();
public HashSet<ExcludedItem> ExclusionList { get; set; } = new();
public bool ServerExcluded { get; set; }
}