Skip to content

Commit

Permalink
Code Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SomnathDas committed Aug 2, 2020
2 parents 3774aa7 + 36756bc commit 2ba64bf
Showing 1 changed file with 160 additions and 0 deletions.
160 changes: 160 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<<<<<<< HEAD
//Engine

const { create, decryptMedia } = require('@open-wa/wa-automate');
const fs = require('fs-extra');
const moment = require('moment');
=======
const { create, decryptMedia } = require('@open-wa/wa-automate')
const fs = require('fs-extra')
const moment = require('moment')
const fbvid = require('fbvideos');
>>>>>>> 36756bc43404532ca0d09db1309a2eab324be72e

const serverOption = {
headless: true,
Expand Down Expand Up @@ -45,7 +52,11 @@ create('Imperial', serverOption)
});
}

<<<<<<< HEAD
// Message Handler || Recieving and Replying
=======
freedomurl = "https://i.ibb.co/6J9ST0d/IMG-20200731-WA0791.jpg"
>>>>>>> 36756bc43404532ca0d09db1309a2eab324be72e

async function msgHandler (client, message) {
try {
Expand All @@ -54,7 +65,11 @@ async function msgHandler (client, message) {
const { id, pushname } = sender
const { name } = chat
const time = moment(t * 1000).format('DD/MM HH:mm:ss')
<<<<<<< HEAD
const commands = ['#sticker', '#stiker', 'Make me a coffee' , '#hello','#info','#commands','#God','#Thank you','#I love you','#Seasonal anime','#fuck','#Fuck','#sex','#Sex','#nudes']
=======
const commands = ['#sticker', '#stiker', '#hello','#info','#commands','#God','#Thank you','#I love you','#Seasonal anime','fuck','Fuck','sex','Sex','nudes','Link','Zelda','#Best girl','#S-1','#Do you love me','tsundere','Tsundere','Ora ora ora ora','ora ora ora ora','Ora Ora Ora Ora','Muda Muda Muda Muda','muda muda muda muda','Muda muda muda muda','yo','freedom','Freedom','#Zelda Timeline','#Botw','I love Rem','i love rem','I Love Rem','i love Rem','El Psy Congroo','Tuturu','Indeed','Can you beat Goku though','Se no','Mou','Kokoro','#neko','#wallpaper','#source','#sauce','#fb','Heave ho','Heave ho!','Make me a coffee','#Mystery Video','Never gonna','never gonna','never gonna run around','#Pokemon','#waifu','#waifu']
>>>>>>> 36756bc43404532ca0d09db1309a2eab324be72e
const cmds = commands.map(x => x + '\\b').join('|')
const cmd = type === 'chat' ? body.match(new RegExp(cmds, 'gi')) : type === 'image' && caption ? caption.match(new RegExp(cmds, 'gi')) : ''

Expand Down Expand Up @@ -89,13 +104,22 @@ async function msgHandler (client, message) {
case '#hello':
await client.simulateTyping(from, true)
client.sendText(from, 'Hello there, How can I help?')
<<<<<<< HEAD
await client.simulateTyping(from, false)
break
case '#I love you':
=======
break
case 'Make me a coffee':
client.sendText(from, 'Make it yourslef, lazy baka *hmph*')
break
case '#I love you':
>>>>>>> 36756bc43404532ca0d09db1309a2eab324be72e
client.sendText(from, 'T-Thanks I-I mean *looks away blushing*')
break
case '#God':
client.sendText(from, '@Hooman|Neko is God')
<<<<<<< HEAD
case '#Do you love me?':
client.sendText(from, 'U-Uh... n-no! *blushes* O-Of course not, bakka!')
break
Expand All @@ -113,13 +137,146 @@ async function msgHandler (client, message) {
client.sendText(from, 'Hi there, These are the usable commands \n #sticker - turns images into stickers \n #Sesonal anime - Displays the anime titles currently airing')
break
case '#Seasonal anime':
=======
break
case 'Se no':
client.sendText(from, 'Demo sonnan ja dame')
break
case 'Mou':
client.sendText(from, 'sonnan ja hora')
break
case 'Kokoro':
client.sendText(from, 'wa shinka suru yo Motto motto')
break
case '#Best girl':
client.sendText(from, '*Blushes*')
break
case 'Zelda' :
client.sendText(from, 'Link')
break
case 'Indeed' :
client.sendText(from, 'Pathetic')
break
case 'Link' :
client.sendText(from, 'Zelda')
break
case 'Can you beat Goku though' :
client.sendText(from, '*I can and I will*')
break
case 'freedom' :
client.sendFileFromUrl(from, 'https://i.ibb.co/6J9ST0d/IMG-20200731-WA0791.jpg','freedom.jpg','...')
break
case '#Botw' :
client.sendFileFromUrl(from, 'https://mocah.org/uploads/posts/197514-princess-zelda-2350x1175.png','BOTW.jpg','...')
break
case '#Zelda Timeline' :
client.sendFileFromUrl(from, 'https://gamepedia.cursecdn.com/zelda_gamepedia_en/b/b8/E_Timeline.png','Zelda Timeline.png','...')
break
case '#S-1':
client.sendText(from, 'Connection Status = Active')
break
case 'El Psy Congroo':
client.sendFileFromUrl(from, 'https://i.ibb.co/s9Rw8hN/index.jpg','Steins;Gate.jpg','El Psy Congroo')
break
case '#Do you love me':
client.sendText(from, 'U-Uh... n-no! *blushes* O-Of course not, idiot!')
break
case 'I love Rem' :
case 'i love rem' :
case 'I love rem' :
case 'I Love Rem' :
client.sendText(from, 'Who is Rem?')
break
case 'yo':
client.sendText(from, 'Hiya *High-fives*')
break
case 'Never gonna':
client.sendText(from, 'give you up')
break
case 'never gonna':
client.sendText(from, 'Let you down')
break
case 'Never gonna run around':
client.sendText(from, 'and dessert you')
break
case '#Waifu':
case '#waifu':
q8 = q2 = Math.floor(Math.random() * 98) + 10;
client.sendFileFromUrl(from, 'http://randomwaifu.altervista.org/images/00'+q8+'.png', 'Waifu.png', 'How is she?')
break
case 'Heave ho':
case 'Heave ho!':
client.sendFileFromUrl(from, 'https://i.ibb.co/KjJx5ps/Whats-App-Image-2020-08-01-at-16-36-10.jpg','Soran.jpg','*Soran Soran*')
break
case '#neko':
q2 = Math.floor(Math.random() * 900) + 300;
q3 = Math.floor(Math.random() * 900) + 300;
client.sendFileFromUrl(from, 'http://placekitten.com/'+q3+'/'+q2, 'neko.png','Neko ')
break
case '#Pokemon':
q7 = Math.floor(Math.random() * 890) + 1;
client.sendFileFromUrl(from, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/'+q7+'.png','Pokemon.png',)
break
case '#wallpaper' :
q4 = Math.floor(Math.random() * 800) + 100;
client.sendFileFromUrl(from, 'https://wallpaperaccess.com/download/anime-'+q4,'Anime.png','Here is your wallpaper')
break
case 'Tsundere' :
case 'tsundere' :
client.sendText(from, 'I am not a tsundere, baka!')
break
case '#Mystery Video':
client.sendText(from, 'https://youtu.be/dQw4w9WgXcQ')
break
case 'Fuck' :
case 'fuck' :
client.sendText(from, 'Hmph! *crosses arms* Take that back!')
break
case '#fb':
if (args.length >=2) {
const urlvid = args[1]
const high = await fbvid.high(urlvid)
const low = await fbvid.low(urlvid)
if (high == "Either the video is deleted or it's not shared publicly!") {
client.sendFileFromUrl(from, low.url, "video.mp4", "SD Video successfully downloaded")
} else if (high !== "Either the video is deleted or it's not shared publicly!") {
client.sendFileFromUrl(from, high.url, "video.mp4", "HD Video successfully downloaded")
} else if (high == "Either the video is deleted or it's not shared publicly!" && low == "Either the video is deleted or it's not shared publicly!") {
client.reply(from,"The URL is invalid",message)
}
} else {
client.reply(from,"The format is #fb [URL Video]",message)
}
break
case 'sex' :
case 'Sex' :
case 'nudes' :
case 'porn' :
client.sendText(from, 'Go home, you are horny!')
break
case 'ora ora ora ora' :
case 'Ora Ora Ora Ora' :
case 'Ora ora ora ora' :
client.sendText(from, 'Muda Muda Muda Muda')
break
case 'Muda Muda Muda Muda' :
case 'Muda muda muda muda' :
case 'muda muda muda muda' :
client.sendText(from, 'Ora Ora Ora Ora')
break
case '#commands':
client.sendText(from, '👋️Hi there\n\nKey:\n\n#example \n-Function\n\n💻️Commands\n\n#sticker \nTurns sticker to images⛩️ \n\n#neko\nRetruns a random cat image🐈️\n\n#Pokemon Displays picture of a random pokemon \n \n#wallpaper \nSends a random anime wallpapers (beta) 🌌️\n\n#Seasonal anime \nReturns a list of seasonal animes🌆️\n\n#info \nDisplays the the terms and conditions📒️')
break
case '#Seasonal anime':
>>>>>>> 36756bc43404532ca0d09db1309a2eab324be72e
client.sendText(from, 'Summer 2020 \n Re:Zero kara Hajimeru Isekai Seikatsu 2nd Season \n Yahari Ore no Seishun Love Comedy wa Machigatteiru. Kan \n The God of High School \n Sword Art Online: Alicization - War of Underworld 2nd Season \n Enen no Shouboutai: Ni no Shou \n Maou Gakuin no Futekigousha: Shijou Saikyou no Maou no Shiso, Tensei shite Shison-tachi no Gakkou e \n Kanojo, Okarishimasu \n Deca-Dence \n Uzaki-chan wa Asobitai! \n Monster Musume no Oishasan')
break

case '#Thank you':
client.sendText(from, 'Whatever... *smiles*')
break
case '#info':
<<<<<<< HEAD
client.sendText(from, 'This is an open-source program written in Javascript. \n \nBy using the bot you agreeing to our Terms and Conditions \n \nTerms and conditions \n \nYour texts and your whatsapp username will be stored on our servers as long as the bot is active, your data will be erased when the bot goes offline. We do NOT store the images, videos, audio files and documents you send. We will never ask you to sign up or ask you for any of your passwords, OTPs or PINs. \n \n Thank you, Have a great day! \n \n Learn More about the bot: https://bit.ly/39Ld2L8 \n \n - Developers')
break

Expand All @@ -129,6 +286,9 @@ async function msgHandler (client, message) {
await client.simulateTyping(from, false)
break

=======
client.sendText(from, 'This is an open-source program written in Javascript. \n \nBy using the bot you agreeing to our Terms and Conditions \n \nTerms and conditions \n \nYour texts and your whatsapp username will be stored on our servers as long as the bot is active, your data will be erased when the bot goes offline. We do NOT store the images, videos, audio files and documents you send. We will never ask you to sign up or ask you for any of your passwords, OTPs or PINs. \n \n Thank you, Have a great day! \n \n Learn More about the bot: https://bit.ly/39Ld2L8 ')
>>>>>>> 36756bc43404532ca0d09db1309a2eab324be72e
}
} else {
if (!isGroupMsg) console.log('[RECV]', color(time, 'yellow'), 'Message from', color(pushname))
Expand Down

0 comments on commit 2ba64bf

Please sign in to comment.