mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
Rewrote several raw queries to linqtodb
This commit is contained in:
@@ -29,7 +29,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("UserId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("ClubApplicants");
|
b.ToTable("ClubApplicants", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Db.Models.ClubBans", b =>
|
modelBuilder.Entity("NadekoBot.Db.Models.ClubBans", b =>
|
||||||
@@ -44,7 +44,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("UserId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("ClubBans");
|
b.ToTable("ClubBans", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Db.Models.ClubInfo", b =>
|
modelBuilder.Entity("NadekoBot.Db.Models.ClubInfo", b =>
|
||||||
@@ -86,7 +86,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("OwnerId")
|
b.HasIndex("OwnerId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Clubs");
|
b.ToTable("Clubs", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Db.Models.DiscordUser", b =>
|
modelBuilder.Entity("NadekoBot.Db.Models.DiscordUser", b =>
|
||||||
@@ -155,7 +155,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("UserId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("DiscordUser");
|
b.ToTable("DiscordUser", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Db.Models.FollowedStream", b =>
|
modelBuilder.Entity("NadekoBot.Db.Models.FollowedStream", b =>
|
||||||
@@ -189,7 +189,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("FollowedStream");
|
b.ToTable("FollowedStream", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.AntiAltSetting", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.AntiAltSetting", b =>
|
||||||
@@ -218,7 +218,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildConfigId")
|
b.HasIndex("GuildConfigId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("AntiAltSetting");
|
b.ToTable("AntiAltSetting", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.AntiRaidSetting", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.AntiRaidSetting", b =>
|
||||||
@@ -250,7 +250,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildConfigId")
|
b.HasIndex("GuildConfigId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("AntiRaidSetting");
|
b.ToTable("AntiRaidSetting", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.AntiSpamIgnore", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.AntiSpamIgnore", b =>
|
||||||
@@ -272,7 +272,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("AntiSpamSettingId");
|
b.HasIndex("AntiSpamSettingId");
|
||||||
|
|
||||||
b.ToTable("AntiSpamIgnore");
|
b.ToTable("AntiSpamIgnore", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.AntiSpamSetting", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.AntiSpamSetting", b =>
|
||||||
@@ -304,7 +304,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildConfigId")
|
b.HasIndex("GuildConfigId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("AntiSpamSetting");
|
b.ToTable("AntiSpamSetting", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.AutoCommand", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.AutoCommand", b =>
|
||||||
@@ -342,7 +342,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("AutoCommands");
|
b.ToTable("AutoCommands", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.AutoTranslateChannel", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.AutoTranslateChannel", b =>
|
||||||
@@ -370,7 +370,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildId");
|
b.HasIndex("GuildId");
|
||||||
|
|
||||||
b.ToTable("AutoTranslateChannels");
|
b.ToTable("AutoTranslateChannels", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.AutoTranslateUser", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.AutoTranslateUser", b =>
|
||||||
@@ -398,7 +398,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasAlternateKey("ChannelId", "UserId");
|
b.HasAlternateKey("ChannelId", "UserId");
|
||||||
|
|
||||||
b.ToTable("AutoTranslateUsers");
|
b.ToTable("AutoTranslateUsers", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.BanTemplate", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.BanTemplate", b =>
|
||||||
@@ -421,7 +421,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildId")
|
b.HasIndex("GuildId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("BanTemplates");
|
b.ToTable("BanTemplates", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.BlacklistEntry", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.BlacklistEntry", b =>
|
||||||
@@ -441,7 +441,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Blacklist");
|
b.ToTable("Blacklist", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.CommandAlias", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.CommandAlias", b =>
|
||||||
@@ -466,7 +466,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("CommandAlias");
|
b.ToTable("CommandAlias", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.CommandCooldown", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.CommandCooldown", b =>
|
||||||
@@ -491,7 +491,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("CommandCooldown");
|
b.ToTable("CommandCooldown", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.CurrencyTransaction", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.CurrencyTransaction", b =>
|
||||||
@@ -529,7 +529,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("UserId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("CurrencyTransactions");
|
b.ToTable("CurrencyTransactions", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.DelMsgOnCmdChannel", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.DelMsgOnCmdChannel", b =>
|
||||||
@@ -554,7 +554,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("DelMsgOnCmdChannel");
|
b.ToTable("DelMsgOnCmdChannel", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.DiscordPermOverride", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.DiscordPermOverride", b =>
|
||||||
@@ -580,7 +580,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildId", "Command")
|
b.HasIndex("GuildId", "Command")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("DiscordPermOverrides");
|
b.ToTable("DiscordPermOverrides", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.ExcludedItem", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.ExcludedItem", b =>
|
||||||
@@ -605,7 +605,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("XpSettingsId");
|
b.HasIndex("XpSettingsId");
|
||||||
|
|
||||||
b.ToTable("ExcludedItem");
|
b.ToTable("ExcludedItem", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.FeedSub", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.FeedSub", b =>
|
||||||
@@ -631,7 +631,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasAlternateKey("GuildConfigId", "Url");
|
b.HasAlternateKey("GuildConfigId", "Url");
|
||||||
|
|
||||||
b.ToTable("FeedSub");
|
b.ToTable("FeedSub", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.FilterChannelId", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.FilterChannelId", b =>
|
||||||
@@ -653,7 +653,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("FilterChannelId");
|
b.ToTable("FilterChannelId", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.FilteredWord", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.FilteredWord", b =>
|
||||||
@@ -675,7 +675,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("FilteredWord");
|
b.ToTable("FilteredWord", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.FilterLinksChannelId", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.FilterLinksChannelId", b =>
|
||||||
@@ -697,7 +697,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("FilterLinksChannelId");
|
b.ToTable("FilterLinksChannelId", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.FilterWordsChannelId", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.FilterWordsChannelId", b =>
|
||||||
@@ -719,7 +719,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("FilterWordsChannelId");
|
b.ToTable("FilterWordsChannelId", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.GCChannelId", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.GCChannelId", b =>
|
||||||
@@ -741,7 +741,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("GCChannelId");
|
b.ToTable("GCChannelId", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.GroupName", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.GroupName", b =>
|
||||||
@@ -767,7 +767,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildConfigId", "Number")
|
b.HasIndex("GuildConfigId", "Number")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("GroupName");
|
b.ToTable("GroupName", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.GuildConfig", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.GuildConfig", b =>
|
||||||
@@ -891,7 +891,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("WarnExpireHours");
|
b.HasIndex("WarnExpireHours");
|
||||||
|
|
||||||
b.ToTable("GuildConfigs");
|
b.ToTable("GuildConfigs", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.IgnoredLogItem", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.IgnoredLogItem", b =>
|
||||||
@@ -917,7 +917,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("LogSettingId", "LogItemId", "ItemType")
|
b.HasIndex("LogSettingId", "LogItemId", "ItemType")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("IgnoredLogChannels");
|
b.ToTable("IgnoredLogChannels", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.IgnoredVoicePresenceChannel", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.IgnoredVoicePresenceChannel", b =>
|
||||||
@@ -939,7 +939,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("LogSettingId");
|
b.HasIndex("LogSettingId");
|
||||||
|
|
||||||
b.ToTable("IgnoredVoicePresenceCHannels");
|
b.ToTable("IgnoredVoicePresenceCHannels", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.ImageOnlyChannel", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.ImageOnlyChannel", b =>
|
||||||
@@ -962,7 +962,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("ChannelId")
|
b.HasIndex("ChannelId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("ImageOnlyChannels");
|
b.ToTable("ImageOnlyChannels", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.LogSetting", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.LogSetting", b =>
|
||||||
@@ -1027,7 +1027,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildId")
|
b.HasIndex("GuildId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("LogSettings");
|
b.ToTable("LogSettings", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.MusicPlayerSettings", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.MusicPlayerSettings", b =>
|
||||||
@@ -1064,7 +1064,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildId")
|
b.HasIndex("GuildId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("MusicPlayerSettings");
|
b.ToTable("MusicPlayerSettings", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.MusicPlaylist", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.MusicPlaylist", b =>
|
||||||
@@ -1087,7 +1087,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("MusicPlaylists");
|
b.ToTable("MusicPlaylists", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.MutedUserId", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.MutedUserId", b =>
|
||||||
@@ -1109,7 +1109,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("MutedUserId");
|
b.ToTable("MutedUserId", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.NadekoExpression", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.NadekoExpression", b =>
|
||||||
@@ -1147,7 +1147,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Expressions");
|
b.ToTable("Expressions", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.NsfwBlacklistedTag", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.NsfwBlacklistedTag", b =>
|
||||||
@@ -1169,7 +1169,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildId");
|
b.HasIndex("GuildId");
|
||||||
|
|
||||||
b.ToTable("NsfwBlacklistedTags");
|
b.ToTable("NsfwBlacklistedTags", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.Permissionv2", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.Permissionv2", b =>
|
||||||
@@ -1209,7 +1209,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("Permissions");
|
b.ToTable("Permissions", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.PlantedCurrency", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.PlantedCurrency", b =>
|
||||||
@@ -1246,7 +1246,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("MessageId")
|
b.HasIndex("MessageId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("PlantedCurrency");
|
b.ToTable("PlantedCurrency", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.PlaylistSong", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.PlaylistSong", b =>
|
||||||
@@ -1280,7 +1280,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("MusicPlaylistId");
|
b.HasIndex("MusicPlaylistId");
|
||||||
|
|
||||||
b.ToTable("PlaylistSong");
|
b.ToTable("PlaylistSong", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.Poll", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.Poll", b =>
|
||||||
@@ -1306,7 +1306,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildId")
|
b.HasIndex("GuildId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Poll");
|
b.ToTable("Poll", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.PollAnswer", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.PollAnswer", b =>
|
||||||
@@ -1331,7 +1331,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("PollId");
|
b.HasIndex("PollId");
|
||||||
|
|
||||||
b.ToTable("PollAnswer");
|
b.ToTable("PollAnswer", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.PollVote", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.PollVote", b =>
|
||||||
@@ -1356,7 +1356,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("PollId");
|
b.HasIndex("PollId");
|
||||||
|
|
||||||
b.ToTable("PollVote");
|
b.ToTable("PollVote", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.Quote", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.Quote", b =>
|
||||||
@@ -1392,7 +1392,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("Keyword");
|
b.HasIndex("Keyword");
|
||||||
|
|
||||||
b.ToTable("Quotes");
|
b.ToTable("Quotes", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRole", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRole", b =>
|
||||||
@@ -1417,7 +1417,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ReactionRoleMessageId");
|
b.HasIndex("ReactionRoleMessageId");
|
||||||
|
|
||||||
b.ToTable("ReactionRole");
|
b.ToTable("ReactionRole", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRoleMessage", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRoleMessage", b =>
|
||||||
@@ -1448,7 +1448,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("ReactionRoleMessage");
|
b.ToTable("ReactionRoleMessage", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.Reminder", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.Reminder", b =>
|
||||||
@@ -1482,7 +1482,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("When");
|
b.HasIndex("When");
|
||||||
|
|
||||||
b.ToTable("Reminders");
|
b.ToTable("Reminders", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.Repeater", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.Repeater", b =>
|
||||||
@@ -1517,7 +1517,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Repeaters");
|
b.ToTable("Repeaters", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.RewardedUser", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.RewardedUser", b =>
|
||||||
@@ -1546,7 +1546,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("PatreonUserId")
|
b.HasIndex("PatreonUserId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("RewardedUsers");
|
b.ToTable("RewardedUsers", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.RotatingPlayingStatus", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.RotatingPlayingStatus", b =>
|
||||||
@@ -1566,7 +1566,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("RotatingStatus");
|
b.ToTable("RotatingStatus", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.SelfAssignedRole", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.SelfAssignedRole", b =>
|
||||||
@@ -1597,7 +1597,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildId", "RoleId")
|
b.HasIndex("GuildId", "RoleId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("SelfAssignableRoles");
|
b.ToTable("SelfAssignableRoles", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.ShopEntry", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.ShopEntry", b =>
|
||||||
@@ -1637,7 +1637,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("ShopEntry");
|
b.ToTable("ShopEntry", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.ShopEntryItem", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.ShopEntryItem", b =>
|
||||||
@@ -1659,7 +1659,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ShopEntryId");
|
b.HasIndex("ShopEntryId");
|
||||||
|
|
||||||
b.ToTable("ShopEntryItem");
|
b.ToTable("ShopEntryItem", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.SlowmodeIgnoredRole", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.SlowmodeIgnoredRole", b =>
|
||||||
@@ -1681,7 +1681,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("SlowmodeIgnoredRole");
|
b.ToTable("SlowmodeIgnoredRole", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.SlowmodeIgnoredUser", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.SlowmodeIgnoredUser", b =>
|
||||||
@@ -1703,7 +1703,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("SlowmodeIgnoredUser");
|
b.ToTable("SlowmodeIgnoredUser", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.StreamRoleBlacklistedUser", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.StreamRoleBlacklistedUser", b =>
|
||||||
@@ -1728,7 +1728,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("StreamRoleSettingsId");
|
b.HasIndex("StreamRoleSettingsId");
|
||||||
|
|
||||||
b.ToTable("StreamRoleBlacklistedUser");
|
b.ToTable("StreamRoleBlacklistedUser", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.StreamRoleSettings", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.StreamRoleSettings", b =>
|
||||||
@@ -1760,7 +1760,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildConfigId")
|
b.HasIndex("GuildConfigId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("StreamRoleSettings");
|
b.ToTable("StreamRoleSettings", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.StreamRoleWhitelistedUser", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.StreamRoleWhitelistedUser", b =>
|
||||||
@@ -1785,7 +1785,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("StreamRoleSettingsId");
|
b.HasIndex("StreamRoleSettingsId");
|
||||||
|
|
||||||
b.ToTable("StreamRoleWhitelistedUser");
|
b.ToTable("StreamRoleWhitelistedUser", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.UnbanTimer", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.UnbanTimer", b =>
|
||||||
@@ -1810,7 +1810,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("UnbanTimer");
|
b.ToTable("UnbanTimer", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.UnmuteTimer", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.UnmuteTimer", b =>
|
||||||
@@ -1835,7 +1835,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("UnmuteTimer");
|
b.ToTable("UnmuteTimer", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.UnroleTimer", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.UnroleTimer", b =>
|
||||||
@@ -1863,7 +1863,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("UnroleTimer");
|
b.ToTable("UnroleTimer", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.UserXpStats", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.UserXpStats", b =>
|
||||||
@@ -1908,7 +1908,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("UserId", "GuildId")
|
b.HasIndex("UserId", "GuildId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("UserXpStats");
|
b.ToTable("UserXpStats", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.VcRoleInfo", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.VcRoleInfo", b =>
|
||||||
@@ -1933,7 +1933,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("VcRoleInfo");
|
b.ToTable("VcRoleInfo", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.WaifuInfo", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.WaifuInfo", b =>
|
||||||
@@ -1968,7 +1968,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("WaifuId")
|
b.HasIndex("WaifuId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("WaifuInfo");
|
b.ToTable("WaifuInfo", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.WaifuItem", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.WaifuItem", b =>
|
||||||
@@ -1993,7 +1993,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("WaifuInfoId");
|
b.HasIndex("WaifuInfoId");
|
||||||
|
|
||||||
b.ToTable("WaifuItem");
|
b.ToTable("WaifuItem", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.WaifuUpdate", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.WaifuUpdate", b =>
|
||||||
@@ -2025,7 +2025,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("UserId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("WaifuUpdates");
|
b.ToTable("WaifuUpdates", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.Warning", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.Warning", b =>
|
||||||
@@ -2068,7 +2068,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("UserId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("Warnings");
|
b.ToTable("Warnings", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.WarningPunishment", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.WarningPunishment", b =>
|
||||||
@@ -2099,7 +2099,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GuildConfigId");
|
b.HasIndex("GuildConfigId");
|
||||||
|
|
||||||
b.ToTable("WarningPunishment");
|
b.ToTable("WarningPunishment", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpCurrencyReward", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpCurrencyReward", b =>
|
||||||
@@ -2124,7 +2124,7 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.HasIndex("XpSettingsId");
|
b.HasIndex("XpSettingsId");
|
||||||
|
|
||||||
b.ToTable("XpCurrencyReward");
|
b.ToTable("XpCurrencyReward", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpRoleReward", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpRoleReward", b =>
|
||||||
@@ -2153,7 +2153,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("XpSettingsId", "Level")
|
b.HasIndex("XpSettingsId", "Level")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("XpRoleReward");
|
b.ToTable("XpRoleReward", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpSettings", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.XpSettings", b =>
|
||||||
@@ -2176,7 +2176,7 @@ namespace NadekoBot.Migrations
|
|||||||
b.HasIndex("GuildConfigId")
|
b.HasIndex("GuildConfigId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("XpSettings");
|
b.ToTable("XpSettings", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Db.Models.ClubApplicants", b =>
|
modelBuilder.Entity("NadekoBot.Db.Models.ClubApplicants", b =>
|
||||||
|
@@ -10,27 +10,26 @@ namespace NadekoBot.Modules.Administration
|
|||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial class DangerousCommands : NadekoModule<DangerousCommandsService>
|
public partial class DangerousCommands : NadekoModule<DangerousCommandsService>
|
||||||
{
|
{
|
||||||
private async Task InternalExecSql(string sql, params object[] reps)
|
private async Task ConfirmActionInternalAsync(string name, Func<Task> action)
|
||||||
{
|
{
|
||||||
sql = string.Format(sql, reps);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var embed = _eb.Create()
|
var embed = _eb.Create()
|
||||||
.WithTitle(GetText(strs.sql_confirm_exec))
|
.WithTitle(GetText(strs.sql_confirm_exec))
|
||||||
.WithDescription(Format.Code(sql));
|
.WithDescription(name);
|
||||||
|
|
||||||
if (!await PromptUserConfirmAsync(embed))
|
if (!await PromptUserConfirmAsync(embed))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var res = await _service.ExecuteSql(sql);
|
await action();
|
||||||
await SendConfirmAsync(res.ToString());
|
await ctx.OkAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await SendErrorAsync(ex.ToString());
|
await SendErrorAsync(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial Task SqlSelect([Leftover] string sql)
|
public partial Task SqlSelect([Leftover] string sql)
|
||||||
@@ -57,38 +56,55 @@ namespace NadekoBot.Modules.Administration
|
|||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial Task SqlExec([Leftover] string sql)
|
public async partial Task SqlExec([Leftover] string sql)
|
||||||
=> InternalExecSql(sql);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var embed = _eb.Create()
|
||||||
|
.WithTitle(GetText(strs.sql_confirm_exec))
|
||||||
|
.WithDescription(Format.Code(sql));
|
||||||
|
|
||||||
|
if (!await PromptUserConfirmAsync(embed))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var res = await _service.ExecuteSql(sql);
|
||||||
|
await SendConfirmAsync(res.ToString());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await SendErrorAsync(ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial Task DeleteWaifus()
|
public partial Task DeleteWaifus()
|
||||||
=> SqlExec(DangerousCommandsService.WAIFUS_DELETE_SQL);
|
=> ConfirmActionInternalAsync("Delete Waifus", () => _service.DeleteWaifus());
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial Task DeleteWaifu(IUser user)
|
public async partial Task DeleteWaifu(IUser user)
|
||||||
=> DeleteWaifu(user.Id);
|
=> await DeleteWaifu(user.Id);
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial Task DeleteWaifu(ulong userId)
|
public partial Task DeleteWaifu(ulong userId)
|
||||||
=> InternalExecSql(DangerousCommandsService.WAIFU_DELETE_SQL, userId);
|
=> ConfirmActionInternalAsync($"Delete Waifu {userId}", () => _service.DeleteWaifu(userId));
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial Task DeleteCurrency()
|
public partial Task DeleteCurrency()
|
||||||
=> SqlExec(DangerousCommandsService.CURRENCY_DELETE_SQL);
|
=> ConfirmActionInternalAsync("Delete Currency", () => _service.DeleteCurrency());
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial Task DeletePlaylists()
|
public partial Task DeletePlaylists()
|
||||||
=> SqlExec(DangerousCommandsService.MUSIC_PLAYLIST_DELETE_SQL);
|
=> ConfirmActionInternalAsync("Delete Playlists", () => _service.DeletePlaylists());
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial Task DeleteXp()
|
public partial Task DeleteXp()
|
||||||
=> SqlExec(DangerousCommandsService.XP_DELETE_SQL);
|
=> ConfirmActionInternalAsync("Delete Xp", () => _service.DeleteXp());
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
@@ -108,10 +124,6 @@ namespace NadekoBot.Modules.Administration
|
|||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public partial Task PurgeUser([Leftover] IUser user)
|
public partial Task PurgeUser([Leftover] IUser user)
|
||||||
=> PurgeUser(user.Id);
|
=> PurgeUser(user.Id);
|
||||||
//[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
//[OwnerOnly]
|
|
||||||
//public partial Task DeleteUnusedCrnQ() =>
|
|
||||||
// SqlExec(DangerousCommandsService.DeleteUnusedExpressionsAndQuotes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,46 +2,83 @@
|
|||||||
using LinqToDB;
|
using LinqToDB;
|
||||||
using LinqToDB.EntityFrameworkCore;
|
using LinqToDB.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NadekoBot.Db.Models;
|
||||||
using NadekoBot.Services.Database.Models;
|
using NadekoBot.Services.Database.Models;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Administration.Services;
|
namespace NadekoBot.Modules.Administration.Services;
|
||||||
|
|
||||||
public class DangerousCommandsService : INService
|
public class DangerousCommandsService : INService
|
||||||
{
|
{
|
||||||
public const string WAIFUS_DELETE_SQL = @"DELETE FROM WaifuUpdates;
|
|
||||||
DELETE FROM WaifuItem;
|
|
||||||
DELETE FROM WaifuInfo;";
|
|
||||||
|
|
||||||
public const string WAIFU_DELETE_SQL =
|
|
||||||
@"DELETE FROM WaifuUpdates WHERE UserId=(SELECT Id FROM DiscordUser WHERE UserId={0});
|
|
||||||
DELETE FROM WaifuItem WHERE WaifuInfoId=(SELECT Id FROM WaifuInfo WHERE WaifuId=(SELECT Id FROM DiscordUser WHERE UserId={0}));
|
|
||||||
UPDATE WaifuInfo SET ClaimerId=NULL WHERE ClaimerId=(SELECT Id FROM DiscordUser WHERE UserId={0});
|
|
||||||
DELETE FROM WaifuInfo WHERE WaifuId=(SELECT Id FROM DiscordUser WHERE UserId={0});";
|
|
||||||
|
|
||||||
public const string CURRENCY_DELETE_SQL =
|
|
||||||
"UPDATE DiscordUser SET CurrencyAmount=0; DELETE FROM CurrencyTransactions; DELETE FROM PlantedCurrency;";
|
|
||||||
|
|
||||||
public const string MUSIC_PLAYLIST_DELETE_SQL = "DELETE FROM MusicPlaylists;";
|
|
||||||
|
|
||||||
public const string XP_DELETE_SQL = @"DELETE FROM UserXpStats;
|
|
||||||
UPDATE DiscordUser
|
|
||||||
SET ClubId=NULL,
|
|
||||||
IsClubAdmin=0,
|
|
||||||
TotalXp=0;
|
|
||||||
DELETE FROM ClubApplicants;
|
|
||||||
DELETE FROM ClubBans;
|
|
||||||
DELETE FROM Clubs;";
|
|
||||||
// public const string DeleteUnusedExpressionsAndQuotes = @"DELETE FROM Expressions
|
|
||||||
//WHERE UseCount=0 AND (DateAdded < date('now', '-7 day') OR DateAdded is null);
|
|
||||||
|
|
||||||
//DELETE FROM Quotes
|
|
||||||
//WHERE UseCount=0 AND (DateAdded < date('now', '-7 day') OR DateAdded is null);";
|
|
||||||
|
|
||||||
private readonly DbService _db;
|
private readonly DbService _db;
|
||||||
|
|
||||||
public DangerousCommandsService(DbService db)
|
public DangerousCommandsService(DbService db)
|
||||||
=> _db = db;
|
=> _db = db;
|
||||||
|
|
||||||
|
public async Task DeleteXp()
|
||||||
|
{
|
||||||
|
await using var ctx = _db.GetDbContext();
|
||||||
|
await ctx.DiscordUser.UpdateAsync(_ => new DiscordUser()
|
||||||
|
{
|
||||||
|
Club = null,
|
||||||
|
IsClubAdmin = false,
|
||||||
|
TotalXp = 0
|
||||||
|
});
|
||||||
|
await ctx.ClubApplicants.DeleteAsync();
|
||||||
|
await ctx.ClubBans.DeleteAsync();
|
||||||
|
await ctx.Clubs.DeleteAsync();
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeleteWaifus()
|
||||||
|
{
|
||||||
|
await using var ctx = _db.GetDbContext();
|
||||||
|
await ctx.WaifuUpdates.DeleteAsync();
|
||||||
|
await ctx.WaifuItem.DeleteAsync();
|
||||||
|
await ctx.WaifuInfo.DeleteAsync();
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeleteWaifu(ulong userId)
|
||||||
|
{
|
||||||
|
await using var ctx = _db.GetDbContext();
|
||||||
|
await ctx.WaifuUpdates
|
||||||
|
.Where(x => x.User.UserId == userId)
|
||||||
|
.DeleteAsync();
|
||||||
|
await ctx.WaifuItem
|
||||||
|
.Where(x => x.WaifuInfo.Waifu.UserId == userId)
|
||||||
|
.DeleteAsync();
|
||||||
|
await ctx.WaifuInfo
|
||||||
|
.Where(x => x.Claimer.UserId == userId)
|
||||||
|
.UpdateAsync(old => new WaifuInfo()
|
||||||
|
{
|
||||||
|
ClaimerId = null,
|
||||||
|
});
|
||||||
|
await ctx.WaifuInfo
|
||||||
|
.Where(x => x.Waifu.UserId == userId)
|
||||||
|
.DeleteAsync();
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeletePlaylists()
|
||||||
|
{
|
||||||
|
await using var ctx = _db.GetDbContext();
|
||||||
|
await ctx.MusicPlaylists.DeleteAsync();
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeleteCurrency()
|
||||||
|
{
|
||||||
|
await using var ctx = _db.GetDbContext();
|
||||||
|
await ctx.DiscordUser.UpdateAsync(_ => new DiscordUser()
|
||||||
|
{
|
||||||
|
CurrencyAmount = 0
|
||||||
|
});
|
||||||
|
|
||||||
|
await ctx.CurrencyTransactions.DeleteAsync();
|
||||||
|
await ctx.PlantedCurrency.DeleteAsync();
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<int> ExecuteSql(string sql)
|
public async Task<int> ExecuteSql(string sql)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
using LinqToDB;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using NadekoBot.Common.ModuleBehaviors;
|
using NadekoBot.Common.ModuleBehaviors;
|
||||||
using NadekoBot.Common.TypeReaders.Models;
|
using NadekoBot.Common.TypeReaders.Models;
|
||||||
@@ -224,16 +225,34 @@ public class UserPunishService : INService, IReadyExecutor
|
|||||||
public async Task CheckAllWarnExpiresAsync()
|
public async Task CheckAllWarnExpiresAsync()
|
||||||
{
|
{
|
||||||
await using var uow = _db.GetDbContext();
|
await using var uow = _db.GetDbContext();
|
||||||
var cleared = await uow.Database.ExecuteSqlRawAsync(@"UPDATE Warnings
|
var cleared = await uow.Warnings
|
||||||
SET Forgiven = 1,
|
.Where(x => uow.GuildConfigs
|
||||||
ForgivenBy = 'Expiry'
|
.Any(y => y.GuildId == x.GuildId
|
||||||
WHERE GuildId in (SELECT GuildId FROM GuildConfigs WHERE WarnExpireHours > 0 AND WarnExpireAction = 0)
|
&& y.WarnExpireHours > 0
|
||||||
AND Forgiven = 0
|
&& y.WarnExpireAction == WarnExpireAction.Clear)
|
||||||
AND DateAdded < datetime('now', (SELECT '-' || WarnExpireHours || ' hours' FROM GuildConfigs as gc WHERE gc.GuildId = Warnings.GuildId));");
|
&& x.Forgiven == false
|
||||||
|
&& x.DateAdded
|
||||||
|
< DateTime.UtcNow.AddHours(-uow.GuildConfigs
|
||||||
|
.Where(y => x.GuildId == y.GuildId)
|
||||||
|
.Select(y => y.WarnExpireHours)
|
||||||
|
.First()))
|
||||||
|
.UpdateAsync(_ => new()
|
||||||
|
{
|
||||||
|
Forgiven = true,
|
||||||
|
ForgivenBy = "expiry"
|
||||||
|
});
|
||||||
|
|
||||||
var deleted = await uow.Database.ExecuteSqlRawAsync(@"DELETE FROM Warnings
|
var deleted = await uow.Warnings
|
||||||
WHERE GuildId in (SELECT GuildId FROM GuildConfigs WHERE WarnExpireHours > 0 AND WarnExpireAction = 1)
|
.Where(x => uow.GuildConfigs
|
||||||
AND DateAdded < datetime('now', (SELECT '-' || WarnExpireHours || ' hours' FROM GuildConfigs as gc WHERE gc.GuildId = Warnings.GuildId));");
|
.Any(y => y.GuildId == x.GuildId
|
||||||
|
&& y.WarnExpireHours > 0
|
||||||
|
&& y.WarnExpireAction == WarnExpireAction.Delete)
|
||||||
|
&& x.DateAdded
|
||||||
|
< DateTime.UtcNow.AddHours(-uow.GuildConfigs
|
||||||
|
.Where(y => x.GuildId == y.GuildId)
|
||||||
|
.Select(y => y.WarnExpireHours)
|
||||||
|
.First()))
|
||||||
|
.DeleteAsync();
|
||||||
|
|
||||||
if (cleared > 0 || deleted > 0)
|
if (cleared > 0 || deleted > 0)
|
||||||
{
|
{
|
||||||
@@ -241,6 +260,8 @@ WHERE GuildId in (SELECT GuildId FROM GuildConfigs WHERE WarnExpireHours > 0 AND
|
|||||||
cleared,
|
cleared,
|
||||||
deleted);
|
deleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await uow.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CheckWarnExpiresAsync(ulong guildId)
|
public async Task CheckWarnExpiresAsync(ulong guildId)
|
||||||
@@ -251,21 +272,24 @@ WHERE GuildId in (SELECT GuildId FROM GuildConfigs WHERE WarnExpireHours > 0 AND
|
|||||||
if (config.WarnExpireHours == 0)
|
if (config.WarnExpireHours == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var hours = $"{-config.WarnExpireHours} hours";
|
|
||||||
if (config.WarnExpireAction == WarnExpireAction.Clear)
|
if (config.WarnExpireAction == WarnExpireAction.Clear)
|
||||||
{
|
{
|
||||||
await uow.Database.ExecuteSqlInterpolatedAsync($@"UPDATE warnings
|
await uow.Warnings
|
||||||
SET Forgiven = 1,
|
.Where(x => x.GuildId == guildId
|
||||||
ForgivenBy = 'Expiry'
|
&& x.Forgiven == false
|
||||||
WHERE GuildId={guildId}
|
&& x.DateAdded < DateTime.UtcNow.AddHours(-config.WarnExpireHours))
|
||||||
AND Forgiven = 0
|
.UpdateAsync(_ => new()
|
||||||
AND DateAdded < datetime('now', {hours})");
|
{
|
||||||
|
Forgiven = true,
|
||||||
|
ForgivenBy = "expiry"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if (config.WarnExpireAction == WarnExpireAction.Delete)
|
else if (config.WarnExpireAction == WarnExpireAction.Delete)
|
||||||
{
|
{
|
||||||
await uow.Database.ExecuteSqlInterpolatedAsync($@"DELETE FROM warnings
|
await uow.Warnings
|
||||||
WHERE GuildId={guildId}
|
.Where(x => x.GuildId == guildId
|
||||||
AND DateAdded < datetime('now', {hours})");
|
&& x.DateAdded < DateTime.UtcNow.AddHours(-config.WarnExpireHours))
|
||||||
|
.DeleteAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
await uow.SaveChangesAsync();
|
await uow.SaveChangesAsync();
|
||||||
|
Reference in New Issue
Block a user