Example #1
0
        public MessageLog(BaseUser user, BaseServer server, BaseChannel channel, BaseMessage message)
        {
            var logChannel = server.FindChannelByName("theguin-chat-log");

            if (logChannel == null)
            {
                return;
            }

            logChannel.SendMessage(user.GetDataString() + " said: ``" + message.GetText() + "``");
        }
Example #2
0
        public LeaveLog(BaseUser user, BaseServer server)
        {
            var logChannel = server.FindChannelByName("theguin-log");

            if (logChannel == null)
            {
                return;
            }

            logChannel.SendMessage(user.GetDataString() + " has left.");
        }
Example #3
0
        public ChangeLog(BaseUser oldUser, BaseUser newUser, BaseServer server)
        {
            var logChannel = server.FindChannelByName("theguin-log");

            if (logChannel == null)
            {
                return;
            }

            if (oldUser.GetNickname() != newUser.GetNickname() || oldUser.GetUsername() != newUser.GetUsername())
            {
                logChannel.SendMessage(oldUser.GetDataString() + " became: ``" + newUser.GetDataString());
            }

            var oldRoles = oldUser.GetRoles();
            var newRoles = newUser.GetRoles();

            var oldRoleNames = new List <string>();
            var newRoleNames = new List <string>();

            foreach (var role in oldRoles)
            {
                oldRoleNames.Add(role.GetName());
            }

            foreach (var role in newRoles)
            {
                newRoleNames.Add(role.GetName());
            }

            var differenceOldNew = oldRoleNames.Except(newRoleNames).ToList();
            var differenceNewOld = newRoleNames.Except(oldRoleNames).ToList();

            foreach (var role in differenceNewOld)
            {
                logChannel.SendMessage(newUser.GetDataString() + " gained the role: ``" + role + "``");
            }

            foreach (var role in differenceOldNew)
            {
                logChannel.SendMessage(newUser.GetDataString() + " lost the role: ``" + role + "``");
            }
        }