- Reaction roles rewritten completely. They now support multiple exclusivity groups per message and level requirements. However they can only be added one by one

- Bot now support much higher XP values for global and server levels
This commit is contained in:
Kwoth
2022-05-04 02:08:15 +02:00
parent 5cb95cf94d
commit 5b5bc278ff
35 changed files with 10820 additions and 715 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,114 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations
{
public partial class newrero : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ReactionRoles",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
MessageId = table.Column<ulong>(type: "INTEGER", nullable: false),
Emote = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
RoleId = table.Column<ulong>(type: "INTEGER", nullable: false),
Group = table.Column<int>(type: "INTEGER", nullable: false),
LevelReq = table.Column<int>(type: "INTEGER", nullable: false),
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ReactionRoles", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_ReactionRoles_GuildId",
table: "ReactionRoles",
column: "GuildId");
migrationBuilder.CreateIndex(
name: "IX_ReactionRoles_MessageId_Emote",
table: "ReactionRoles",
columns: new[] { "MessageId", "Emote" },
unique: true);
MigrationQueries.MigrateRero(migrationBuilder);
migrationBuilder.DropTable(
name: "ReactionRole");
migrationBuilder.DropTable(
name: "ReactionRoleMessage");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ReactionRoles");
migrationBuilder.CreateTable(
name: "ReactionRoleMessage",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GuildConfigId = table.Column<int>(type: "INTEGER", nullable: false),
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
Exclusive = table.Column<bool>(type: "INTEGER", nullable: false),
Index = table.Column<int>(type: "INTEGER", nullable: false),
MessageId = table.Column<ulong>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ReactionRoleMessage", x => x.Id);
table.ForeignKey(
name: "FK_ReactionRoleMessage_GuildConfigs_GuildConfigId",
column: x => x.GuildConfigId,
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ReactionRole",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
EmoteName = table.Column<string>(type: "TEXT", nullable: true),
ReactionRoleMessageId = table.Column<int>(type: "INTEGER", nullable: true),
RoleId = table.Column<ulong>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ReactionRole", x => x.Id);
table.ForeignKey(
name: "FK_ReactionRole_ReactionRoleMessage_ReactionRoleMessageId",
column: x => x.ReactionRoleMessageId,
principalTable: "ReactionRoleMessage",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ReactionRole_ReactionRoleMessageId",
table: "ReactionRole",
column: "ReactionRoleMessageId");
migrationBuilder.CreateIndex(
name: "IX_ReactionRoleMessage_GuildConfigId",
table: "ReactionRoleMessage",
column: "GuildConfigId");
}
}
}

View File

@@ -1415,32 +1415,7 @@ namespace NadekoBot.Migrations
b.ToTable("Quotes");
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRole", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<string>("EmoteName")
.HasColumnType("TEXT");
b.Property<int?>("ReactionRoleMessageId")
.HasColumnType("INTEGER");
b.Property<ulong>("RoleId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ReactionRoleMessageId");
b.ToTable("ReactionRole");
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRoleMessage", b =>
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRoleV2", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@@ -1452,23 +1427,33 @@ namespace NadekoBot.Migrations
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<bool>("Exclusive")
b.Property<string>("Emote")
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<int>("Group")
.HasColumnType("INTEGER");
b.Property<int>("GuildConfigId")
b.Property<ulong>("GuildId")
.HasColumnType("INTEGER");
b.Property<int>("Index")
b.Property<int>("LevelReq")
.HasColumnType("INTEGER");
b.Property<ulong>("MessageId")
.HasColumnType("INTEGER");
b.Property<ulong>("RoleId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("GuildConfigId");
b.HasIndex("GuildId");
b.ToTable("ReactionRoleMessage");
b.HasIndex("MessageId", "Emote")
.IsUnique();
b.ToTable("ReactionRoles");
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.Reminder", b =>
@@ -2456,25 +2441,6 @@ namespace NadekoBot.Migrations
.HasForeignKey("PollId");
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRole", b =>
{
b.HasOne("NadekoBot.Services.Database.Models.ReactionRoleMessage", null)
.WithMany("ReactionRoles")
.HasForeignKey("ReactionRoleMessageId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRoleMessage", b =>
{
b.HasOne("NadekoBot.Services.Database.Models.GuildConfig", "GuildConfig")
.WithMany("ReactionRoleMessages")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("GuildConfig");
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.ShopEntry", b =>
{
b.HasOne("NadekoBot.Services.Database.Models.GuildConfig", null)
@@ -2702,8 +2668,6 @@ namespace NadekoBot.Migrations
b.Navigation("Permissions");
b.Navigation("ReactionRoleMessages");
b.Navigation("SelfAssignableRoleGroupNames");
b.Navigation("ShopEntries");
@@ -2744,11 +2708,6 @@ namespace NadekoBot.Migrations
b.Navigation("Votes");
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.ReactionRoleMessage", b =>
{
b.Navigation("ReactionRoles");
});
modelBuilder.Entity("NadekoBot.Services.Database.Models.ShopEntry", b =>
{
b.Navigation("Items");