Spaces:
Running
Running
Blue demon commited on
Delete server.js
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253const express = require('express');const bodyParser = require('body-parser');const axios = require('axios');const app = express();const PORT = 3000;
app.use(bodyParser.json());
// Replace these with your actual Telegram bot token and chat IDconst TELEGRAM_BOT_TOKEN = '7848263680:AAHssiY_S00SLQDCI9D5SRfCe0iWquCKJSI';const TELEGRAM_CHAT_ID = '6573270131';
// Function to send a Telegram messagefunction sendTelegramMessage(message) { const url = `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`; axios.post(url, { chat_id: TELEGRAM_CHAT_ID, text: message, parse_mode: 'Markdown' }) .then(response => { console.log('Message sent to Telegram:', response.data); }) .catch(error => { console.error('Error sending message to Telegram:', error); });}
// Registration endpointapp.post('/register', (req, res) => { const { username, email, password } = req.body;
// Here, you would normally add code to save the user's info to a database
// Send Telegram notification const message = `New User Registration:\nUsername: ${username}\nEmail: ${email}`; sendTelegramMessage(message);
res.json({ message: 'Registration successful. Please wait for approval.' });});
// Login endpointapp.post('/login', (req, res) => { const { username, password } = req.body;
// Here, you would normally check the username and password with the database
res.json({ message: 'Login successful!' });});
app.listen(PORT, () => { console.log(`Server running on http://localhost:${PORT}`);});server.jsDeleted-53