mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
Read about the medusa system [here](https://nadekobot.readthedocs.io/en/latest/medusa/creating-a-medusa/)
30 lines
984 B
C#
30 lines
984 B
C#
#nullable disable
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
namespace NadekoBot.Common;
|
|
|
|
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
|
|
[SuppressMessage("Style", "IDE0022:Use expression body for methods")]
|
|
public sealed class NoPublicBotAttribute : PreconditionAttribute
|
|
{
|
|
public override Task<PreconditionResult> CheckPermissionsAsync(
|
|
ICommandContext context,
|
|
CommandInfo command,
|
|
IServiceProvider services)
|
|
{
|
|
#if GLOBAL_NADEKO
|
|
return Task.FromResult(PreconditionResult.FromError("Not available on the public bot. To learn how to selfhost a private bot, click [here](https://nadekobot.readthedocs.io/en/latest/)."));
|
|
#else
|
|
return Task.FromResult(PreconditionResult.FromSuccess());
|
|
#endif
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Classed marked with this attribute will not be added to the service provider
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.Class)]
|
|
public class DontAddToIocContainerAttribute : Attribute
|
|
{
|
|
|
|
} |