mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 16:24:27 -05:00 
			
		
		
		
	Added bot_perm support to medusa system
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/Nadeko.Medusa/Attributes/MedusaPermAttribute.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/Nadeko.Medusa/Attributes/MedusaPermAttribute.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
namespace Nadeko.Snake;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// Used as a marker class for bot_perm and user_perm Attributes
 | 
			
		||||
/// Has no functionality.
 | 
			
		||||
/// </summary>
 | 
			
		||||
public abstract class MedusaPermAttribute : Attribute
 | 
			
		||||
{
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										23
									
								
								src/Nadeko.Medusa/Attributes/bot_permAttribute.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/Nadeko.Medusa/Attributes/bot_permAttribute.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
using Discord;
 | 
			
		||||
 | 
			
		||||
namespace Nadeko.Snake;
 | 
			
		||||
 | 
			
		||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
 | 
			
		||||
public sealed class bot_permAttribute : MedusaPermAttribute
 | 
			
		||||
{
 | 
			
		||||
    public GuildPermission? GuildPerm { get; }
 | 
			
		||||
    public ChannelPermission? ChannelPerm { get; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public bot_permAttribute(GuildPermission perm)
 | 
			
		||||
    {
 | 
			
		||||
        GuildPerm = perm;
 | 
			
		||||
        ChannelPerm = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public bot_permAttribute(ChannelPermission perm)
 | 
			
		||||
    {
 | 
			
		||||
        ChannelPerm = perm;
 | 
			
		||||
        GuildPerm = null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -3,12 +3,11 @@
 | 
			
		||||
namespace Nadeko.Snake;
 | 
			
		||||
 | 
			
		||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
 | 
			
		||||
public sealed class user_permAttribute : Attribute
 | 
			
		||||
public sealed class user_permAttribute : MedusaPermAttribute
 | 
			
		||||
{
 | 
			
		||||
    public GuildPermission? GuildPerm { get; }
 | 
			
		||||
    public ChannelPermission? ChannelPerm { get; }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public user_permAttribute(GuildPermission perm)
 | 
			
		||||
    {
 | 
			
		||||
        GuildPerm = perm;
 | 
			
		||||
@@ -21,4 +20,3 @@ public sealed class user_permAttribute : Attribute
 | 
			
		||||
        GuildPerm = null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user