using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using ChaosBot.Database.Entity;
using Microsoft.Data.Sqlite;
namespace ChaosBot.Database.Repository
{
public static class CommandPermissionRepository
{
private static readonly string Table = "CommandPermissions";
///
/// Fetch all CommandPermissions filtered by guildId
///
///
/// List of Commands and Permissions
public static CommandPermission[] All(long guildId)
{
var cmds = CommandPermission.Query().Where("guildId", guildId).All();
return cmds.ToArray();
}
///
/// Get all CommandPermissions for a command filtered by guild
///
///
///
/// List of raffles
public static CommandPermission[] getPerm(string cmd, long guildId)
{
List cmds = CommandPermission.Query().Where("cmd", cmd).Where("guildId", guildId).Get();
if(cmds.Count != 0) return cmds.ToArray();
return null;
}
}
}