mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-09 22:55:42 +00:00
feat(commands): add RequireBotOwnerAttribute
This commit is contained in:
parent
9171872ec4
commit
4a3e790767
@ -0,0 +1,14 @@
|
||||
namespace VpSharp.Commands.Attributes.ExecutionChecks;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies that this command can only be run by the user under whom this bot is authenticated.
|
||||
/// </summary>
|
||||
public sealed class RequireBotOwnerAttribute : PreExecutionCheckAttribute
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected internal override Task<bool> PerformAsync(CommandContext context)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(context);
|
||||
return Task.FromResult(context.Avatar.User.Id == context.Client.CurrentUser?.Id);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user