Initial commit: LogMaster with Viewer Collector Monitor modes
This commit is contained in:
34
test-telegram.js
Normal file
34
test-telegram.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const https = require('https');
|
||||
|
||||
const BOT_TOKEN = '8116790669:AAE_llOFDFSwDhPx40vZMBa6dGv3Xxa9ZiQ';
|
||||
const CHAT_ID = '8599028500';
|
||||
|
||||
const message = '🧪 Test from LogViewer Monitor\n\nIf you see this, notifications work! ✅';
|
||||
|
||||
const payload = JSON.stringify({
|
||||
chat_id: CHAT_ID,
|
||||
text: message,
|
||||
parse_mode: 'Markdown',
|
||||
});
|
||||
|
||||
console.log('Sending to Telegram...');
|
||||
console.log(' Bot:', BOT_TOKEN.substring(0, 10) + '...');
|
||||
console.log(' Chat:', CHAT_ID);
|
||||
|
||||
const req = https.request({
|
||||
hostname: 'api.telegram.org',
|
||||
path: `/bot${BOT_TOKEN}/sendMessage`,
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) },
|
||||
}, (res) => {
|
||||
let body = '';
|
||||
res.on('data', c => body += c);
|
||||
res.on('end', () => {
|
||||
console.log(' Status:', res.statusCode);
|
||||
console.log(' Response:', body);
|
||||
});
|
||||
});
|
||||
|
||||
req.on('error', (e) => console.error(' Error:', e.message));
|
||||
req.write(payload);
|
||||
req.end();
|
||||
Reference in New Issue
Block a user