File size: 548 Bytes
8202ff6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const https = require('https');
const dns = require('dns');

// Custom Agent with IP hardcoded to bypass DNS issues on Hugging Face
const telegramAgent = new https.Agent({
    keepAlive: true,
    family: 4,
    lookup: (hostname, options, callback) => {
        if (hostname === 'api.telegram.org') {
            console.log('⚡ Agent using hardcoded IP for Telegram: 149.154.166.110');
            return callback(null, '149.154.166.110', 4);
        }
        dns.lookup(hostname, options, callback);
    }
});

module.exports = telegramAgent;