reset migrations
This commit is contained in:
parent
8a9e117366
commit
964833502c
19 changed files with 81 additions and 159 deletions
src/EllieBot
Bot.cs
Db/Models
EllieBot.csprojMigrations
PostgreSql
20250127062816_init.Designer.cs20250127062816_init.cs20250202095045_fk-remove.sqlPostgreSqlContextModelSnapshot.cs
Sqlite
Modules/Expressions
_common
|
@ -119,7 +119,6 @@ public sealed class Bot : IBot
|
||||||
svcs.AddSingleton<IConfigSeria, YamlSeria>();
|
svcs.AddSingleton<IConfigSeria, YamlSeria>();
|
||||||
svcs.AddSingleton<IMemoryCache, MemoryCache>(new MemoryCache(new MemoryCacheOptions()));
|
svcs.AddSingleton<IMemoryCache, MemoryCache>(new MemoryCache(new MemoryCacheOptions()));
|
||||||
svcs.AddSingleton<IBehaviorHandler, BehaviorHandler>();
|
svcs.AddSingleton<IBehaviorHandler, BehaviorHandler>();
|
||||||
svcs.AddSingleton<ILocalization, Localization>();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var a in _loadedAssemblies)
|
foreach (var a in _loadedAssemblies)
|
||||||
|
|
|
@ -16,7 +16,6 @@ public class GuildFilterConfig
|
||||||
public bool FilterWords { get; set; }
|
public bool FilterWords { get; set; }
|
||||||
public HashSet<FilterChannelId> FilterInvitesChannelIds { get; set; } = new();
|
public HashSet<FilterChannelId> FilterInvitesChannelIds { get; set; } = new();
|
||||||
public HashSet<FilterLinksChannelId> FilterLinksChannelIds { get; set; } = new();
|
public HashSet<FilterLinksChannelId> FilterLinksChannelIds { get; set; } = new();
|
||||||
|
|
||||||
public HashSet<FilteredWord> FilteredWords { get; set; } = new();
|
public HashSet<FilteredWord> FilteredWords { get; set; } = new();
|
||||||
public HashSet<FilterWordsChannelId> FilterWordsChannelIds { get; set; } = new();
|
public HashSet<FilterWordsChannelId> FilterWordsChannelIds { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ public class FilterChannelId
|
||||||
[Key]
|
[Key]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int GuildFilterConfigId { get; set; }
|
||||||
|
|
||||||
public ulong ChannelId { get; set; }
|
public ulong ChannelId { get; set; }
|
||||||
|
|
||||||
protected bool Equals(FilterChannelId other)
|
protected bool Equals(FilterChannelId other)
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
namespace EllieBot.Db.Models;
|
namespace EllieBot.Db.Models;
|
||||||
|
|
||||||
public class FilterLinksChannelId : DbEntity
|
public class FilterLinksChannelId : DbEntity
|
||||||
{
|
{
|
||||||
public ulong ChannelId { get; set; }
|
public ulong ChannelId { get; set; }
|
||||||
|
public int GuildFilterConfigId { get; set; }
|
||||||
|
|
||||||
protected bool Equals(FilterLinksChannelId other)
|
protected bool Equals(FilterLinksChannelId other)
|
||||||
=> ChannelId == other.ChannelId;
|
=> ChannelId == other.ChannelId;
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
namespace EllieBot.Db.Models;
|
namespace EllieBot.Db.Models;
|
||||||
|
|
||||||
public class FilterWordsChannelId : DbEntity
|
public class FilterWordsChannelId : DbEntity
|
||||||
{
|
{
|
||||||
|
public int GuildFilterConfigId { get; set; }
|
||||||
public ulong ChannelId { get; set; }
|
public ulong ChannelId { get; set; }
|
||||||
|
|
||||||
protected bool Equals(FilterWordsChannelId other)
|
protected bool Equals(FilterWordsChannelId other)
|
||||||
|
|
|
@ -2,6 +2,7 @@ namespace EllieBot.Db.Models;
|
||||||
|
|
||||||
public class FilteredWord : DbEntity
|
public class FilteredWord : DbEntity
|
||||||
{
|
{
|
||||||
|
public int GuildFilterConfigId { get; set; }
|
||||||
public string Word { get; set; } = string.Empty;
|
public string Word { get; set; } = string.Empty;
|
||||||
|
|
||||||
public override bool Equals(object? obj) => obj is FilteredWord fw && fw.Word == Word;
|
public override bool Equals(object? obj) => obj is FilteredWord fw && fw.Word == Word;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
public class ExcludedItem : DbEntity
|
public class ExcludedItem : DbEntity
|
||||||
{
|
{
|
||||||
|
public int XpSettingsId { get; set; }
|
||||||
public ulong ItemId { get; set; }
|
public ulong ItemId { get; set; }
|
||||||
public ExcludedItemType ItemType { get; set; }
|
public ExcludedItemType ItemType { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -112,10 +112,6 @@
|
||||||
<AdditionalFiles Include="strings\responses\responses.en-US.json" />
|
<AdditionalFiles Include="strings\responses\responses.en-US.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Migrations\Sqlite\20250202095042_fk-remove.sql" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="data\**\*">
|
<None Update="data\**\*">
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
|
|
@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
namespace EllieBot.Migrations.PostgreSql
|
namespace EllieBot.Migrations.PostgreSql
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PostgreSqlContext))]
|
[DbContext(typeof(PostgreSqlContext))]
|
||||||
[Migration("20250202095110_init")]
|
[Migration("20250127062816_init")]
|
||||||
partial class init
|
partial class init
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -85,6 +85,10 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnType("timestamp without time zone")
|
.HasColumnType("timestamp without time zone")
|
||||||
.HasColumnName("dateadded");
|
.HasColumnName("dateadded");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("guildconfigid");
|
||||||
|
|
||||||
b.Property<decimal>("GuildId")
|
b.Property<decimal>("GuildId")
|
||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("guildid");
|
.HasColumnName("guildid");
|
||||||
|
@ -747,6 +751,10 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnType("timestamp without time zone")
|
.HasColumnType("timestamp without time zone")
|
||||||
.HasColumnName("dateadded");
|
.HasColumnName("dateadded");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("guildconfigid");
|
||||||
|
|
||||||
b.Property<decimal>("GuildId")
|
b.Property<decimal>("GuildId")
|
||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("guildid");
|
.HasColumnName("guildid");
|
||||||
|
@ -928,6 +936,10 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnType("timestamp without time zone")
|
.HasColumnType("timestamp without time zone")
|
||||||
.HasColumnName("dateadded");
|
.HasColumnName("dateadded");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("guildconfigid");
|
||||||
|
|
||||||
b.Property<decimal>("GuildId")
|
b.Property<decimal>("GuildId")
|
||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("guildid");
|
.HasColumnName("guildid");
|
||||||
|
@ -1054,7 +1066,6 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnName("guildfilterconfigid");
|
.HasColumnName("guildfilterconfigid");
|
||||||
|
|
||||||
b.Property<string>("Word")
|
b.Property<string>("Word")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text")
|
.HasColumnType("text")
|
||||||
.HasColumnName("word");
|
.HasColumnName("word");
|
||||||
|
|
||||||
|
@ -3356,6 +3367,10 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnType("timestamp without time zone")
|
.HasColumnType("timestamp without time zone")
|
||||||
.HasColumnName("dateadded");
|
.HasColumnName("dateadded");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("guildconfigid");
|
||||||
|
|
||||||
b.Property<decimal>("GuildId")
|
b.Property<decimal>("GuildId")
|
||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("guildid");
|
.HasColumnName("guildid");
|
|
@ -36,6 +36,7 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
{
|
{
|
||||||
id = table.Column<int>(type: "integer", nullable: false)
|
id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
guildconfigid = table.Column<int>(type: "integer", nullable: false),
|
||||||
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||||
userthreshold = table.Column<int>(type: "integer", nullable: false),
|
userthreshold = table.Column<int>(type: "integer", nullable: false),
|
||||||
seconds = table.Column<int>(type: "integer", nullable: false),
|
seconds = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
@ -244,6 +245,7 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
{
|
{
|
||||||
id = table.Column<int>(type: "integer", nullable: false)
|
id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
guildconfigid = table.Column<int>(type: "integer", nullable: false),
|
||||||
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||||
channelid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
channelid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||||
state = table.Column<bool>(type: "boolean", nullable: false),
|
state = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
@ -297,6 +299,7 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
{
|
{
|
||||||
id = table.Column<int>(type: "integer", nullable: false)
|
id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
guildconfigid = table.Column<int>(type: "integer", nullable: false),
|
||||||
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||||
channelid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
channelid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||||
url = table.Column<string>(type: "text", nullable: true),
|
url = table.Column<string>(type: "text", nullable: true),
|
||||||
|
@ -1117,6 +1120,7 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
{
|
{
|
||||||
id = table.Column<int>(type: "integer", nullable: false)
|
id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
guildconfigid = table.Column<int>(type: "integer", nullable: false),
|
||||||
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||||
serverexcluded = table.Column<bool>(type: "boolean", nullable: false),
|
serverexcluded = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
dateadded = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
|
dateadded = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
|
||||||
|
@ -1261,7 +1265,7 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
{
|
{
|
||||||
id = table.Column<int>(type: "integer", nullable: false)
|
id = table.Column<int>(type: "integer", nullable: false)
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
word = table.Column<string>(type: "text", nullable: false),
|
word = table.Column<string>(type: "text", nullable: true),
|
||||||
guildfilterconfigid = table.Column<int>(type: "integer", nullable: true),
|
guildfilterconfigid = table.Column<int>(type: "integer", nullable: true),
|
||||||
dateadded = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
|
dateadded = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
|
||||||
},
|
},
|
|
@ -1,18 +0,0 @@
|
||||||
START TRANSACTION;
|
|
||||||
ALTER TABLE xpsettings DROP COLUMN guildconfigid;
|
|
||||||
|
|
||||||
ALTER TABLE feedsub DROP COLUMN guildconfigid;
|
|
||||||
|
|
||||||
ALTER TABLE delmsgoncmdchannel DROP COLUMN guildconfigid;
|
|
||||||
|
|
||||||
ALTER TABLE antiraidsetting DROP COLUMN guildconfigid;
|
|
||||||
|
|
||||||
UPDATE filteredword SET word = '' WHERE word IS NULL;
|
|
||||||
ALTER TABLE filteredword ALTER COLUMN word SET NOT NULL;
|
|
||||||
ALTER TABLE filteredword ALTER COLUMN word SET DEFAULT '';
|
|
||||||
|
|
||||||
INSERT INTO "__EFMigrationsHistory" (migrationid, productversion)
|
|
||||||
VALUES ('20250202095045_fk-remove', '9.0.1');
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
|
@ -82,6 +82,10 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnType("timestamp without time zone")
|
.HasColumnType("timestamp without time zone")
|
||||||
.HasColumnName("dateadded");
|
.HasColumnName("dateadded");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("guildconfigid");
|
||||||
|
|
||||||
b.Property<decimal>("GuildId")
|
b.Property<decimal>("GuildId")
|
||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("guildid");
|
.HasColumnName("guildid");
|
||||||
|
@ -744,6 +748,10 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnType("timestamp without time zone")
|
.HasColumnType("timestamp without time zone")
|
||||||
.HasColumnName("dateadded");
|
.HasColumnName("dateadded");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("guildconfigid");
|
||||||
|
|
||||||
b.Property<decimal>("GuildId")
|
b.Property<decimal>("GuildId")
|
||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("guildid");
|
.HasColumnName("guildid");
|
||||||
|
@ -925,6 +933,10 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnType("timestamp without time zone")
|
.HasColumnType("timestamp without time zone")
|
||||||
.HasColumnName("dateadded");
|
.HasColumnName("dateadded");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("guildconfigid");
|
||||||
|
|
||||||
b.Property<decimal>("GuildId")
|
b.Property<decimal>("GuildId")
|
||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("guildid");
|
.HasColumnName("guildid");
|
||||||
|
@ -1051,7 +1063,6 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnName("guildfilterconfigid");
|
.HasColumnName("guildfilterconfigid");
|
||||||
|
|
||||||
b.Property<string>("Word")
|
b.Property<string>("Word")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text")
|
.HasColumnType("text")
|
||||||
.HasColumnName("word");
|
.HasColumnName("word");
|
||||||
|
|
||||||
|
@ -3353,6 +3364,10 @@ namespace EllieBot.Migrations.PostgreSql
|
||||||
.HasColumnType("timestamp without time zone")
|
.HasColumnType("timestamp without time zone")
|
||||||
.HasColumnName("dateadded");
|
.HasColumnName("dateadded");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("guildconfigid");
|
||||||
|
|
||||||
b.Property<decimal>("GuildId")
|
b.Property<decimal>("GuildId")
|
||||||
.HasColumnType("numeric(20,0)")
|
.HasColumnType("numeric(20,0)")
|
||||||
.HasColumnName("guildid");
|
.HasColumnName("guildid");
|
||||||
|
|
|
@ -11,7 +11,7 @@ using EllieBot.Db;
|
||||||
namespace EllieBot.Migrations.Sqlite
|
namespace EllieBot.Migrations.Sqlite
|
||||||
{
|
{
|
||||||
[DbContext(typeof(SqliteContext))]
|
[DbContext(typeof(SqliteContext))]
|
||||||
[Migration("20250202095107_init")]
|
[Migration("20250127062834_init")]
|
||||||
partial class init
|
partial class init
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -64,6 +64,9 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
b.Property<DateTime?>("DateAdded")
|
b.Property<DateTime?>("DateAdded")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<ulong>("GuildId")
|
b.Property<ulong>("GuildId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
@ -559,6 +562,9 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
b.Property<DateTime?>("DateAdded")
|
b.Property<DateTime?>("DateAdded")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<ulong>("GuildId")
|
b.Property<ulong>("GuildId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
@ -694,6 +700,9 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
b.Property<DateTime?>("DateAdded")
|
b.Property<DateTime?>("DateAdded")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<ulong>("GuildId")
|
b.Property<ulong>("GuildId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
@ -787,7 +796,6 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("Word")
|
b.Property<string>("Word")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
@ -2497,6 +2505,9 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
b.Property<DateTime?>("DateAdded")
|
b.Property<DateTime?>("DateAdded")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<ulong>("GuildId")
|
b.Property<ulong>("GuildId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
GuildConfigId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||||
UserThreshold = table.Column<int>(type: "INTEGER", nullable: false),
|
UserThreshold = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
Seconds = table.Column<int>(type: "INTEGER", nullable: false),
|
Seconds = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
@ -243,6 +244,7 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
GuildConfigId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||||
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||||
State = table.Column<bool>(type: "INTEGER", nullable: false),
|
State = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||||
|
@ -296,6 +298,7 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
GuildConfigId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||||
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||||
Url = table.Column<string>(type: "TEXT", nullable: true),
|
Url = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
|
@ -1119,6 +1122,7 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
GuildConfigId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||||
ServerExcluded = table.Column<bool>(type: "INTEGER", nullable: false),
|
ServerExcluded = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||||
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true)
|
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true)
|
||||||
|
@ -1263,7 +1267,7 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
Word = table.Column<string>(type: "TEXT", nullable: false),
|
Word = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
GuildFilterConfigId = table.Column<int>(type: "INTEGER", nullable: true),
|
GuildFilterConfigId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||||
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true)
|
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true)
|
||||||
},
|
},
|
|
@ -1,108 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
CREATE TABLE "ef_temp_XpSettings" (
|
|
||||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_XpSettings" PRIMARY KEY AUTOINCREMENT,
|
|
||||||
"DateAdded" TEXT NULL,
|
|
||||||
"GuildId" INTEGER NOT NULL,
|
|
||||||
"ServerExcluded" INTEGER NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "ef_temp_XpSettings" ("Id", "DateAdded", "GuildId", "ServerExcluded")
|
|
||||||
SELECT "Id", "DateAdded", "GuildId", "ServerExcluded"
|
|
||||||
FROM "XpSettings";
|
|
||||||
|
|
||||||
CREATE TABLE "ef_temp_FeedSub" (
|
|
||||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_FeedSub" PRIMARY KEY AUTOINCREMENT,
|
|
||||||
"ChannelId" INTEGER NOT NULL,
|
|
||||||
"DateAdded" TEXT NULL,
|
|
||||||
"GuildId" INTEGER NOT NULL,
|
|
||||||
"Message" TEXT NULL,
|
|
||||||
"Url" TEXT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "ef_temp_FeedSub" ("Id", "ChannelId", "DateAdded", "GuildId", "Message", "Url")
|
|
||||||
SELECT "Id", "ChannelId", "DateAdded", "GuildId", "Message", "Url"
|
|
||||||
FROM "FeedSub";
|
|
||||||
|
|
||||||
CREATE TABLE "ef_temp_DelMsgOnCmdChannel" (
|
|
||||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_DelMsgOnCmdChannel" PRIMARY KEY AUTOINCREMENT,
|
|
||||||
"ChannelId" INTEGER NOT NULL,
|
|
||||||
"DateAdded" TEXT NULL,
|
|
||||||
"GuildId" INTEGER NOT NULL,
|
|
||||||
"State" INTEGER NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "ef_temp_DelMsgOnCmdChannel" ("Id", "ChannelId", "DateAdded", "GuildId", "State")
|
|
||||||
SELECT "Id", "ChannelId", "DateAdded", "GuildId", "State"
|
|
||||||
FROM "DelMsgOnCmdChannel";
|
|
||||||
|
|
||||||
CREATE TABLE "ef_temp_AntiRaidSetting" (
|
|
||||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_AntiRaidSetting" PRIMARY KEY AUTOINCREMENT,
|
|
||||||
"Action" INTEGER NOT NULL,
|
|
||||||
"DateAdded" TEXT NULL,
|
|
||||||
"GuildId" INTEGER NOT NULL,
|
|
||||||
"PunishDuration" INTEGER NOT NULL,
|
|
||||||
"Seconds" INTEGER NOT NULL,
|
|
||||||
"UserThreshold" INTEGER NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "ef_temp_AntiRaidSetting" ("Id", "Action", "DateAdded", "GuildId", "PunishDuration", "Seconds", "UserThreshold")
|
|
||||||
SELECT "Id", "Action", "DateAdded", "GuildId", "PunishDuration", "Seconds", "UserThreshold"
|
|
||||||
FROM "AntiRaidSetting";
|
|
||||||
|
|
||||||
CREATE TABLE "ef_temp_FilteredWord" (
|
|
||||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_FilteredWord" PRIMARY KEY AUTOINCREMENT,
|
|
||||||
"DateAdded" TEXT NULL,
|
|
||||||
"GuildFilterConfigId" INTEGER NULL,
|
|
||||||
"Word" TEXT NOT NULL,
|
|
||||||
CONSTRAINT "FK_FilteredWord_GuildFilterConfig_GuildFilterConfigId" FOREIGN KEY ("GuildFilterConfigId") REFERENCES "GuildFilterConfig" ("Id")
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "ef_temp_FilteredWord" ("Id", "DateAdded", "GuildFilterConfigId", "Word")
|
|
||||||
SELECT "Id", "DateAdded", "GuildFilterConfigId", IFNULL("Word", '')
|
|
||||||
FROM "FilteredWord";
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
PRAGMA foreign_keys = 0;
|
|
||||||
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
DROP TABLE "XpSettings";
|
|
||||||
|
|
||||||
ALTER TABLE "ef_temp_XpSettings" RENAME TO "XpSettings";
|
|
||||||
|
|
||||||
DROP TABLE "FeedSub";
|
|
||||||
|
|
||||||
ALTER TABLE "ef_temp_FeedSub" RENAME TO "FeedSub";
|
|
||||||
|
|
||||||
DROP TABLE "DelMsgOnCmdChannel";
|
|
||||||
|
|
||||||
ALTER TABLE "ef_temp_DelMsgOnCmdChannel" RENAME TO "DelMsgOnCmdChannel";
|
|
||||||
|
|
||||||
DROP TABLE "AntiRaidSetting";
|
|
||||||
|
|
||||||
ALTER TABLE "ef_temp_AntiRaidSetting" RENAME TO "AntiRaidSetting";
|
|
||||||
|
|
||||||
DROP TABLE "FilteredWord";
|
|
||||||
|
|
||||||
ALTER TABLE "ef_temp_FilteredWord" RENAME TO "FilteredWord";
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
PRAGMA foreign_keys = 1;
|
|
||||||
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
CREATE UNIQUE INDEX "IX_XpSettings_GuildId" ON "XpSettings" ("GuildId");
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX "IX_FeedSub_GuildId_Url" ON "FeedSub" ("GuildId", "Url");
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX "IX_DelMsgOnCmdChannel_GuildId_ChannelId" ON "DelMsgOnCmdChannel" ("GuildId", "ChannelId");
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX "IX_AntiRaidSetting_GuildId" ON "AntiRaidSetting" ("GuildId");
|
|
||||||
|
|
||||||
CREATE INDEX "IX_FilteredWord_GuildFilterConfigId" ON "FilteredWord" ("GuildFilterConfigId");
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
|
||||||
VALUES ('20250202095042_fk-remove', '9.0.1');
|
|
||||||
|
|
|
@ -61,6 +61,9 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
b.Property<DateTime?>("DateAdded")
|
b.Property<DateTime?>("DateAdded")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<ulong>("GuildId")
|
b.Property<ulong>("GuildId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
@ -556,6 +559,9 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
b.Property<DateTime?>("DateAdded")
|
b.Property<DateTime?>("DateAdded")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<ulong>("GuildId")
|
b.Property<ulong>("GuildId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
@ -691,6 +697,9 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
b.Property<DateTime?>("DateAdded")
|
b.Property<DateTime?>("DateAdded")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<ulong>("GuildId")
|
b.Property<ulong>("GuildId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
@ -784,7 +793,6 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("Word")
|
b.Property<string>("Word")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
@ -2494,6 +2502,9 @@ namespace EllieBot.Migrations.Sqlite
|
||||||
b.Property<DateTime?>("DateAdded")
|
b.Property<DateTime?>("DateAdded")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("GuildConfigId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<ulong>("GuildId")
|
b.Property<ulong>("GuildId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ using YamlDotNet.Serialization.NamingConventions;
|
||||||
|
|
||||||
namespace EllieBot.Modules.EllieExpressions;
|
namespace EllieBot.Modules.EllieExpressions;
|
||||||
|
|
||||||
public sealed class EllieExpressionsService : IExecOnMessage, IReadyExecutor
|
public sealed class EllieExpressionsService : IExecOnMessage, IReadyExecutor, IEService
|
||||||
{
|
{
|
||||||
private const string MENTION_PH = "%bot.mention%";
|
private const string MENTION_PH = "%bot.mention%";
|
||||||
|
|
||||||
|
@ -63,18 +63,14 @@ public sealed class EllieExpressionsService : IExecOnMessage, IReadyExecutor
|
||||||
|
|
||||||
private readonly DiscordSocketClient _client;
|
private readonly DiscordSocketClient _client;
|
||||||
|
|
||||||
// private readonly PermissionService _perms;
|
|
||||||
// private readonly GlobalPermissionService _gperm;
|
|
||||||
// private readonly CmdCdService _cmdCds;
|
|
||||||
private readonly IPermissionChecker _permChecker;
|
private readonly IPermissionChecker _permChecker;
|
||||||
private readonly IBotStrings _strings;
|
private readonly IBotStrings _strings;
|
||||||
private readonly IBot _bot;
|
|
||||||
private readonly IPubSub _pubSub;
|
private readonly IPubSub _pubSub;
|
||||||
private readonly IMessageSenderService _sender;
|
private readonly IMessageSenderService _sender;
|
||||||
private readonly IReplacementService _repSvc;
|
private readonly IReplacementService _repSvc;
|
||||||
private readonly Random _rng;
|
private readonly Random _rng;
|
||||||
|
|
||||||
private bool ready;
|
private bool _isReady;
|
||||||
private ConcurrentHashSet<ulong> _disabledGlobalExpressionGuilds;
|
private ConcurrentHashSet<ulong> _disabledGlobalExpressionGuilds;
|
||||||
private readonly PermissionService _pc;
|
private readonly PermissionService _pc;
|
||||||
private readonly ShardData _shardData;
|
private readonly ShardData _shardData;
|
||||||
|
@ -94,7 +90,6 @@ public sealed class EllieExpressionsService : IExecOnMessage, IReadyExecutor
|
||||||
_db = db;
|
_db = db;
|
||||||
_client = client;
|
_client = client;
|
||||||
_strings = strings;
|
_strings = strings;
|
||||||
_bot = bot;
|
|
||||||
_pubSub = pubSub;
|
_pubSub = pubSub;
|
||||||
_sender = sender;
|
_sender = sender;
|
||||||
_repSvc = repSvc;
|
_repSvc = repSvc;
|
||||||
|
@ -155,12 +150,12 @@ public sealed class EllieExpressionsService : IExecOnMessage, IReadyExecutor
|
||||||
globalExpressions = globalItems;
|
globalExpressions = globalItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
ready = true;
|
_isReady = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private EllieExpression TryGetExpression(IUserMessage umsg)
|
private EllieExpression TryGetExpression(IUserMessage umsg)
|
||||||
{
|
{
|
||||||
if (!ready)
|
if (!_isReady)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (umsg.Channel is not SocketTextChannel channel)
|
if (umsg.Channel is not SocketTextChannel channel)
|
||||||
|
@ -178,9 +173,7 @@ public sealed class EllieExpressionsService : IExecOnMessage, IReadyExecutor
|
||||||
if (_disabledGlobalExpressionGuilds.Contains(channel.Guild.Id))
|
if (_disabledGlobalExpressionGuilds.Contains(channel.Guild.Id))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var localGrs = globalExpressions;
|
return MatchExpressions(content, globalExpressions);
|
||||||
|
|
||||||
return MatchExpressions(content, localGrs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
using LinqToDB.EntityFrameworkCore;
|
using LinqToDB.EntityFrameworkCore;
|
||||||
using EllieBot.Common.ModuleBehaviors;
|
using EllieBot.Common.ModuleBehaviors;
|
||||||
using EllieBot.Db.Models;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace EllieBot.Services;
|
namespace EllieBot.Services;
|
||||||
|
|
||||||
public class Localization : ILocalization, IReadyExecutor
|
public class Localization : ILocalization, IReadyExecutor, IEService
|
||||||
{
|
{
|
||||||
private static readonly Dictionary<string, CommandData> _commandData =
|
private static readonly Dictionary<string, CommandData> _commandData =
|
||||||
JsonConvert.DeserializeObject<Dictionary<string, CommandData>>(
|
JsonConvert.DeserializeObject<Dictionary<string, CommandData>>(
|
||||||
|
|
|
@ -7,7 +7,7 @@ using System.Collections.Frozen;
|
||||||
|
|
||||||
namespace EllieBot.Modules.Permissions.Services;
|
namespace EllieBot.Modules.Permissions.Services;
|
||||||
|
|
||||||
public sealed class BlacklistService : IExecOnMessage, IReadyExecutor
|
public sealed class BlacklistService : IExecOnMessage, IReadyExecutor, IEService
|
||||||
{
|
{
|
||||||
public int Priority
|
public int Priority
|
||||||
=> int.MaxValue;
|
=> int.MaxValue;
|
||||||
|
|
Loading…
Add table
Reference in a new issue