using Microsoft.EntityFrameworkCore;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Core.Services.Database.Repositories;
namespace NadekoBot.Modules.Utility.Extensions
{
public static class StreamRoleExtensions
{
///
/// Gets full stream role settings for the guild with the specified id.
///
///
/// Id of the guild to get stream role settings for.
///
public static StreamRoleSettings GetStreamRoleSettings(this IGuildConfigRepository gc, ulong guildId)
{
var conf = gc.For(guildId, x => x.Include(y => y.StreamRole)
.Include(y => y.StreamRole.Whitelist)
.Include(y => y.StreamRole.Blacklist));
if (conf.StreamRole == null)
conf.StreamRole = new StreamRoleSettings();
return conf.StreamRole;
}
}
}