sharp-chat/SharpChat.Common/Users/IUserExtensions.cs

10 lines
322 B
C#
Raw Normal View History

2022-08-30 15:05:29 +00:00
namespace SharpChat.Users {
public static class IUserExtensions {
public static bool IsBot(this IUser user)
=> user is ChatBot || user?.UserId == -1;
public static bool Can(this IUser user, UserPermissions perm)
=> user.IsBot() || (user.Permissions & perm) == perm;
}
}