mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04:00
* Merged v4
* Completed some todos * Fixed PermChecker * Updated packages * Upped version to alpha2 * Cleanup
This commit is contained in:
@@ -1,13 +1,39 @@
|
||||
using OneOf;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using OneOf;
|
||||
using OneOf.Types;
|
||||
|
||||
namespace Nadeko.Bot.Common;
|
||||
|
||||
public interface IPermissionChecker
|
||||
{
|
||||
Task<OneOf<Success, Error<LocStr>>> CheckAsync(IGuild guild,
|
||||
Task<PermCheckResult> CheckPermsAsync(IGuild guild,
|
||||
IMessageChannel channel,
|
||||
IUser author,
|
||||
string module,
|
||||
string? cmd);
|
||||
}
|
||||
}
|
||||
|
||||
[GenerateOneOf]
|
||||
public partial class PermCheckResult
|
||||
: OneOfBase<PermAllowed, PermCooldown, PermGlobalBlock, PermDisallowed>
|
||||
{
|
||||
public bool IsAllowed
|
||||
=> IsT0;
|
||||
|
||||
public bool IsCooldown
|
||||
=> IsT1;
|
||||
|
||||
public bool IsGlobalBlock
|
||||
=> IsT2;
|
||||
|
||||
public bool IsDisallowed
|
||||
=> IsT3;
|
||||
}
|
||||
|
||||
public readonly record struct PermAllowed;
|
||||
|
||||
public readonly record struct PermCooldown;
|
||||
|
||||
public readonly record struct PermGlobalBlock;
|
||||
|
||||
public readonly record struct PermDisallowed(int PermIndex, string PermText, bool IsVerbose);
|
Reference in New Issue
Block a user