- Renamed CustomReaction model to NadekoExpression

- Used structured logging everywhere
This commit is contained in:
Kwoth
2022-01-04 07:35:55 +01:00
parent ef49030841
commit 3aa6a54b6e
30 changed files with 330 additions and 300 deletions

View File

@@ -7,12 +7,12 @@ namespace NadekoBot.Db;
public static class NadekoExpressionExtensions
{
public static int ClearFromGuild(this DbSet<CustomReaction> exprs, ulong guildId)
public static int ClearFromGuild(this DbSet<NadekoExpression> exprs, ulong guildId)
=> exprs.Delete(x => x.GuildId == guildId);
public static IEnumerable<CustomReaction> ForId(this DbSet<CustomReaction> exprs, ulong id)
public static IEnumerable<NadekoExpression> ForId(this DbSet<NadekoExpression> exprs, ulong id)
=> exprs.AsNoTracking().AsQueryable().Where(x => x.GuildId == id).ToList();
public static CustomReaction GetByGuildIdAndInput(this DbSet<CustomReaction> exprs, ulong? guildId, string input)
public static NadekoExpression GetByGuildIdAndInput(this DbSet<NadekoExpression> exprs, ulong? guildId, string input)
=> exprs.FirstOrDefault(x => x.GuildId == guildId && x.Trigger.ToUpper() == input);
}

View File

@@ -1,7 +1,7 @@
#nullable disable
namespace NadekoBot.Services.Database.Models;
public class CustomReaction : DbEntity
public class NadekoExpression : DbEntity
{
public ulong? GuildId { get; set; }
public string Response { get; set; }

View File

@@ -34,7 +34,7 @@ public class NadekoContext : DbContext
public DbSet<Reminder> Reminders { get; set; }
public DbSet<SelfAssignedRole> SelfAssignableRoles { get; set; }
public DbSet<MusicPlaylist> MusicPlaylists { get; set; }
public DbSet<CustomReaction> Expressions { get; set; }
public DbSet<NadekoExpression> Expressions { get; set; }
public DbSet<CurrencyTransaction> CurrencyTransactions { get; set; }
public DbSet<WaifuUpdate> WaifuUpdates { get; set; }
public DbSet<Warning> Warnings { get; set; }