elliebot/src/EllieBot/_common/Attributes/NoPublicBotAttribute.cs
Toastie 547aa8b34d
Added common files
This took way too long
2024-06-18 23:44:07 +12:00

20 lines
No EOL
683 B
C#

#nullable disable
using System.Diagnostics.CodeAnalysis;
namespace EllieBot.Common;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public sealed class NoPublicBotAttribute : PreconditionAttribute
{
public override Task<PreconditionResult> CheckPermissionsAsync(
ICommandContext context,
CommandInfo command,
IServiceProvider services)
{
#if GLOBAL_ELLIE
return Task.FromResult(PreconditionResult.FromError("Not available on the public bot. To learn how to selfhost a private bot, click [here](https://docs.elliebot.net/ellie/)."));
#else
return Task.FromResult(PreconditionResult.FromSuccess());
#endif
}
}