-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
25 lines (21 loc) · 854 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const { Telegraf } = require("telegraf");
const axios = require('axios')
const n = new Telegraf(process.env.token)
n.command('start', (ctx) => {
ctx.reply('Hai '+ctx.from.first_name+' Saya Adalah Google Bot Bisa Mencari Dengan Mudah Dan Cepat , Saya Di Buat Oleh @fckualot ,Silahkan Ketik Kata Yang Mau Kamu Cari')
n.on('message', (ctx) => { ` `
let input = ctx.message.text;
axios.get('https://google-api.xlaaf.repl.co/search?q='+input)
.then(res => {
const me = res.data.data
const hai = me[Math.floor(Math.random() * (me.length))]
const judul = hai.title
const link = hai.link
const desk = hai.desk
ctx.reply(`Ditemukan : ${input}\n${judul}\nUrl: ${link}\nDeskripsi: ${desk}`)
})
}).catch(e => {
console.log(e);
})
})
n.launch()