src/base/Egglord.js
// Get image, from file download or avatar
Get image, from file download or avatar
Get image from file download or avatar
GetImage(message, args, Language) {
		const fileTypes = ['png', 'jpeg', 'tiff', 'jpg', 'webp'];
		const user = (message.mentions.users.first()) ? message.mentions.users.first() : message.author;
		const file = [];
		if (message.attachments.size > 0) {
			const url = message.attachments.first().url;
			for (let i = 0; i < fileTypes.length; i++) {
				if (url.indexOf(fileTypes[i]) !== -1) {
					file.push(url);
				}
			}
			if (file.length == 0) return message.error(Language, 'IMAGE/INVALID_FILE').then(m => m.delete({ timeout: 10000 }));
		} else {
			if (user != message.author) {
				file.push(user.displayAvatarURL({ format: 'png', size: 1024 }));
			}
			if (args[1] && !(args[1].startsWith('<') && args[1].endsWith('>'))) {
				file.push(args[1]);
			}
			file.push(message.author.displayAvatarURL({ format: 'png', size: 1024 }));
		}
		return file;
	}
GetImage ( message , args , Language ) { const fileTypes = [ 'png' , 'jpeg' , 'tiff' , 'jpg' , 'webp' ] ; const user = ( message . mentions . users . first ( ) ) ? message . mentions . users . first ( ) : message . author ; const file = [ ] ; if ( message . attachments . size > 0 ) { const url = message . attachments . first ( ) . url ; for ( let i = 0 ; i < fileTypes . length ; i ++ ) { if ( url . indexOf ( fileTypes [ i ] ) !== - 1 ) { file . push ( url ) ; } } if ( file . length == 0 ) return message . error ( Language , 'IMAGE/INVALID_FILE' ) . then ( m => m . delete ( { timeout : 10000 } ) ) ; } else { if ( user != message . author ) { file . push ( user . displayAvatarURL ( { format : 'png' , size : 1024 } ) ) ; } if ( args [ 1 ] && ! ( args [ 1 ] . startsWith ( '<' ) && args [ 1 ] . endsWith ( '>' ) ) ) { file . push ( args [ 1 ] ) ; } file . push ( message . author . displayAvatarURL ( { format : 'png' , size : 1024 } ) ) ; } return file ; }
Get image, from file download or avatar
Get image from file download or avatar
// Get user // get image if there is one // Check attachments // no file with the correct format was found // check user // Checks if a link to image was entered // add user // send file;