2020-08-28 02:34:12 +00:00
const magick = require ( "../utils/image.js" ) ;
2020-03-31 14:25:45 +00:00
const words = [ "me irl" , "dank" , "follow my second account @esmBot_" , "2016" , "meme" , "wholesome" , "reddit" , "instagram" , "twitter" , "facebook" , "fortnite" , "minecraft" , "relatable" , "gold" , "funny" , "template" , "hilarious" , "memes" , "deep fried" , "2020" , "leafy" , "pewdiepie" ] ;
exports . run = async ( message , args ) => {
const image = await require ( "../utils/imagedetect.js" ) ( message ) ;
if ( image === undefined ) return ` ${ message . author . mention } , you need to provide an image/GIF to add a caption! ` ;
2020-04-23 22:38:01 +00:00
const newArgs = args . filter ( item => ! item . includes ( image . url ) ) ;
2020-03-31 14:25:45 +00:00
const processMessage = await message . channel . createMessage ( "<a:processing:479351417102925854> Processing... This might take a while" ) ;
2020-10-18 21:53:35 +00:00
const { buffer , type } = await magick . run ( {
2020-08-28 02:34:12 +00:00
cmd : "captionTwo" ,
path : image . path ,
2021-01-18 20:11:28 +00:00
caption : newArgs . length !== 0 ? newArgs . join ( " " ) . replaceAll ( "&" , "\\&" ) . replaceAll ( ">" , "\\>" ) . replaceAll ( "<" , "\\<" ) . replaceAll ( "\"" , "\\"" ) . replaceAll ( "'" , "\\'" ) . replaceAll ( "%" , "\\%" ) : words . sort ( ( ) => 0.5 - Math . random ( ) ) . slice ( 0 , Math . floor ( Math . random ( ) * words . length + 1 ) ) . join ( " " ) ,
2021-01-05 02:53:34 +00:00
type : image . type
2020-08-28 02:34:12 +00:00
} ) ;
2020-09-23 19:12:39 +00:00
if ( processMessage . channel . messages . get ( processMessage . id ) ) await processMessage . delete ( ) ;
2020-04-12 19:51:48 +00:00
return {
2020-10-18 21:53:35 +00:00
file : buffer ,
name : ` caption2. ${ type } `
2020-04-12 19:51:48 +00:00
} ;
2020-03-31 14:25:45 +00:00
} ;
exports . aliases = [ "tags2" , "meirl" , "memecaption" , "medotmecaption" ] ;
exports . category = 5 ;
2020-05-23 13:55:18 +00:00
exports . help = "Adds a me.me caption/tag list to an image/GIF" ;