app/controllers/filler/twitter.js
/*
			check if tweet object has pokemon term
		*/
check if tweet object has pokemon term
check if tweet object has pokemon term
function checkIfTweetHasPokemonName(tweetObj) {
			let tweetText = tweetObj.text.toLowerCase();
			if (tweetText.indexOf('caught') != -1 || 
				tweetText.indexOf('saw') != -1 || 
				tweetText.indexOf('attacked') != -1 ||
				tweetText.indexOf('found') != -1  ||
				tweetText.indexOf('got you') != -1  ||
				tweetText.indexOf('gotcha') != -1  ||
				tweetText.indexOf('gotcha') != -1  ||
				tweetText.indexOf('gotcha') != -1  ||
				tweetText.indexOf('appeared') != -1 ) {
				let pokemonNameListLength = pokemonNameList.length;
				for(var i = 0; i < pokemonNameListLength; i++) {
					let pokemonNameRegEx = new RegExp('\\s' + pokemonNameList[i] + '\\s','g');
					if (tweetText.match(pokemonNameRegEx)){ 
						logger.info(tweetObj.text.toLowerCase());
						logger.info(pokemonNameList[i] + ' was found');
						addPokemonAppearanceToDB(tweetObj, pokemonNameList[i]);
					}
				}
			}
		}
function checkIfTweetHasPokemonName ( tweetObj ) { let tweetText = tweetObj . text . toLowerCase ( ) ; if ( tweetText . indexOf ( 'caught' ) != - 1 || tweetText . indexOf ( 'saw' ) != - 1 || tweetText . indexOf ( 'attacked' ) != - 1 || tweetText . indexOf ( 'found' ) != - 1 || tweetText . indexOf ( 'got you' ) != - 1 || tweetText . indexOf ( 'gotcha' ) != - 1 || tweetText . indexOf ( 'gotcha' ) != - 1 || tweetText . indexOf ( 'gotcha' ) != - 1 || tweetText . indexOf ( 'appeared' ) != - 1 ) { let pokemonNameListLength = pokemonNameList . length ; for ( var i = 0 ; i < pokemonNameListLength ; i ++ ) { let pokemonNameRegEx = new RegExp ( '\\s' + pokemonNameList [ i ] + '\\s' , 'g' ) ; if ( tweetText . match ( pokemonNameRegEx ) ) { logger . info ( tweetObj . text . toLowerCase ( ) ) ; logger . info ( pokemonNameList [ i ] + ' was found' ) ; addPokemonAppearanceToDB ( tweetObj , pokemonNameList [ i ] ) ; } } } }
check if tweet object has pokemon term
check if tweet object has pokemon term
// check if the tweet text contains the important keywords // for each pokemon name check if it is inside the tweet text // regular expression to check name of pokemon with one space in the front and end // to not count pokemon twice if name is substring of another pokemon name e.g. mew and mewtwo //get pokemon names array