text: const qrcode = require("qrcode-terminal");
  const moment = require("moment");
  const cheerio = require("cheerio");
  const get = require('got')
  const fs = require("fs");
  const dl = require("./lib/downloadImage.js");
  const fetch = require('node-fetch');
  const urlencode = require("urlencode");
  const axios = require("axios");
  const imageToBase64 = require('image-to-base64');
  const menu = require("./lib/menu.js");
  const donate = require("./lib/donate.js");
  const info = require("./lib/info.js");
  //
  const BotName = 'Ghalyh bot'; // Nama Bot Whatsapp
  const instagramlu = 'https://instagram.com/ghlyhalamn'; // Nama Instagramlu cok
  const whatsapplu = 'http://wa.me/+6285766853909'; // Nomor whatsapplu cok
  const kapanbotaktif = 'gtw'; // Kapan bot lu aktif
  const grupch1 = 'https://chat.whatsapp.com/G3yYhho2lz4D3UiruLHp1M'; // OFFICIAL GRUP LU 1
  const grupch2 = 'gk ada'; // OFFICIAL GRUP LU 2
  const
  {
     WAConnection,
     MessageType,
     Presence,
     MessageOptions,
     Mimetype,
     WALocationMessage,
     WA_MESSAGE_STUB_TYPES,
     ReconnectMode,
     ProxyAgent,
     waChatKey,
  } = require("@adiwajshing/baileys");
  var jam = moment().format("HH:mm");
  
  function foreach(arr, func)
  {
     for (var i in arr)
     {
        func(i, arr[i]);
     }
  }
  const conn = new WAConnection()
  conn.on('qr', qr =>
  {
     qrcode.generate(qr,
     {
        small: true
     });
     console.log(`[ ${moment().format("HH:mm:ss")} ] Scan kode qr mu cok!`);
  });
  
  conn.on('credentials-updated', () =>
  {
     // save credentials whenever updated
     console.log(`credentials updated!`)
     const authInfo = conn.base64EncodedAuthInfo() // get all the auth info we need to restore this session
     fs.writeFileSync('./session.json', JSON.stringify(authInfo, null, '\t')) // save this info to a file
  })
  fs.existsSync('./session.json') && conn.loadAuthInfo('./session.json')
  // uncomment the following line to proxy the connection; some random proxy I got off of: https://proxyscrape.com/free-proxy-list
  //conn.connectOptions.agent = ProxyAgent ('http://1.0.180.120:8080')
  conn.connect();
  
  conn.on('user-presence-update', json => console.log(`[ ${moment().format("HH:mm:ss")} ] => bot by @Ghalyh`))
  conn.on('message-status-update', json =>
  {
     const participant = json.participant ? ' (' + json.participant + ')' : '' // participant exists when the message is from a group
     console.log(`[ ${moment().format("HH:mm:ss")} ] => bot by @Ghalyh`)
  })
  
  conn.on('message-new', async(m) =>
  {
     const messageContent = m.message
     const text = m.message.conversation
     let id = m.key.remoteJid
     const messageType = Object.keys(messageContent)[0] // message will always contain one key signifying what kind of message
     let imageMessage = m.message.imageMessage;
     console.log(`[ ${moment().format("HH:mm:ss")} ] => Nomor: [ ${id.split("@s.whatsapp.net")[0]} ] => ${text}`);
  
  
  // Groups
  
  if (text.includes("#buatgrup"))
     {
  var nama = text.split("#buatgrup")[1].split("-nomor")[0];
  var nom = text.split("-nomor")[1];
  var numArray = nom.split(",");
  for ( var i = 0; i < numArray.length; i++ ) {
      numArray[i] = numArray[i] +"@s.whatsapp.net";
  }
  var str = numArray.join("");
  console.log(str)
  const group = await conn.groupCreate (nama, str)
  console.log ("created group with id: " + group.gid)
  conn.sendMessage(group.gid, "hello everyone", MessageType.extendedText) // say hello to everyone on the group
  
  }
  
  // FF
  if(text.includes("#cek")){
  var num = text.replace(/#cek/ , "")
  var idn = num.replace("0","+62");
  
  console.log(id);
  const gg = idn+'@s.whatsapp.net'
  
  const exists = await conn.isOnWhatsApp (gg)
  console.log(exists);
  conn.sendMessage(id ,`${gg} ${exists ? " exists " : " does not exist"} on WhatsApp`, MessageType.text)
  }
  
  if (text.includes("#say")){
    const teks = text.replace(/#say /, "")
  conn.sendMessage(id, teks, MessageType.text)
  }
  
  if (text.includes('#nulis')){
    var teks = text.replace(/#nulis /, '')
      axios.get('https://bangandre.herokuapp.com/nulis?teks='+teks)
      .then((res) => {
        imageToBase64(res.data.result)
          .then(
            (ress) => {
              conn.sendMessage(id, '[WAIT] Proses...❗', MessageType.text)
              var buf = Buffer.from(ress, 'base64')
              conn.sendMessage(id, buf, MessageType.image)
          })
      })
  }
  
  if (text.includes("#ytmp3")){
  const teks = text.replace(/#ytmp3 /, "")
  axios.get(`https://alfians-api.herokuapp.com/api/yta?url=${teks}`).then((res) => {
  	conn.sendMessage(id, '[WAIT] Searching...⏳', MessageType.text)
      let hasil = `*Judul:* ${res.data.title}\n\n *Zize:* ${res.data.filesize}\n\n *Audio:* ${res.data.result}`;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  
  if (text.includes("#ytmp4")){
  const teks = text.replace(/#ytmp4 /, "")
  axios.get(`https://alfians-api.herokuapp.com/api/ytv?url=${teks}`).then((res) => {
  	conn.sendMessage(id, '[WAIT] Searching...⏳', MessageType.text)
      let hasil = ` *Judul:* ${res.data.title}\n\n *Tipe:* ${res.data.ext}\n\n *Resolution:* ${res.data.resolution}\n\n *Zize:* ${res.data.filesize}\n\n *Audio:* ${res.data.result}`;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  
  if (text.includes("#fb")){
  const teks = text.replace(/#fb /, "")
  axios.get(`https://arugaz.herokuapp.com/api/fb?url=${teks}`).then((res) => {
      let hasil = `Nih BosQ Pilih...\n\n *Revolusi SD*: ${res.data.result.sd}\n\n *Rovolusi HD:* ${res.data.result.hd}`;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  
  if (text.includes("#wiki")){
  const teks = text.replace(/#wiki /, "")
  axios.get(`https://arugaz.herokuapp.com/api/wiki?q=${teks}`).then((res) => {
  	conn.sendMessage(id, '[WAIT] Searching...❗', MessageType.text)
      let hasil = ` *👩‍💻Menurut Wikipedia:👩‍💻* \n\n _${res.data.result}_ `;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  
  if (text.includes("#call")){
  const teks = text.replace(/#call /, "")
  axios.get(`https://arugaz.herokuapp.com/api/spamcall?no=${teks}`).then((res) => {
  	conn.sendMessage(id, '[WAIT] Proses...❗', MessageType.text)
      let hasil = ` *INFO CALL* \n\n _${res.data.logs}_`;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  
  if (text.includes("#tiktok")) {
  const tictoc = text.replace(/#tiktok /, "")
  axios.get(`http://scrap.terhambar.com/tiktokfull?link=${tictoc}`).then((res) => {
  	 conn.sendMessage(id, '[WAIT] Searching...❗', MessageType.text)
       let titoe = `âœ…Berhasil$$$ Silahkan klik link dibawah ini untuk mendownload hasilnya$ \nKlik link dibawahðŸ—¡ï¸\n\nJudul: ${res.data.deskripsi} \n\nDurasi: ${res.data.durasi}\n\nNama: ${res.data.nama}\n\nUrl: ${res.data.urlvideo}`;
  conn.sendMessage(id, titoe, MessageType.text);
  })
  }
  
  if (text.includes("#igstalk")){
    const teks = text.replace(/#igstalk /, "")
    axios.get(`https://alfians-api.herokuapp.com/api/stalk?username=${teks}`).then ((res) =>{
    conn.sendMessage(id, '[WAIT] Searching...⏳', MessageType.text)
    let hasil = `BIODATA INSTAGRAM ATAS NAMA _${teks}_ \n\n *Username✍️* : _${res.data.Username}_ \n *Nama✍️* : _${res.data.Name}_ \n *Jumlah Followers✍️* : _${res.data.Jumlah_Followers}_ \n *Jumlah Following✍️* : _${res.data.Jumlah_Following}_ \n *Jumlah Post✍️* : _${res.data.Jumlah_Post}_ `;
    conn.sendMessage(id, hasil, MessageType.text);
  })
  }
  
  if (text.includes("#sholat")){
    const teks = text.replace(/#sholat /, "")
    axios.get(`https://tobz-api.herokuapp.com/api/jadwalshalat?q=${teks}`).then ((res) =>{
    conn.sendMessage(id, '[WAIT] Searching...❗', MessageType.text)
    let hasil = `Jadwal sholat di ${teks} hari ini adalah\n\nImsyak : ${res.data.Imsyak}\nSubuh : ${res.data.Subuh} WIB\nDzuhur : ${res.data.Dzuhur}WIB\nAshar : ${res.data.Ashar} WIB\nMaghrib : ${res.data.Maghrib}\nIsya : ${res.data.Isya} WIB\nTengah malam : ${res.data.Dhuha} WIB`;
    conn.sendMessage(id, hasil, MessageType.text);
  })
  }
  
  if (text.includes("#spamsms")){
  const teks = text.replace(/#spamsms /, "")
  axios.get(`https://arugaz.herokuapp.com/api/spamsms?no=${teks}&jum=20`).then((res) => {
  	conn.sendMessage(id, '[WAIT] Proses...❗', MessageType.text)
      let hasil = ` *INFO SPAM SMS 20 PESAN* \n\n _${res.data.logs}_`;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  
  if (text.includes("#gay")){
  const teks = text.replace(/#gay /, "")
  axios.get(`https://arugaz.herokuapp.com/api/howgay`).then((res) => {
  	conn.sendMessage(id, '[WAIT] Proses...❗', MessageType.text)
      let hasil = ` ${res.data.desc} \n\n *Persen Gay Lo!!!* _${res.data.persen}_`;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  
  if (text.includes("#bitly")){
  const teks = text.replace(/#bitly /, "")
  axios.get(`https://api.haipbis.xyz/bitly?url=${teks}`).then((res) => {
  	conn.sendMessage(id, '[WAIT] Searching...❗', MessageType.text)
      let hasil = `nih kak :) \n\n${res.data.result}`;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  
  if (text.includes("#bucin")){
  const teks = text.replace(/#bucin /, "")
  axios.get(`https://arugaz.herokuapp.com/api/howbucins`).then((res) => {
  	conn.sendMessage(id, '[WAIT] Proses...❗', MessageType.text)
      let hasil = ` _${res.data.desc}_ `;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  
  if (text == '#help'){
  const corohelp = await get.get('https://covid19.mathdro.id/api/countries/id').json()
  var date = new Date();
  var tahun = date.getFullYear();
  var bulan = date.getMonth();
  var tanggal = date.getDate();
  var hari = date.getDay();
  var jam = date.getHours();
  var menit = date.getMinutes();
  var detik = date.getSeconds();
  switch(hari) {
   case 0: hari = "Minggu"; break;
   case 1: hari = "Senin"; break;
   case 2: hari = "Selasa"; break;
   case 3: hari = "Rabu"; break;
   case 4: hari = "Kamis"; break;
   case 5: hari = "Jum'at"; break;
   case 6: hari = "Sabtu"; break;
  }
  switch(bulan) {
   case 0: bulan = "Januari"; break;
   case 1: bulan = "Februari"; break;
   case 2: bulan = "Maret"; break;
   case 3: bulan = "April"; break;
   case 4: bulan = "Mei"; break;
   case 5: bulan = "Juni"; break;
   case 6: bulan = "Juli"; break;
   case 7: bulan = "Agustus"; break;
   case 8: bulan = "September"; break;
   case 9: bulan = "Oktober"; break;
   case 10: bulan = "November"; break;
   case 11: bulan = "Desember"; break;
  }
  var tampilTanggal = "TANGGAL: " + hari + ", " + tanggal + " " + bulan + " " + tahun;
  var tampilWaktu = "JAM: " + jam + ":" + menit + ":" + detik;
  conn.sendMessage(id, menu.menu(id, BotName, corohelp, tampilTanggal, tampilWaktu, instagramlu, whatsapplu, kapanbotaktif, grupch1, grupch2) ,MessageType.text);
  }
  else if (text == '#quran'){
  axios.get('https://api.banghasan.com/quran/format/json/acak').then((res) => {
      const sr = /{(.*?)}/gi;
      const hs = res.data.acak.id.ayat;
      const ket = `${hs}`.replace(sr, '');
      let hasil = `[${ket}]   ${res.data.acak.ar.teks}\n\n${res.data.acak.id.teks}(QS.${res.data.surat.nama}, Ayat ${ket})`;
      conn.sendMessage(id, hasil ,MessageType.text);
  })
  }
  else if (text == 'assalamualaikum'){
  conn.sendMessage(id, 'Waalaikumsalam, ada yang bisa saya bantu? kalo bingung ketik #help ya say..' ,MessageType.text);
  }
  else if (text == 'salam'){
  conn.sendMessage(id, 'Waalaikumsalam, ada yang bisa saya bantu? kalo bingung ketik #help ya say..' ,MessageType.text);
  }
  else if (text == 'ngentod'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'p'){
  conn.sendMessage(id, 'Ya?, ada yang bisa saya bantu? kalo bingung ketik #help ya say..' ,MessageType.text);
  }
  else if (text == 'kontol'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'anjg'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'anjing'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'anijimc'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'anjim'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'anjinc'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'kntl'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'ngntd'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#ngentod'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'ajg'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#kontol'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'halo'){
  conn.sendMessage(id, 'Ya?, ada yang bisa saya bantu? kalo bingung ketik #help ya say..' ,MessageType.text);
  }
  else if (text == '#anjing'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#anjimc'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#anjim'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#anjinc'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#kntl'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#ngntd'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#ajg'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#anjg'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'memek'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#memek'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'memk'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#memk'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == '#mmk'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'mmk'){
  conn.sendMessage(id, 'Mulut anda kotor!!..' ,MessageType.text);
  }
  else if (text == 'euy'){
  conn.sendMessage(id, 'Ya?, ada yang bisa saya bantu? kalo bingung ketik #help ya say..' ,MessageType.text);
  }
  else if (text == 'makasi'){
  conn.sendMessage(id, 'Sama sama, semoga harimu menyenangkan :)' ,MessageType.text);
  }
  else if (text == 'Makasi'){
  conn.sendMessage(id, 'Sama sama, semoga harimu menyenangkan :)' ,MessageType.text);
  }
  else if (text == 'makasih'){
  conn.sendMessage(id, 'Sama sama, semoga harimu menyenangkan :)' ,MessageType.text);
  }
  else if (text == 'Makasih'){
  conn.sendMessage(id, 'Sama sama, semoga harimu menyenangkan :)' ,MessageType.text);
  }
  else if (text == 'thank'){
  conn.sendMessage(id, 'Sama sama, semoga harimu menyenangkan :)' ,MessageType.text);
  }
  else if (text == 'Thank'){
  conn.sendMessage(id, 'Sama sama, semoga harimu menyenangkan :)' ,MessageType.text);
  }
  else if (text == 'thanks'){
  conn.sendMessage(id, 'Sama sama, semoga harimu menyenangkan :)' ,MessageType.text);
  }
  else if (text == '#stiker'){
  conn.sendMessage(id, 'bukan #stiker,tetapi #sticker' ,MessageType.text);
  }
  else if (text == 'Thanks'){
  conn.sendMessage(id, 'Sama sama, semoga harimu menyenangkan :)' ,MessageType.text);
  }
  else if (text == '#donate'){
  const corohelp = await get.get('https://covid19.mathdro.id/api/countries/id').json()
  var date = new Date();
  var tahun = date.getFullYear();
  var bulan = date.getMonth();
  var tanggal = date.getDate();
  var hari = date.getDay();
  var jam = date.getHours();
  var menit = date.getMinutes();
  var detik = date.getSeconds();
  switch(hari) {
   case 0: hari = "Minggu"; break;
   case 1: hari = "Senin"; break;
   case 2: hari = "Selasa"; break;
   case 3: hari = "Rabu"; break;
   case 4: hari = "Kamis"; break;
   case 5: hari = "Jum'at"; break;
   case 6: hari = "Sabtu"; break;
  }
  switch(bulan) {
   case 0: bulan = "Januari"; break;
   case 1: bulan = "Februari"; break;
   case 2: bulan = "Maret"; break;
   case 3: bulan = "April"; break;
   case 4: bulan = "Mei"; break;
   case 5: bulan = "Juni"; break;
   case 6: bulan = "Juli"; break;
   case 7: bulan = "Agustus"; break;
   case 8: bulan = "September"; break;
   case 9: bulan = "Oktober"; break;
   case 10: bulan = "November"; break;
   case 11: bulan = "Desember"; break;
  }
  var tampilTanggal = "TANGGAL: " + hari + ", " + tanggal + " " + bulan + " " + tahun;
  var tampilWaktu = "JAM: " + jam + ":" + menit + ":" + detik;
  conn.sendMessage(id, donate.donate(id, BotName, corohelp, tampilTanggal, tampilWaktu, instagramlu, whatsapplu, kapanbotaktif, grupch1, grupch2) ,MessageType.text);
  }
  else if (text == '#donasi'){
  const corohelp = await get.get('https://covid19.mathdro.id/api/countries/id').json()
  var date = new Date();
  var tahun = date.getFullYear();
  var bulan = date.getMonth();
  var tanggal = date.getDate();
  var hari = date.getDay();
  var jam = date.getHours();
  var menit = date.getMinutes();
  var detik = date.getSeconds();
  switch(hari) {
   case 0: hari = "Minggu"; break;
   case 1: hari = "Senin"; break;
   case 2: hari = "Selasa"; break;
   case 3: hari = "Rabu"; break;
   case 4: hari = "Kamis"; break;
   case 5: hari = "Jum'at"; break;
   case 6: hari = "Sabtu"; break;
  }
  switch(bulan) {
   case 0: bulan = "Januari"; break;
   case 1: bulan = "Februari"; break;
   case 2: bulan = "Maret"; break;
   case 3: bulan = "April"; break;
   case 4: bulan = "Mei"; break;
   case 5: bulan = "Juni"; break;
   case 6: bulan = "Juli"; break;
   case 7: bulan = "Agustus"; break;
   case 8: bulan = "September"; break;
   case 9: bulan = "Oktober"; break;
   case 10: bulan = "November"; break;
   case 11: bulan = "Desember"; break;
  }
  var tampilTanggal = "TANGGAL: " + hari + ", " + tanggal + " " + bulan + " " + tahun;
  var tampilWaktu = "JAM: " + jam + ":" + menit + ":" + detik;
  conn.sendMessage(id, donate.donate(id, BotName, corohelp, tampilTanggal, tampilWaktu, instagramlu, whatsapplu, kapanbotaktif, grupch1, grupch2) ,MessageType.text);
  }
  else if (text == '#DONATE'){
  const corohelp = await get.get('https://covid19.mathdro.id/api/countries/id').json()
  var date = new Date();
  var tahun = date.getFullYear();
  var bulan = date.getMonth();
  var tanggal = date.getDate();
  var hari = date.getDay();
  var jam = date.getHours();
  var menit = date.getMinutes();
  var detik = date.getSeconds();
  switch(hari) {
   case 0: hari = "Minggu"; break;
   case 1: hari = "Senin"; break;
   case 2: hari = "Selasa"; break;
   case 3: hari = "Rabu"; break;
   case 4: hari = "Kamis"; break;
   case 5: hari = "Jum'at"; break;
   case 6: hari = "Sabtu"; break;
  }
  switch(bulan) {
   case 0: bulan = "Januari"; break;
   case 1: bulan = "Februari"; break;
   case 2: bulan = "Maret"; break;
   case 3: bulan = "April"; break;
   case 4: bulan = "Mei"; break;
   case 5: bulan = "Juni"; break;
   case 6: bulan = "Juli"; break;
   case 7: bulan = "Agustus"; break;
   case 8: bulan = "September"; break;
   case 9: bulan = "Oktober"; break;
   case 10: bulan = "November"; break;
   case 11: bulan = "Desember"; break;
  }
  var tampilTanggal = "TANGGAL: " + hari + ", " + tanggal + " " + bulan + " " + tahun;
  var tampilWaktu = "JAM: " + jam + ":" + menit + ":" + detik;
  conn.sendMessage(id, donate.donate(id, BotName, corohelp, tampilTanggal, tampilWaktu, instagramlu, whatsapplu, kapanbotaktif, grupch1, grupch2) ,MessageType.text);
  }
  else if (text == '#DONASI'){
    const corohelp = await get.get('https://covid19.mathdro.id/api/countries/id').json()
  var date = new Date();
  var tahun = date.getFullYear();
  var bulan = date.getMonth();
  var tanggal = date.getDate();
  var hari = date.getDay();
  var jam = date.getHours();
  var menit = date.getMinutes();
  var detik = date.getSeconds();
  switch(hari) {
   case 0: hari = "Minggu"; break;
   case 1: hari = "Senin"; break;
   case 2: hari = "Selasa"; break;
   case 3: hari = "Rabu"; break;
   case 4: hari = "Kamis"; break;
   case 5: hari = "Jum'at"; break;
   case 6: hari = "Sabtu"; break;
  }
  switch(bulan) {
   case 0: bulan = "Januari"; break;
   case 1: bulan = "Februari"; break;
   case 2: bulan = "Maret"; break;
   case 3: bulan = "April"; break;
   case 4: bulan = "Mei"; break;
   case 5: bulan = "Juni"; break;
   case 6: bulan = "Juli"; break;
   case 7: bulan = "Agustus"; break;
   case 8: bulan = "September"; break;
   case 9: bulan = "Oktober"; break;
   case 10: bulan = "November"; break;
   case 11: bulan = "Desember"; break;
  }
  var tampilTanggal = "TANGGAL: " + hari + ", " + tanggal + " " + bulan + " " + tahun;
  var tampilWaktu = "JAM: " + jam + ":" + menit + ":" + detik;
  conn.sendMessage(id, donate.donate(id, BotName, corohelp, tampilTanggal, tampilWaktu, instagramlu, whatsapplu, kapanbotaktif, grupch1, grupch2) ,MessageType.text);
  }
  else if (text == '#info'){
    const corohelp = await get.get('https://covid19.mathdro.id/api/countries/id').json()
  var date = new Date();
  var tahun = date.getFullYear();
  var bulan = date.getMonth();
  var tanggal = date.getDate();
  var hari = date.getDay();
  var jam = date.getHours();
  var menit = date.getMinutes();
  var detik = date.getSeconds();
  switch(hari) {
   case 0: hari = "Minggu"; break;
   case 1: hari = "Senin"; break;
   case 2: hari = "Selasa"; break;
   case 3: hari = "Rabu"; break;
   case 4: hari = "Kamis"; break;
   case 5: hari = "Jum'at"; break;
   case 6: hari = "Sabtu"; break;
  }
  switch(bulan) {
   case 0: bulan = "Januari"; break;
   case 1: bulan = "Februari"; break;
   case 2: bulan = "Maret"; break;
   case 3: bulan = "April"; break;
   case 4: bulan = "Mei"; break;
   case 5: bulan = "Juni"; break;
   case 6: bulan = "Juli"; break;
   case 7: bulan = "Agustus"; break;
   case 8: bulan = "September"; break;
   case 9: bulan = "Oktober"; break;
   case 10: bulan = "November"; break;
   case 11: bulan = "Desember"; break;
  }
  var tampilTanggal = "TANGGAL: " + hari + ", " + tanggal + " " + bulan + " " + tahun;
  var tampilWaktu = "JAM: " + jam + ":" + menit + ":" + detik;
  conn.sendMessage(id, info.info(id, BotName, corohelp, tampilTanggal, tampilWaktu, instagramlu, whatsapplu, kapanbotaktif, grupch1, grupch2) ,MessageType.text);
  }
  else if (text == '#gacha'){
  conn.sendMessage(id, 'kirim #gacha cewek/cowok\n\nContoh: #gacha cewek' ,MessageType.text);
  }
     if (messageType == 'imageMessage')
     {
        let caption = imageMessage.caption.toLocaleLowerCase()
        const buffer = await conn.downloadMediaMessage(m) // to decrypt & use as a buffer
        if (caption == '#sticker')
        {
           const stiker = await conn.downloadAndSaveMediaMessage(m) // to decrypt & save to file
  
           const
           {
              exec
           } = require("child_process");
           exec('cwebp -q 50 ' + stiker + ' -o temp/' + jam + '.webp', (error, stdout, stderr) =>
           {
              let stik = fs.readFileSync('temp/' + jam + '.webp')
              conn.sendMessage(id, stik, MessageType.sticker)
           });
        }
     }
  
     if (messageType === MessageType.text)
     {
        let is = m.message.conversation.toLocaleLowerCase()
  
        if (is == '#pantun')
        {
  
           fetch('https://raw.githubusercontent.com/pajaar/grabbed-results/master/pajaar-2020-pantun-pakboy.txt')
              .then(res => res.text())
              .then(body =>
              {
                 let tod = body.split("\n");
                 let pjr = tod[Math.floor(Math.random() * tod.length)];
                 let pantun = pjr.replace(/pjrx-line/g, "\n");
                 conn.sendMessage(id, pantun, MessageType.text)
              });
        }
  
     }
  /*   if (text.includes("#yt"))
     {
        const url = text.replace(/#yt/, "");
        const exec = require('child_process').exec;
  
        var videoid = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/);
  
        const ytdl = require("ytdl-core")
        if (videoid != null)
        {
           console.log("video id = ", videoid[1]);
        }
        else
        {
           conn.sendMessage(id, "gavalid", MessageType.text)
        }
        ytdl.getInfo(videoid[1]).then(info =>
        {
           if (info.length_seconds > 1000)
           {
              conn.sendMessage(id, " videonya kepanjangan", MessageType.text)
           }
           else
           {
  
              console.log(info.length_seconds)
  
              function os_func()
              {
                 this.execCommand = function (cmd)
                 {
                    return new Promise((resolve, reject) =>
                    {
                       exec(cmd, (error, stdout, stderr) =>
                       {
                          if (error)
                          {
                             reject(error);
                             return;
                          }
                          resolve(stdout)
                       });
                    })
                 }
              }
              var os = new os_func();
  
              os.execCommand('ytdl ' + url + ' -q highest -o mp4/' + videoid[1] + '.mp4').then(res =>
              {
  		const buffer = fs.readFileSync("mp4/"+ videoid[1] +".mp4")
                 conn.sendMessage(id, buffer, MessageType.video)
              }).catch(err =>
              {
                 console.log("os >>>", err);
              })
  
           }
        });
  
     }*/
  
  
     /*if (text.includes("#nulis"))
     {
  
        const
        {
           spawn
        } = require("child_process");
        console.log("writing...")
        const teks = text.replace(/#nulis/, "")
        const split = teks.replace(/(\S+\s*){1,10}/g, "$&\n")
        const fixedHeight = split.split("\n").slice(0, 25).join("\\n")
        console.log(split)
        spawn("convert", [
              "./assets/paper.jpg",
              "-font",
              "Indie-Flower",
              "-size",
              "700x960",
              "-pointsize",
              "18",
              "-interline-spacing",
              "3",
              "-annotate",
              "+170+222",
              fixedHeight,
              "./assets/result.jpg"
           ])
           .on("error", () => console.log("error"))
           .on("exit", () =>
           {
              const buffer = fs.readFileSync("assets/result.jpg") // can send mp3, mp4, & ogg -- but for mp3 files the mimetype must be set to ogg
  
              conn.sendMessage(id, buffer, MessageType.image)
              console.log("done")
           })
     }
  
  
     if (text.includes("#quotes"))
     {
        var url = 'https://jagokata.com/kata-bijak/acak.html'
        axios.get(url)
           .then((result) =>
           {
              let $ = cheerio.load(result.data);
              var author = $('a[class="auteurfbnaam"]').contents().first().text();
              var kata = $('q[class="fbquote"]').contents().first().text();
  
              conn.sendMessage(
                 id,
                 `
       _${kata}_
          
      
  	*~${author}*
           `, MessageType.text
              );
  
           });
     }*/
  
     if (text.includes("#gacha cewek"))
     {
      var items = ["ullzang girl", "cewe cantik", "hijab cantik", "korean girl"];
      var cewe = items[Math.floor(Math.random() * items.length)];
      var url = "https://api.fdci.se/rep.php?gambar=" + cewe;
      
      axios.get(url)
        .then((result) => {
          var b = JSON.parse(JSON.stringify(result.data));
          var cewek =  b[Math.floor(Math.random() * b.length)];
          imageToBase64(cewek) // Path to the image
          .then(
              (response) => {
  	var buf = Buffer.from(response, 'base64'); // Ta-da	
                conn.sendMessage(
              id,
                buf,MessageType.image)
         
              }
          )
          .catch(
              (error) => {
                  console.log(error); // Logs an error if there was one
              }
          )
      
      });
      }
  
     if (text.includes("#gacha cowok"))
     {
      var items = ["cowo ganteng", "cogan", "korean boy", "chinese boy", "japan boy"];
      var cewe = items[Math.floor(Math.random() * items.length)];
      var url = "https://api.fdci.se/rep.php?gambar=" + cewe;
      
      axios.get(url)
        .then((result) => {
          var b = JSON.parse(JSON.stringify(result.data));
          var cewek =  b[Math.floor(Math.random() * b.length)];
          imageToBase64(cewek) // Path to the image
          .then(
              (response) => {
    var buf = Buffer.from(response, 'base64'); // Ta-da 
                conn.sendMessage(
              id,
                buf,MessageType.image)
         
              }
          )
          .catch(
              (error) => {
                  console.log(error); // Logs an error if there was one
              }
          )
      
      });
      }
  
  if (text.includes("#randomanime"))
     {
      var items = ["anime girl", "anime cantik", "anime", "anime aesthetic"];
      var cewe = items[Math.floor(Math.random() * items.length)];
      var url = "https://api.fdci.se/rep.php?gambar=" + cewe;
      
      axios.get(url)
        .then((result) => {
          var b = JSON.parse(JSON.stringify(result.data));
          var cewek =  b[Math.floor(Math.random() * b.length)];
          imageToBase64(cewek) // Path to the image
          .then(
              (response) => {
  	var buf = Buffer.from(response, 'base64'); // Ta-da	
                conn.sendMessage(
              id,
                buf,MessageType.image)
         
              }
          )
          .catch(
              (error) => {
                  console.log(error); // Logs an error if there was one
              }
          )
      
      });
      }
  
  if (text.includes("#scdl")){
  const fs = require("fs");
  const scdl = require("./lib/scdl");
  
  scdl.setClientID("iZIs9mchVcX5lhVRyQGGAYlNPVldzAoX");
  
  scdl("https://m.soundcloud.com/abdul-muttaqin-701361735/lucid-dreams-gustixa-ft-vict-molina")
      .pipe(fs.createWriteStream("mp3/song.mp3"));
  }
  
  
  
   if (text.includes('#tts')){
    var teks = text.replace(/#tts /, '')
      axios.get('http://scrap.terhambar.com/tts?kata=${teks}')
      .then((res) => {
        audioToBase64(res.data.result)
          .then(
            (ress) => {
              conn.sendMessage(id, '[WAIT] Searching...❗', MessageType.text)
              var buf = Buffer.from(ress, 'base64')
              conn.sendMessage(id, buf, MessageType.audio)
          })
      })
  }
  
  if (text.includes("#lirik")){
  	const teks = text.split("#lirik")[1]
  	axios.get(`http://scrap.terhambar.com/lirik?word=${teks}`).then ((res) => {
  	 	let hasil = `LIRIK DARI LAGU ${teks} ADALAH\n\n\n ${res.data.result.lirik}`
  	conn.sendMessage(id, hasil, MessageType.text)
  	})
  }
  if (text.includes("#alay")){
  	const alay = text.split("#alay")[1]
  	axios.get(`https://api.terhambar.com/bpk?kata=${alay}`).then ((res) =>
  		{ let hasil = `${res.data.text}`
  		conn.sendMessage(id, hasil, MessageType.text)
  	})
  }
  
  if (text.includes("#randomloli"))
     {
      var items = ["anime loli","anime loli sange","anime loli fackgirll","anime loli i love you"];
      var nime = items[Math.floor(Math.random() * items.length)];
      var url = "https://api.fdci.se/rep.php?gambar=" + nime;
      
      axios.get(url)
        .then((result) => {
          var n = JSON.parse(JSON.stringify(result.data));
          var nimek =  n[Math.floor(Math.random() * n.length)];
          imageToBase64(nimek) 
          .then(
              (response) => {
  	var buf = Buffer.from(response, 'base64'); 
                conn.sendMessage(
              id,
                buf,MessageType.image)
         
              }
          )
          .catch(
              (error) => {
                  console.log(error);
              }
          )
      
      });
      }
  
  if (text.includes("#randomhentai"))
     {
      var items = ["anime loli sange","anime loli fackgirll"];
      var anim = items[Math.floor(Math.random() * items.length)];
      var url = "https://api.fdci.se/rep.php?gambar=" + nime;
      
      axios.get(url)
        .then((result) => {
          var b = JSON.parse(JSON.stringify(result.data));
          var anim =  b[Math.floor(Math.random() * b.length)];
          imageToBase64(anim) // Path to the image
          .then(
              (response) => {
  	var buf = Buffer.from(response, 'base64'); // Ta-da	
                conn.sendMessage(
              id,
                buf,MessageType.image)
         
              }
          )
          .catch(
              (error) => {
                  console.log(error); // Logs an error if there was one
              }
          )
      
      });
      }
  
  if (text.includes("#waifu"))
     {
      var items = ["waifu","anime waifu"];
      var anim = items[Math.floor(Math.random() * items.length)];
      var url = "https://api.haipbis.xyz/waifu";
      
      axios.get(url)
        .then((result) => {
          var b = JSON.parse(JSON.stringify(result.data));
          var anim =  b[Math.floor(Math.random() * b.length)];
          imageToBase64(anim) // Path to the image
          .then(
              (response) => {
  	var buf = Buffer.from(response, 'base64'); // Ta-da	
                conn.sendMessage(
              id,
                buf,MessageType.image)
         
              }
          )
          .catch(
              (error) => {
                  console.log(error); // Logs an error if there was one
              }
          )
      
      });
      }
  
  else if (text.includes("#artinama")) 
    {
      const cheerio = require('cheerio');
      const request = require('request');
      var nama = text.split("#artinama ")[1];
      var req = nama.replace(/ /g,"+");
      request.get({
          headers: {'content-type' : 'application/x-www-form-urlencoded'},
          url:     'http://www.primbon.com/arti_nama.php?nama1='+ req +'&proses=+Submit%21+',
        },function(error, response, body){
            let $ = cheerio.load(body);
            var y = $.html().split('arti:')[1];
            var t = y.split('method="get">')[1];
            var f = y.replace(t ," ");
            var x = f.replace(/<br\s*[\/]?>/gi, "\n");
            var h  = x.replace(/<[^>]*>?/gm, '');
        console.log(""+ h);
        conn.sendMessage(id,
              `
        Arti dari nama *${nama}* adalah
  ❉──────────❉
           Nama _*${nama}*_ _${h}_
           
  ❉──────────❉
  `,
   MessageType.text);
    });
    }
  
  else if (text.includes("#pasangan ")) {
      const request = require('request');
      var gh = text.split("#pasangan ")[1];
      var namamu = gh.split("&")[0];
      var pasangan = gh.split("&")[1];
      request.get({
          headers: {'content-type' : 'application/x-www-form-urlencoded'},
          url:     'http://www.primbon.com/kecocokan_nama_pasangan.php?nama1='+ namamu +'&nama2='+ pasangan +'&proses=+Submit%21+',
  
      },function(error, response, body){
          let $ = cheerio.load(body);
        var y = $.html().split('<b>KECOCOKAN JODOH BERDASARKAN NAMA PASANGAN</b><br><br>')[1];
          var t = y.split('.<br><br>')[1];
          var f = y.replace(t ," ");
          var x = f.replace(/<br\s*[\/]?>/gi, "\n");
          var h  = x.replace(/<[^>]*>?/gm, '');
          var d = h.replace("&amp;", '&')
        console.log(""+ d);
        conn.sendMessage(id, `
  ❉──────────❉
   *Kecocokan berdasarkan nama*
   _${d}_
  ❉──────────❉
      `, MessageType.text);
    });
    }
  
  
  
  
  
  
  
     // end of file
  
  
  })
  