<commit_before>var FriendsListManager = require('./friendslistmanager.js');

/**
 * Exported function.
 * @param  {object} VaporAPI VaporAPI instance.
 */
module.exports = function(VaporAPI) {
    var manager = new FriendsListManager();

    var steamFriends = VaporAPI.getHandler('steamFriends');
    var Steam = VaporAPI.getSteam();
    var config = VaporAPI.getConfig().plugins[VaporAPI.pluginName];
    var log = VaporAPI.getLogger();
    var utils = VaporAPI.getUtils();

    var FRIENDSLIST_PATH = VaporAPI.getDataFolderPath() + '/friendslist.json';

    var limit = config.limit || 100;
    var welcomeMessage = config.welcomeMessage || undefined;
    var welcomeMessageDelay = config.welcomeMessageDelay || 3000;

    /**
     * Adds friend to friends list.
     *
     * Also removes friend if necessary.
     * @param {object} steamFriends Active SteamFriends handler.
     * @param {string} user         SteamID64.
     */
    function addFriend(steamFriends, user) {
        if(manager.count() === limit) {
            var removedUser = manager.getOldestAdded();
            steamFriends.removeFriend(removedUser);
            manager.remove(removedUser);

            log.info('My friends list was full. ' + utils.getUserDescription(removedUser) + ' has been removed.');
            VaporAPI.emitEvent('friendRemoved', removedUser);
        }

        steamFriends.addFriend(user);
        manager.add(user);

        log.info('User ' + user + ' has been added to my friends list.');
        VaporAPI.emitEvent('friendAccepted', user);

        if(welcomeMessage && typeof welcomeMessage === 'string') {
            setTimeout(function() {
                steamFriends.sendMessage(user, welcomeMessage);
            }, welcomeMessageDelay);
        }
    }


    /**
     * Main entry point
     */<commit_msg>Interpolated all logger string.<commit_after>var FriendsListManager = require('./friendslistmanager.js');

/**
 * Exported function.
 * @param  {object} VaporAPI VaporAPI instance.
 */
module.exports = function(VaporAPI) {
    var manager = new FriendsListManager();

    var steamFriends = VaporAPI.getHandler('steamFriends');
    var Steam = VaporAPI.getSteam();
    var config = VaporAPI.getConfig().plugins[VaporAPI.pluginName];
    var log = VaporAPI.getLogger();
    var utils = VaporAPI.getUtils();

    var FRIENDSLIST_PATH = VaporAPI.getDataFolderPath() + '/friendslist.json';

    var limit = config.limit || 100;
    var welcomeMessage = config.welcomeMessage || undefined;
    var welcomeMessageDelay = config.welcomeMessageDelay || 3000;

    /**
     * Adds friend to friends list.
     *
     * Also removes friend if necessary.
     * @param {object} steamFriends Active SteamFriends handler.
     * @param {string} user         SteamID64.
     */
    function addFriend(steamFriends, user) {
        if(manager.count() === limit) {
            var removedUser = manager.getOldestAdded();
            steamFriends.removeFriend(removedUser);
            manager.remove(removedUser);

            log.info('My friends list was full. %s has been removed.', utils.getUserDescription(removedUser));
            VaporAPI.emitEvent('friendRemoved', removedUser);
        }

        steamFriends.addFriend(user);
        manager.add(user);

        log.info('User %s has been added to my friends list.', user);
        VaporAPI.emitEvent('friendAccepted', user);

        if(welcomeMessage && typeof welcomeMessage === 'string') {
            setTimeout(function() {
                steamFriends.sendMessage(user, welcomeMessage);
            }, welcomeMessageDelay);
        }
    }


    /**
     * Main entry point
     */
{'fraction_non_alphanumeric': 0.11679431072210066, 'fraction_numerical': 0.004923413566739606, 'mean_word_length': 2.7430910951893552, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '386557', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1020, 'n_words': 229}