Add project files.
This commit is contained in:
20
PluginManager/Others/Permissions.cs
Normal file
20
PluginManager/Others/Permissions.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Discord;
|
||||
using Discord.WebSocket;
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace PluginManager.Others
|
||||
{
|
||||
public static class Permissions
|
||||
{
|
||||
public static bool hasPermission(this IRole role, GuildPermission permission) => role.Permissions.Has(permission);
|
||||
|
||||
public static bool hasRole(this SocketGuildUser user, IRole role) => user.Roles.Contains(role);
|
||||
|
||||
public static bool hasPermission(this SocketGuildUser user, GuildPermission permission)
|
||||
=> user.Roles.Where(role => role.hasPermission(permission)).Any();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user