<commit_before>var addToCollection = {
 author: 'uman',
 name: 'addToCollection',
 description: '- Add the song currently playing to the broadcaster\'s collection.',
 config: {
    permission: ['isWhiteListed']
 },
 onCall: function(request) {
    var song = request.getCurrentSongPlaying();
    request.moreCmd({
        method:'getQueueSongListFromSongIDs',
        parameters: {
            songIDs: [song.id]
        }
    }, function(songData) {
        if (songData instanceof Array && songData.length)
        {
            var newSong = {
                albumID: songData[0].AlbumID,
                albumName: songData[0].AlbumName,
                artFilename: (songData[0].CoverArtFilename ? songData[0].CoverArtFilename : ''),
                artistID: songData[0].ArtistID,
                artistName: songData[0].ArtistName,
                isVerified: songData[0].IsVerified,
                songID: songData[0].SongID,
                songName: songData[0].Name,
                track: parseInt(songData[0].TrackNum)
            };
            request.moreCmd({
                method:'userAddSongsToLibrary',
                parameters: {
                    songs: [ newSong ]
                }
            }, function(cb) {
                if (cb && cb.Timestamps.affectedRows == 1)
                    request.sendChat(song.sN + ' was added to the broadcaster\'s collection!');
            });
        }
    });
 }
};

module.exports = {mod: addToCollection};<commit_msg>Added message if the song is already in the collection<commit_after>var addToCollection = {
 author: 'uman',
 name: 'addToCollection',
 description: '- Add the song currently playing to the broadcaster\'s collection.',
 config: {
    permission: ['isWhiteListed']
 },
 onCall: function(request) {
    var song = request.getCurrentSongPlaying();
    request.moreCmd({
        method:'getQueueSongListFromSongIDs',
        parameters: {
            songIDs: [song.id]
        }
    }, function(songData) {
        if (songData instanceof Array && songData.length)
        {
            var newSong = {
                albumID: songData[0].AlbumID,
                albumName: songData[0].AlbumName,
                artFilename: (songData[0].CoverArtFilename ? songData[0].CoverArtFilename : ''),
                artistID: songData[0].ArtistID,
                artistName: songData[0].ArtistName,
                isVerified: songData[0].IsVerified,
                songID: songData[0].SongID,
                songName: songData[0].Name,
                track: parseInt(songData[0].TrackNum)
            };
            request.moreCmd({
                method:'userAddSongsToLibrary',
                parameters: {
                    songs: [ newSong ]
                }
            }, function(cb) {
                if (cb && cb.Timestamps.affectedRows == 1)
                    request.sendChat(song.sN + ' was added to the broadcaster\'s collection!');
                else if (cb)
                    request.sendChat(song.sN + ' already is in the broadcaster\'s collection!');
            });
        }
    });
 }
};

module.exports = {mod: addToCollection};
{'fraction_non_alphanumeric': 0.11583624246271025, 'fraction_numerical': 0.006981910504601714, 'mean_word_length': 1.8117752007136485, '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': '2957546', 'n_tokens_mistral': 913, 'n_tokens_neox': 842, 'n_words': 170}