diff --git a/README.md b/README.md deleted file mode 100644 index cac07f3f83..0000000000 --- a/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# README - -This is the [Express](https://expressjs.com) [Hello world](https://expressjs.com/en/starter/hello-world.html) example on [Render](https://render.com). - -The app in this repo is deployed at [https://express.onrender.com](https://express.onrender.com). - -## Deployment - -See https://render.com/docs/deploy-node-express-app or follow the steps below: - -Create a new web service with the following values: - * Build Command: `yarn` - * Start Command: `node app.js` - -That's it! Your web service will be live on your Render URL as soon as the build finishes. diff --git a/bot.js b/bot.js new file mode 100644 index 0000000000..82a7df2feb --- /dev/null +++ b/bot.js @@ -0,0 +1 @@ +const express=require("express"),fetch=require("node-fetch");const app=express();app.use(express.json());const TOKEN="8514818106:AAECNYeoCNJvgOKtozvDRqa2A6nyU-v_ojg";const API=`https://api.telegram.org/bot${TOKEN}`;const users=new Map();const refs=new Map();const send=(id,text)=>fetch(`${API}/sendMessage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chat_id:id,text})});app.post("/",(req,res)=>{const m=req.body.message;if(!m)return res.send("ok");const uid=m.from.id;const t=m.text||"";if(t.startsWith("/start")){const r=t.split(" ")[1];if(!users.has(uid)){users.set(uid,1);if(r&&r!=uid){refs.set(r,(refs.get(r)||0)+1);send(r,"✅ یک دعوت جدید ثبت شد");}}send(uid,"✅ فعال شد\n/ref لینک دعوت\n/stats آمار");}else if(t==="/ref")send(uid,`https://t.me/ZenoMinerBot?start=${uid}`);else if(t==="/stats")send(uid,`👥 تعداد دعوت: ${refs.get(uid)||0}`);res.send("ok");});app.listen(process.env.PORT||3000);