Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const bot = new TeleBot({
limit: 100, // Optional. Limits the number of updates to be retrieved.
retryTimeout: 5000, // Optional. Reconnecting timeout (in ms).
proxy: 'http://username:password@yourproxy.com:8080' // Optional. An HTTP proxy to be used.
socketTimeout: 30000, // Optional. Socket timeout (in ms).
},
webhook: { // Optional. Use webhook instead of polling.
key: 'key.pem', // Optional. Private key for server.
Expand Down
4 changes: 3 additions & 1 deletion lib/telebot.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TeleBot {
this.interval = poll.interval >= 0 ? poll.interval : 300;
this.timeout = poll.timeout >= 0 ? poll.timeout : 0;
this.retryTimeout = poll.retryTimeout >= 0 ? poll.retryTimeout : 5000;
this.socketTimeout = poll.socketTimeout >=0 ? poll.socketTimeout: 30000;

this.webhook = cfg.webhook;

Expand Down Expand Up @@ -300,7 +301,8 @@ class TeleBot {

const options = {
url: this.api + url,
json: true
json: true,
timeout: this.socketTimeout
};

if (this.proxy) options.proxy = this.proxy;
Expand Down