diff --git a/ChaosBot/Migrations/20200819203430_RoleReaction.Designer.cs b/ChaosBot/Migrations/20200819203430_RoleReaction.Designer.cs
new file mode 100644
index 0000000..6826a1a
--- /dev/null
+++ b/ChaosBot/Migrations/20200819203430_RoleReaction.Designer.cs
@@ -0,0 +1,163 @@
+//
+using System;
+using ChaosBot.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace ChaosBot.Migrations
+{
+ [DbContext(typeof(ChaosbotContext))]
+ [Migration("20200819203430_RoleReaction")]
+ partial class RoleReaction
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "3.1.6")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("ChaosBot.Models.CommandPermission", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint unsigned");
+
+ b.Property("Command")
+ .IsRequired()
+ .HasColumnType("varchar(128) CHARACTER SET utf8mb4")
+ .HasMaxLength(128);
+
+ b.Property("DiscordGuildId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("TargetId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("TargetType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("CommandPermissions");
+ });
+
+ modelBuilder.Entity("ChaosBot.Models.Configuration", b =>
+ {
+ b.Property("DiscordGuildId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("Key")
+ .HasColumnType("varchar(128) CHARACTER SET utf8mb4")
+ .HasMaxLength(128);
+
+ b.Property("SerializedValue")
+ .IsRequired()
+ .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+ b.HasKey("DiscordGuildId", "Key");
+
+ b.ToTable("Configuration");
+ });
+
+ modelBuilder.Entity("ChaosBot.Models.Experience", b =>
+ {
+ b.Property("DiscordGuildId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("DiscordUserId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("Amount")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("LastUpdated")
+ .HasColumnType("datetime");
+
+ b.Property("Level")
+ .HasColumnType("bigint unsigned");
+
+ b.HasKey("DiscordGuildId", "DiscordUserId");
+
+ b.ToTable("ExperiencePoints");
+ });
+
+ modelBuilder.Entity("ChaosBot.Models.LodestoneCharacter", b =>
+ {
+ b.Property("DiscordGuildId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("LodestoneId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("Avatar")
+ .IsRequired()
+ .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+ b.Property("DiscordUserId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+ b.HasKey("DiscordGuildId", "LodestoneId");
+
+ b.ToTable("LodestoneCharacter");
+ });
+
+ modelBuilder.Entity("ChaosBot.Models.LodestoneFreeCompany", b =>
+ {
+ b.Property("DiscordGuildId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("LodestoneId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+ b.HasKey("DiscordGuildId", "LodestoneId");
+
+ b.ToTable("LodestoneFreeCompany");
+ });
+
+ modelBuilder.Entity("ChaosBot.Models.Point", b =>
+ {
+ b.Property("DiscordGuildId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("DiscordUserId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("Amount")
+ .HasColumnType("bigint unsigned");
+
+ b.HasKey("DiscordGuildId", "DiscordUserId");
+
+ b.ToTable("Points");
+ });
+
+ modelBuilder.Entity("ChaosBot.Models.Raffle", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint unsigned");
+
+ b.Property("DiscordGuildId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("DiscordUserId")
+ .HasColumnType("bigint unsigned");
+
+ b.HasKey("Id");
+
+ b.ToTable("Raffles");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/ChaosBot/Migrations/20200819203430_RoleReaction.cs b/ChaosBot/Migrations/20200819203430_RoleReaction.cs
new file mode 100644
index 0000000..45887d3
--- /dev/null
+++ b/ChaosBot/Migrations/20200819203430_RoleReaction.cs
@@ -0,0 +1,33 @@
+using System;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace ChaosBot.Migrations
+{
+ public partial class RoleReaction : Migration
+ {
+ protected readonly string Table = "RoleReactions";
+
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: Table,
+ columns: table => new
+ {
+ DiscordGuildId = table.Column(nullable: false),
+ DiscordMessageId = table.Column(nullable: false),
+ DiscordRoleId = table.Column(nullable: false),
+ DiscordEmoteNameEncoded = table.Column(nullable: false, maxLength: 128)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_RoleReactions", x => new { x.DiscordGuildId, x.DiscordRoleId, x.DiscordMessageId, x.DiscordEmoteNameEncoded });
+ });
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(name: Table);
+ }
+ }
+}
diff --git a/ChaosBot/Migrations/ChaosbotContextModelSnapshot.cs b/ChaosBot/Migrations/ChaosbotContextModelSnapshot.cs
index 9903ed6..449c819 100644
--- a/ChaosBot/Migrations/ChaosbotContextModelSnapshot.cs
+++ b/ChaosBot/Migrations/ChaosbotContextModelSnapshot.cs
@@ -1,4 +1,5 @@
//
+using System;
using ChaosBot.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@@ -24,7 +25,8 @@ namespace ChaosBot.Migrations
b.Property("Command")
.IsRequired()
- .HasColumnType("longtext CHARACTER SET utf8mb4");
+ .HasColumnType("varchar(128) CHARACTER SET utf8mb4")
+ .HasMaxLength(128);
b.Property("DiscordGuildId")
.HasColumnType("bigint unsigned");
@@ -58,6 +60,28 @@ namespace ChaosBot.Migrations
b.ToTable("Configuration");
});
+ modelBuilder.Entity("ChaosBot.Models.Experience", b =>
+ {
+ b.Property("DiscordGuildId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("DiscordUserId")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("Amount")
+ .HasColumnType("bigint unsigned");
+
+ b.Property("LastUpdated")
+ .HasColumnType("datetime");
+
+ b.Property("Level")
+ .HasColumnType("bigint unsigned");
+
+ b.HasKey("DiscordGuildId", "DiscordUserId");
+
+ b.ToTable("ExperiencePoints");
+ });
+
modelBuilder.Entity("ChaosBot.Models.LodestoneCharacter", b =>
{
b.Property("DiscordGuildId")
diff --git a/ChaosBot/Models/ChaosbotContext.cs b/ChaosBot/Models/ChaosbotContext.cs
index 7715eb6..bb6c866 100644
--- a/ChaosBot/Models/ChaosbotContext.cs
+++ b/ChaosBot/Models/ChaosbotContext.cs
@@ -12,6 +12,7 @@ namespace ChaosBot.Models
public DbSet CommandPermissions { get; set; }
public DbSet Configuration { get; set; }
public DbSet ExperiencePoints { get; set; }
+ public DbSet RoleReactions { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@@ -46,6 +47,8 @@ namespace ChaosBot.Models
.HasKey(x => new {x.DiscordGuildId, x.DiscordUserId});
modelBuilder.Entity()
.HasKey(x => new {x.DiscordGuildId, x.Key});
+ modelBuilder.Entity()
+ .HasKey(x => new {x.DiscordGuildId, x.DiscordMessageId, x.DiscordRoleId, x.DiscordEmoteNameEncoded});
}
}
}
\ No newline at end of file
diff --git a/ChaosBot/Models/RoleReaction.cs b/ChaosBot/Models/RoleReaction.cs
new file mode 100644
index 0000000..deaf0c7
--- /dev/null
+++ b/ChaosBot/Models/RoleReaction.cs
@@ -0,0 +1,37 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Text;
+
+namespace ChaosBot.Models
+{
+ #region Required
+ public class RoleReaction
+ {
+ [Required]
+ public ulong DiscordGuildId { get; set; }
+ [Required]
+ public ulong DiscordMessageId { get; set; }
+ [Required]
+ public ulong DiscordRoleId { get; set; }
+
+ [NotMapped]
+ public string DiscordEmoteName
+ {
+ get
+ {
+ if (DiscordEmoteNameEncoded == null) return null;
+ return Encoding.UTF8.GetString(Convert.FromBase64String(DiscordEmoteNameEncoded));
+ }
+ set
+ {
+ if (value != null)
+ DiscordEmoteNameEncoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(value));
+ }
+ }
+
+ [Required]
+ public string DiscordEmoteNameEncoded { get; set; }
+ }
+ #endregion
+}
\ No newline at end of file