Exemplo n.º 1
0
        /// <summary>
        /// Adds an admin and gives them permissions.
        /// </summary>
        /// <param name="user">The user to make admin.</param>
        public void AddAdmin(User user)
        {
            var steamID = user.SteamID;

            user.IsAdmin = true;
            _admins.Add(steamID);
            SaveAdmin(steamID);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a user to the manager.
        /// </summary>
        /// <param name="steamID">The user's SteamID.</param>
        /// <param name="name">The user's name.</param>
        /// <param name="personaState">The user's persona state.</param>
        /// <returns></returns>
        public User AddUser(SteamID steamID, string name, EPersonaState personaState)
        {
            Console.WriteLine("Adding user {0}", name);
            var user = new User(_steamNerd, steamID, name, personaState);
            user.IsAdmin = IsAdmin(user);
            _users[user.SteamID] = user;

            return user;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Checks the admin list to see if this user is an admin.
 /// </summary>
 /// <returns>True if the user is an admin, false otherwise.</returns>
 private bool IsAdmin(User user)
 {
     return _admins.Contains(user.SteamID);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Adds a user to the chat user list.
 /// </summary>
 /// <param name="user">The user to add.</param>
 public void AddUser(User user)
 {
     Users.Add(user);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Removes a user from the chat.
 /// </summary>
 /// <param name="user">The user to remove.</param>
 public void RemoveUser(User user)
 {
     Users.Remove(user);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Invites a user to the chat room.
 /// </summary>
 /// <param name="invitedUser">The invited user.</param>
 public void InviteUser(User invitedUser)
 {
     _steamNerd.SteamFriends.InviteUserToChat(invitedUser.SteamID, SteamID);
 }
Exemplo n.º 7
0
 /// <summary>
 /// When someone other than the bot enters the chat, signal the 
 /// modules.
 /// </summary>
 /// <param name="chatRoom"></param>
 /// <param name="user"></param>
 /// <param name="callback"></param>
 public void EnteredChat(
     ChatRoom chatRoom, 
     User user, 
     SteamFriends.PersonaStateCallback callback
 )
 {
     foreach (var module in chatRoom.GetAllModules())
     {
         module.OnChatEnter(callback);
     }
 }