#nullable disable warnings
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Modules.Utility;
public sealed class QuoteService : IQuoteService, INService
{
private readonly DbService _db;
public QuoteService(DbService db)
{
_db = db;
}
///
/// Delete all quotes created by the author in a guild
///
/// ID of the guild
/// ID of the user
/// Number of deleted qutoes
public async Task DeleteAllAuthorQuotesAsync(ulong guildId, ulong userId)
{
await using var ctx = _db.GetDbContext();
var deleted = await ctx.GetTable()
.Where(x => x.GuildId == guildId && x.AuthorId == userId)
.DeleteAsync();
return deleted;
}
}