mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
- Some renamings and code cleanups - Chained method calls, binary expressions and binary patterns will now break into newlines - Type param constraints and base constructor calls will be on the new line
17 lines
691 B
C#
17 lines
691 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using LinqToDB;
|
|
using NadekoBot.Services.Database.Models;
|
|
|
|
namespace NadekoBot.Db;
|
|
|
|
public static class CustomReactionsExtensions
|
|
{
|
|
public static int ClearFromGuild(this DbSet<CustomReaction> crs, ulong guildId)
|
|
=> crs.Delete(x => x.GuildId == guildId);
|
|
|
|
public static IEnumerable<CustomReaction> ForId(this DbSet<CustomReaction> crs, ulong id)
|
|
=> crs.AsNoTracking().AsQueryable().Where(x => x.GuildId == id).ToList();
|
|
|
|
public static CustomReaction GetByGuildIdAndInput(this DbSet<CustomReaction> crs, ulong? guildId, string input)
|
|
=> crs.FirstOrDefault(x => x.GuildId == guildId && x.Trigger.ToUpper() == input);
|
|
} |