Пример #1
0
        private bool CanUseCommand(string name, ChatUserType allow, ChatMessage chatMessage)
        {
            if (allow.HasFlag(ChatUserType.Pleb))
            {
                return(true);
            }

            if (chatMessage.IsSubscriber && allow.HasFlag(ChatUserType.Subscriber))
            {
                return(true);
            }

            if (chatMessage.IsVip && allow.HasFlag(ChatUserType.Vip))
            {
                return(true);
            }

            if (chatMessage.IsModerator && allow.HasFlag(ChatUserType.Moderator))
            {
                return(true);
            }

            if (chatMessage.IsBroadcaster && allow.HasFlag(ChatUserType.Broadcaster))
            {
                return(true);
            }

            return(CheckCustomPermits(name, chatMessage));
        }
Пример #2
0
 public CommandAttribute(string alias, ChatUserType allow, string name = null, string description = null)
 {
     Alias       = alias;
     Allow       = allow;
     Name        = name;
     Description = description;
 }
Пример #3
0
 public Command(string alias, string name, string description, ChatUserType allow, MethodInfo methodInfo, object instance)
 {
     Alias       = alias;
     Name        = name;
     Description = description;
     Allow       = allow;
     MethodInfo  = methodInfo;
     Instance    = instance;
 }
Пример #4
0
 /// <summary>
 /// 添加聊天室成员
 /// </summary>
 /// <param name="roomId"></param>
 /// <param name="chatUserId"></param>
 /// <param name="chatUserType"></param>
 public static void AddRoomMember(string roomId, string chatUserId, ChatUserType chatUserType)
 {
     var room = chatRoomStore.Get<ChatRoom>(roomId, roomRegion);
     if (room.RoomMembers == null) room.RoomMembers = new List<RoomMember>();
     room.RoomMembers.Add(new RoomMember()
     {
         ChatUserId = chatUserId,
         ChatUserType = chatUserType
     });
     chatRoomStore.Put(roomId, room, roomRegion);
 }