Added .imageonlychannel / .imageonly to prevent users from posting anything but images in the channel

This commit is contained in:
Kwoth
2021-09-15 01:08:39 +02:00
parent 35d549f4e6
commit cccb37854c
14 changed files with 2951 additions and 15 deletions

View File

@@ -0,0 +1,8 @@
namespace NadekoBot.Services.Database.Models
{
public class ImageOnlyChannel : DbEntity
{
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
}
}

View File

@@ -2,7 +2,6 @@
namespace NadekoBot.Services.Database.Models
{
public class LogSetting : DbEntity
{
public HashSet<IgnoredLogChannel> IgnoredChannels { get; set; } = new HashSet<IgnoredLogChannel>();

View File

@@ -2,11 +2,9 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using NadekoBot.Services.Database.Models;
using NadekoBot.Services;
using System;
using System.IO;
using Microsoft.Extensions.Logging;
using NadekoBot.Common;
using NadekoBot.Db.Models;
namespace NadekoBot.Services.Database
@@ -60,6 +58,7 @@ namespace NadekoBot.Services.Database
public DbSet<Repeater> Repeaters { get; set; }
public DbSet<Poll> Poll { get; set; }
public DbSet<WaifuInfo> WaifuInfo { get; set; }
public DbSet<ImageOnlyChannel> ImageOnlyChannels { get; set; }
public NadekoContext(DbContextOptions<NadekoContext> options) : base(options)
{
@@ -345,6 +344,10 @@ namespace NadekoBot.Services.Database
.IsUnique());
#endregion
modelBuilder.Entity<ImageOnlyChannel>(ioc => ioc
.HasIndex(x => x.ChannelId)
.IsUnique());
}
}
}