albertincx/formatbot1

Hint: add proxy config If the program runs in LAN or China.

shuiRong opened this issue · 0 comments

Anyone who wants to run this program in the local area network or China(GFW), should modify these places:

  1. src/config/bot.js
...
var httpsAgent = require('socks5-https-client/lib/Agent');
...

const opts = {
    channelMode: true,
    telegram: {
        agent: new httpsAgent({
            socksHost: '127.0.0.1', // Defaults to 'localhost'.
            socksPort: 1085, // Defaults to 1080.
        }),
    },
};
  1. src/api/utils/makeTelegaph.js
...
var httpsAgent = require('socks5-https-client/lib/Agent');
...

return fetch('https://api.telegra.ph/createPage', {
    body: JSON.stringify(body),
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    agent: new httpsAgent({
      socksHost: '127.0.0.1', // Defaults to 'localhost'.
      socksPort: 1085, // Defaults to 1080.
    })
})