Untitled
unknown
javascript
2 years ago
1.8 kB
5
Indexable
const telegramBot = require('node-telegram-bot-api'); const fetch = require('isomorphic-unfetch'); const apiKey = '6282930238:AAFCirQMNEdImtUhf6WDH9lQ-HK4g596epE'; const bot = new telegramBot(apiKey, { polling: true }); bot.on('message', async(msg) => { const chatId = msg.chat.id; const message = msg.text.trim().toLowerCase(); switch (message) { case "/start": bot.sendMessage(chatId, "Bot başladı"); break; case "/dns": bot.sendMessage(chatId, "Sorğu üçün domain yazın."); bot.on('message', async(msg) => { const chatId = msg.chat.id const message = msg.text.trim().toLowerCase() bot.sendMessage(chatId, "Sorğu göndərilir...") const dns = await getDns(message) bot.sendMessage(chatId, dns)}); break; default: if (!message.includes(".com" || ".org" || ".net" || ".az" || ".edu" || ".gov" || ".dev" || ".tr" || ".info" || ".biz" || ".us" || ".ru" || ".co" || ".io" || ".me" || ".tv" || ".uk" || ".ca" || ".de" || ".it" || ".nl" || ".fr" || ".se" || ".no" || ".es" || ".dk" || ".fi" || ".co.uk" )) { bot.sendMessage(chatId, "Bilinməyən əməliyyat"); } break; } }); const getDns = async(domain) => { const url = "https://api.api-ninjas.com/v1/dnslookup?domain=" + domain; const res = await fetch(url, { headers: { "X-Api-Key": "hbrXh0lQ6sFxuMKOuM8OHQ==T2oxpCCnPBJPFH9A" } }); const data = await res.json(); return JSON.stringify(data); } // hbrXh0lQ6sFxuMKOuM8OHQ==T2oxpCCnPBJPFH9A // https://api.api-ninjas.com/v1/dnslookup?domain= // 'X-Api-Key': 'YOUR_API_KEY'
Editor is loading...