text: const axios = require('axios')
  const link = 'https://arugaz.herokuapp.com'
  const fileyt = 'https://raw.githubusercontent.com/bintoro68/ujicoba/main/20201202_064739.jpg'
  const eroryt = 'https://raw.githubusercontent.com/bintoro68/ujicoba/main/20201202_065053.jpg'
  
  const cerpen = async () => new Promise((resolve, reject) => {
  	axios.get(`${link}/api/cerpen`)
  	.then((res) => {
  		resolve(res.data)
  	})
  	.catch((err) => {
  		reject(err)
  	})
  })
  
  const cersex = async () => new Promise((resolve, reject) => {
  	const ransex = Math.floor(Math.random() * 2) + 1
  	axios.get(`${link}/api/cersex${ransex}`)
  	.then((res) => {
  		resolve(res.data)
  	})
  	.catch((err) => {
  		reject(err)
  	})
  })
  
  const puisi = async () => new Promise((resolve, reject) => {
  	const puiti = ['1','3']
  	const ranisi = puiti[Math.floor(Math.random() * puiti.length)]
  	axios.get(`${link}/api/puisi${ranisi}`)
  	.then((res) => {
  		resolve(res.data)
  	})
  	.catch((err) => {
  		reject(err)
  	})
  })
  
  const ytmp3 = async (url) => new Promise((resolve, reject) => {
      axios.get(`${link}/api/yta?url=${url}`)
      .then((res) => {
  		resolve(res.data)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const ytmp4 = async (url) => new Promise((resolve, reject) => {
      axios.get(`${link}/api/ytv?url=${url}`)
      .then((res) => {
  		resolve(res.data)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const fb = async (url) => new Promise((resolve, reject) => {
  	axios.get(`${link}/api/fb?url=${url}`)
  	.then((res) => {
  		if (res.data.error) resolve({status: 'error', link: res.data.result})
  		resolve({linkhd: res.data.result.hd, linksd: res.data.result.sd})
  	})
  	.catch((err) =>{
          reject(err)
      })
  })
  
  const stalkig = async (url) => new Promise((resolve, reject) => {
      axios.get(`${link}/api/stalk?username=${url}`)
      .then((res) => {
  		if (res.data.error) resolve(res.data.error)
          const text = `User: ${res.data.Username}\nName: ${res.data.Name}\nBio: ${res.data.Biodata}\nFollower: ${res.data.Jumlah_Followers}\nFollowing: ${res.data.Jumlah_Following}\nPost: ${res.data.Jumlah_Post}`
          resolve(text)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const stalkigpict = async (url) => new Promise((resolve, reject) => {
      axios.get(`${link}/api/stalk?username=${url}`)
      .then((res) => {
  		if (res.data.error) resolve('https://c4.wallpaperflare.com/wallpaper/976/117/318/anime-girls-404-not-found-glowing-eyes-girls-frontline-wallpaper-preview.jpg')
          resolve(`${res.data.Profile_pic}`)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const quote = async () => new Promise((resolve, reject) => {
      axios.get(`${link}/api/randomquotes`)
      .then((res) => {
          const text = `Author: ${res.data.author}\n\nQuote: ${res.data.quotes}`
          resolve(text)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const wiki = async (url) => new Promise((resolve, reject) => {
      axios.get(`${link}/api/wiki?q=${url}`)
      .then((res) => {
          resolve(res.data.result)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const daerah = async () => new Promise((resolve, reject) => {
      axios.get(`${link}/daerah`)
      .then((res) => {
          resolve(res.data.result)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const jadwaldaerah = async (url) => new Promise((resolve, reject) => {
      axios.get(`https://api.haipbis.xyz/jadwalsholat?daerah=${url}`)
      .then((res) => {
  		if (res.data.error) resolve(res.data.error)
          const text = `Jadwal Sholat ${url}\n\nImsyak: ${res.data.Imsyak}\nSubuh: ${res.data.Subuh}\nDzuhur: ${res.data.Dzuhur}\nAshar: ${res.data.Ashar}\nMaghrib: ${res.data.Maghrib}\nIsya: ${res.data.Isya}`
          resolve(text)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const cuaca = async (url) => new Promise((resolve, reject) => {
      axios.get(`https://rest.farzain.com/api/cuaca.php?id=${url}&apikey=O8mUD3YrHIy9KM1fMRjamw8eg`)
      .then((res) => {
  		if (res.data.respon.cuaca == null) resolve('Maaf daerah kamu tidak tersedia')
          const text = `Cuaca di: ${res.data.respon.tempat}\n\nCuaca: ${res.data.respon.cuaca}\nAngin: ${res.data.respon.angin}\nDesk: ${res.data.respon.deskripsi}\nKelembapan: ${res.data.respon.kelembapan}\nSuhu: ${res.data.respon.suhu}\nUdara: ${res.data.respon.udara}`
          resolve(text)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const chord = async (url) => new Promise((resolve, reject) => {
      axios.get(`${link}/api/chord?q=${url}`)
      .then((res) => {
  		if (res.data.error) resolve(res.data.error)
          resolve(res.data.result)
      })
      .catch((err) =>{
          reject(err)
      })
  })
  
  const tulis = async (teks) => new Promise((resolve, reject) => {
      axios.get(`${link}/api/nulis?text=${encodeURIComponent(teks)}`)
      .then((res) => {
          resolve(`${res.data.result}`)
      })
      .catch((err) => {
          reject(err)
      })
  })
  
  const artinama = async (nama) => new Promise((resolve, reject) => {
  	axios.get(`${link}/api/artinama?nama=${nama}`)
  	.then((res) => {
  		resolve(res.data.result)
  	})
  	.catch((err) => {
  		reject(err)
  	})
  })
  
  const cekjodoh = async (nama,pasangan) => new Promise((resolve, reject) => {
  	axios.get(`${link}/api/jodohku?nama=${nama}&pasangan=${pasangan}`)
  	.then((res) => {
  		const textc = `Nama : ${res.data.nama}\nPasangan : ${res.data.pasangan}\nPositif: ${res.data.positif}\nNegatif : ${res.data.negatif}`
  		resolve({link: res.data.gambar, text: textc})
  	})
  	.catch((err) => {
  		reject(err)
  	})
  })
  
  const covidindo = async () => new Promise((resolve, reject) => {
  	axios.get(`${link}/api/coronaindo`)
  	.then((res) => {
  		const textv = `Info Covid-19 ${res.data.negara}\n\nKasus Baru: ${res.data.kasus_baru}\nTotal Kasus: ${res.data.kasus_total}\nSembuh: ${res.data.sembuh}\nPenanganan: ${res.data.penanganan}\nMeninggoy: ${res.data.meninggal}\n\nUpdate: ${res.data.terakhir}`
  		resolve(textv)
  	})
  	.catch((err) => {
  		reject(err)
  	})
  })
  
  const bapakfont = async (kalimat) => new Promise((resolve, reject) => {
  	axios.get(`${link}/api/bapakfont?kata=${kalimat}`)
  	.then((res) => {
  		resolve(res.data.result)
  	})
  	.catch((err) => {
  		reject(err)
  	})
  })
  
  const lirik = async (judul) => new Promise((resolve, reject) => {
  	axios.get(`${link}/api/lirik?judul=${judul}`)
  	.then((res) => {
  		resolve(res.data.result)
  	})
  	.catch((err) => {
  		reject(err)
  	})
  })
  
  const movie = async (judul) => new Promise((resolve, reject) => {
  	axios.get(`${link}/api/sdmovie?film=${encodeURIComponent(judul)}`)
  	.then((res) => {
  		if (res.data.error) return resolve({status: 'error', hasil: res.data.result})
  		const teksmov = `Judul: ${res.data.result.title}\nRating: ${res.data.result.rating}\nSinopsis: ${res.data.result.sinopsis}\nLink: ${res.data.result.video}`
  		resolve({status: 'success', hasil: teksmov, link: res.data.result.thumb})
  	})
  	.catch((err) => {
  		reject(err)
  	})
  })
  
  module.exports = {
      ytmp3,
      ytmp4,
  	fb,
      stalkig,
      stalkigpict,
      quote,
      wiki,
      daerah,
      jadwaldaerah,
      cuaca,
      chord,
      tulis,
  	artinama,
  	cekjodoh,
  	covidindo,
  	bapakfont,
  	lirik,
  	movie,
  	cerpen,
  	cersex,
  	puisi
  }
  