<commit_before>'use strict';
var PushBullet = require( 'pushbullet' ),
    pusher = new PushBullet( 'v19INs18gL8IWynPqNbmWXns9TErz4k1aBujz7gGxaa4a' ),
    handlePushbulletRespone = function( error, response ){
        if( error ){
            console.log( 'Error!' );
            console.log( error );
        } else {
            console.log( response );
        }
    },
    localPushbullet = {
        bot : false,
        nameList : {
            kokarn : 'ujz7gGxaa4adjzWIEVDzOK',
            gyran : '<EMAIL>',
            theseal : '<EMAIL>',
            mcgurk : '<EMAIL>',
            gust1n : '<EMAIL>'
        },
        aliasList : {
            gustin : 'gust1n',
            sälen : 'theseal'
        },
        setup : function( bot ){
            var _this = this;

            _this.bot = bot;
            for( var channel in _this.bot.opt.channels ){
                if( _this.bot.opt.channels.hasOwnProperty( channel ) ){
                    bot.addListener( 'message' + this.bot.opt.channels[ channel ], _this.handleMessage );
                }
            }

        },
        handleMessage : function( from, text, message ){
            var name,
                _this = localPushbullet,
                namesInMessage = [],
                i,
                formattedText = text.toLowerCase();

            for( name in _this.nameList ){
                if( _this.nameList.hasOwnProperty( name ) ){
                    if( formattedText.indexOf( name ) !== -1 ){
                        if( namesInMessage.indexOf( name ) === -1 ){
                            namesInMessage.push( name );
                        }
                    }
                }
            }

            for( name in _this.aliasList ){
                if( _this.aliasList.hasOwnProperty( name ) ){
                    if( formattedText.indexOf( name ) !== -1 ){
                        if( namesInMessage.indexOf( name ) === -1 ){
                            namesInMessage.push( _this.aliasList[ name ] );
                        }
                    }
                }
            }

            for( i = 0; i < namesInMessage.length; i = i + 1 ){
                console.log( 'Trying to push to ' + _this.nameList[ namesInMessage[ i ] ] );
                _this.sendMessage( _this.nameList[ namesInMessage[ i ] ], from, text );
            }
        },
        sendMessage : function( to, from, message ){
            var messageParts,
                sendMessage;

            if( message.indexOf( 'http://' ) !== -1 || message.indexOf( 'https://' ) !== -1 ){
                messageParts = message.match( /(http.+)/ );

                if( typeof messageParts[ 0 ] !== 'undefined' && messageParts[ 0 ].length > 7 ){
                    sendMessage = messageParts[ 0 ];<commit_msg>Make the bot don't push messages to people who wrote them in the first place<commit_after>'use strict';
var PushBullet = require( 'pushbullet' ),
    pusher = new PushBullet( 'v19INs18gL8IWynPqNbmWXns9TErz4k1aBujz7gGxaa4a' ),
    handlePushbulletRespone = function( error, response ){
        if( error ){
            console.log( 'Error!' );
            console.log( error );
        } else {
            console.log( response );
        }
    },
    localPushbullet = {
        bot : false,
        nameList : {
            kokarn : 'ujz7gGxaa4adjzWIEVDzOK',
            gyran : '<EMAIL>',
            theseal : '<EMAIL>',
            mcgurk : '<EMAIL>',
            gust1n : '<EMAIL>'
        },
        aliasList : {
            gustin : 'gust1n',
            sälen : 'theseal'
        },
        setup : function( bot ){
            var _this = this;

            _this.bot = bot;
            for( var channel in _this.bot.opt.channels ){
                if( _this.bot.opt.channels.hasOwnProperty( channel ) ){
                    bot.addListener( 'message' + this.bot.opt.channels[ channel ], _this.handleMessage );
                }
            }

        },
        handleMessage : function( from, text, message ){
            var name,
                _this = localPushbullet,
                namesInMessage = [],
                i,
                formattedText = text.toLowerCase();

            for( name in _this.nameList ){
                if( _this.nameList.hasOwnProperty( name ) ){
                    if( formattedText.indexOf( name ) !== -1 ){
                        if( namesInMessage.indexOf( name ) === -1 ){
                            namesInMessage.push( name );
                        }
                    }
                }
            }

            for( name in _this.aliasList ){
                if( _this.aliasList.hasOwnProperty( name ) ){
                    if( formattedText.indexOf( name ) !== -1 ){
                        if( namesInMessage.indexOf( name ) === -1 ){
                            namesInMessage.push( _this.aliasList[ name ] );
                        }
                    }
                }
            }

            for( i = 0; i < namesInMessage.length; i = i + 1 ){
                if( _this.nameList[ namesInMessage[ i ] ] === from.toLowerCase() ){
                    console.log( 'Found a message from ' + from + ' with ' + from + ' in it, skipping push to that recipient.' );
                } else {
                    console.log( 'Trying to push to ' + _this.nameList[ namesInMessage[ i ] ] );
                    _this.sendMessage( _this.nameList[ namesInMessage[ i ] ], from, text );
                }
            }
        },
        sendMessage : function( to, from, message ){
            var messageParts,
                sendMessage;

            if( message.indexOf( 'http://' ) !== -1 || message.indexOf( 'https://' ) !== -1 ){
                messageParts = message.match( /(http.+)/ );

                if( typeof messageParts[ 0 ] !== 'undefined' && messageParts[ 0 ].length > 7 ){
                    sendMessage = messageParts[ 0 ];
{'fraction_non_alphanumeric': 0.12017603249830738, 'fraction_numerical': 0.008801624915368992, 'mean_word_length': 1.263984674329502, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '879861', 'n_tokens_mistral': 1671, 'n_tokens_neox': 1588, 'n_words': 361}