NadekoBot Patronage system, Search commands improvements + fixes

This commit is contained in:
Kwoth
2022-06-14 07:24:33 +00:00
parent 18b10b8c6f
commit 7b5145f116
165 changed files with 14920 additions and 1457 deletions

View File

@@ -87,7 +87,7 @@ namespace NadekoBot.Migrations
name: "VoicePresenceChannelId",
table: "LogSettings");
// todo cleanup guildconfigs which have logsettings id set to null
// FUTURE cleanup guildconfigs which have logsettings id set to null
migrationBuilder.Sql("UPDATE GuildConfigs SET LogSettingId = null WHERE LogSettingId NOT IN (SELECT Id from LogSettings)");
migrationBuilder.DropTable(

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,123 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations
{
public partial class patronagesystem : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "PatreonUserId",
table: "RewardedUsers",
newName: "PlatformUserId");
migrationBuilder.RenameIndex(
name: "IX_RewardedUsers_PatreonUserId",
table: "RewardedUsers",
newName: "IX_RewardedUsers_PlatformUserId");
migrationBuilder.AlterColumn<bool>(
name: "VerboseErrors",
table: "GuildConfigs",
type: "INTEGER",
nullable: false,
defaultValue: true,
oldClrType: typeof(bool),
oldType: "INTEGER");
migrationBuilder.AlterColumn<long>(
name: "TotalXp",
table: "DiscordUser",
type: "INTEGER",
nullable: false,
defaultValue: 0L,
oldClrType: typeof(int),
oldType: "INTEGER",
oldDefaultValue: 0);
migrationBuilder.CreateTable(
name: "PatronQuotas",
columns: table => new
{
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
FeatureType = table.Column<int>(type: "INTEGER", nullable: false),
Feature = table.Column<string>(type: "TEXT", nullable: false),
HourlyCount = table.Column<uint>(type: "INTEGER", nullable: false),
DailyCount = table.Column<uint>(type: "INTEGER", nullable: false),
MonthlyCount = table.Column<uint>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PatronQuotas", x => new { x.UserId, x.FeatureType, x.Feature });
});
migrationBuilder.CreateTable(
name: "Patrons",
columns: table => new
{
UserId = table.Column<ulong>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UniquePlatformUserId = table.Column<string>(type: "TEXT", nullable: true),
AmountCents = table.Column<int>(type: "INTEGER", nullable: false),
LastCharge = table.Column<DateTime>(type: "TEXT", nullable: false),
ValidThru = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Patrons", x => x.UserId);
});
migrationBuilder.CreateIndex(
name: "IX_PatronQuotas_UserId",
table: "PatronQuotas",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Patrons_UniquePlatformUserId",
table: "Patrons",
column: "UniquePlatformUserId",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PatronQuotas");
migrationBuilder.DropTable(
name: "Patrons");
migrationBuilder.RenameColumn(
name: "PlatformUserId",
table: "RewardedUsers",
newName: "PatreonUserId");
migrationBuilder.RenameIndex(
name: "IX_RewardedUsers_PlatformUserId",
table: "RewardedUsers",
newName: "IX_RewardedUsers_PatreonUserId");
migrationBuilder.AlterColumn<bool>(
name: "VerboseErrors",
table: "GuildConfigs",
type: "INTEGER",
nullable: false,
oldClrType: typeof(bool),
oldType: "INTEGER",
oldDefaultValue: true);
migrationBuilder.AlterColumn<int>(
name: "TotalXp",
table: "DiscordUser",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(long),
oldType: "INTEGER",
oldDefaultValue: 0L);
}
}
}

View File

@@ -15,7 +15,7 @@ namespace NadekoBot.Migrations
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.3");
modelBuilder.HasAnnotation("ProductVersion", "6.0.5");
modelBuilder.Entity("NadekoBot.Db.Models.BankUser", b =>
{
@@ -149,10 +149,10 @@ namespace NadekoBot.Migrations
.HasColumnType("INTEGER")
.HasDefaultValue(0);
b.Property<int>("TotalXp")
b.Property<long>("TotalXp")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0);
.HasDefaultValue(0L);
b.Property<ulong>("UserId")
.HasColumnType("INTEGER");
@@ -209,6 +209,59 @@ namespace NadekoBot.Migrations
b.ToTable("FollowedStream");
});
modelBuilder.Entity("NadekoBot.Db.Models.PatronQuota", b =>
{
b.Property<ulong>("UserId")
.HasColumnType("INTEGER");
b.Property<int>("FeatureType")
.HasColumnType("INTEGER");
b.Property<string>("Feature")
.HasColumnType("TEXT");
b.Property<uint>("DailyCount")
.HasColumnType("INTEGER");
b.Property<uint>("HourlyCount")
.HasColumnType("INTEGER");
b.Property<uint>("MonthlyCount")
.HasColumnType("INTEGER");
b.HasKey("UserId", "FeatureType", "Feature");
b.HasIndex("UserId");
b.ToTable("PatronQuotas");
});
modelBuilder.Entity("NadekoBot.Db.Models.PatronUser", b =>
{
b.Property<ulong>("UserId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("AmountCents")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastCharge")
.HasColumnType("TEXT");
b.Property<string>("UniquePlatformUserId")
.HasColumnType("TEXT");
b.Property<DateTime>("ValidThru")
.HasColumnType("TEXT");
b.HasKey("UserId");
b.HasIndex("UniquePlatformUserId")
.IsUnique();
b.ToTable("Patrons");
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.AntiAltSetting", b =>
{
b.Property<int>("Id")
@@ -890,7 +943,9 @@ namespace NadekoBot.Migrations
.HasColumnType("TEXT");
b.Property<bool>("VerboseErrors")
.HasColumnType("INTEGER");
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true);
b.Property<bool>("VerbosePermissions")
.HasColumnType("INTEGER");
@@ -1531,7 +1586,7 @@ namespace NadekoBot.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("AmountRewardedThisMonth")
b.Property<long>("AmountRewardedThisMonth")
.HasColumnType("INTEGER");
b.Property<DateTime?>("DateAdded")
@@ -1540,7 +1595,7 @@ namespace NadekoBot.Migrations
b.Property<DateTime>("LastReward")
.HasColumnType("TEXT");
b.Property<string>("PatreonUserId")
b.Property<string>("PlatformUserId")
.HasColumnType("TEXT");
b.Property<ulong>("UserId")
@@ -1548,7 +1603,7 @@ namespace NadekoBot.Migrations
b.HasKey("Id");
b.HasIndex("PatreonUserId")
b.HasIndex("PlatformUserId")
.IsUnique();
b.ToTable("RewardedUsers");
@@ -1877,7 +1932,7 @@ namespace NadekoBot.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("AwardedXp")
b.Property<long>("AwardedXp")
.HasColumnType("INTEGER");
b.Property<DateTime?>("DateAdded")
@@ -1897,7 +1952,7 @@ namespace NadekoBot.Migrations
b.Property<ulong>("UserId")
.HasColumnType("INTEGER");
b.Property<int>("Xp")
b.Property<long>("Xp")
.HasColumnType("INTEGER");
b.HasKey("Id");