Termux से WhatsApp बॉट्स, Telegram बॉट्स, और ऑटोमेशन स्क्रिप्ट्स बनाएं
Python और Automation Libraries इनस्टॉल करें
import schedule import time def job(): print("Automation running...") schedule.every(10).seconds.do(job) while True: schedule.run_pending() time.sleep(1)Telegram Bot बनाएं और Control करें
import telebot bot = telebot.TeleBot('YOUR_BOT_TOKEN') @bot.message_handler(commands=['start']) def send_welcome(message): bot.reply_to(message, "Hello! I'm a bot from Termux") @bot.message_handler(commands=['help']) def send_help(message): bot.reply_to(message, "Commands: /start, /help") bot.polling()WhatsApp Bot बनाएं Node.js से
const { Client } = require("whatsapp-web.js");
const client = new Client();
client.on("qr", (qr) => {
console.log("Scan QR with WhatsApp:");
console.log(qr);
});
client.on("ready", () => {
console.log("Client is ready!");
});
client.on("message", msg => {
if (msg.body === "!ping") {
msg.reply("pong");
}
});
client.initialize();Websites से Data Extract करें
import requests from bs4 import BeautifulSoup url = 'https://example.com' response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') titles = soup.find_all('h1') for title in titles: print(title.text)Automated Tasks को Schedule करें
import schedule import time def morning_task(): print("Good morning!") def night_task(): print("Good night!") # Every day at 8 AM schedule.every().day.at("08:00").do(morning_task) # Every day at 10 PM schedule.every().day.at("22:00").do(night_task) while True: schedule.run_pending() time.sleep(60)Messages का Auto Reply बनाएं
import telebot
bot = telebot.TeleBot("YOUR_TOKEN")
@bot.message_handler(func=lambda message: True)
def echo_all(message):
if message.text.lower() == "hello":
bot.reply_to(message, "Hi! How can I help?")
elif message.text.lower() == "time":
from datetime import datetime
bot.reply_to(message, f"Time: {datetime.now()}")
else:
bot.reply_to(message, "Send 'hello' or 'time'")
bot.polling()