mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Added Option to skip QR Logging in Terminal (#552)
QR logging can now be disabled using connect option.
This commit is contained in:
@@ -110,6 +110,8 @@ conn.connectOptions = {
|
|||||||
fetchAgent?: Agent = undefined,
|
fetchAgent?: Agent = undefined,
|
||||||
/** always uses takeover for connecting */
|
/** always uses takeover for connecting */
|
||||||
alwaysUseTakeover: true
|
alwaysUseTakeover: true
|
||||||
|
/** log QR to terminal */
|
||||||
|
logQR: true
|
||||||
} as WAConnectOptions
|
} as WAConnectOptions
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ export class WAConnection extends EventEmitter {
|
|||||||
phoneResponseTime: 15_000,
|
phoneResponseTime: 15_000,
|
||||||
maxQueryResponseTime: 10_000,
|
maxQueryResponseTime: 10_000,
|
||||||
alwaysUseTakeover: true,
|
alwaysUseTakeover: true,
|
||||||
queryChatsTillReceived: true
|
queryChatsTillReceived: true,
|
||||||
|
logQR: true
|
||||||
}
|
}
|
||||||
/** When to auto-reconnect */
|
/** When to auto-reconnect */
|
||||||
autoReconnect = ReconnectMode.onConnectionLost
|
autoReconnect = ReconnectMode.onConnectionLost
|
||||||
|
|||||||
@@ -387,7 +387,11 @@ export class WAConnection extends Base {
|
|||||||
this.logger.warn('recieved read update for unknown chat ' + jid)
|
this.logger.warn('recieved read update for unknown chat ' + jid)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.on ('qr', qr => QR.generate(qr, { small: true }))
|
this.on('qr', qr => {
|
||||||
|
if (this.connectOptions.logQR) {
|
||||||
|
QR.generate(qr, { small: true })
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// blocklist updates
|
// blocklist updates
|
||||||
this.on('CB:Blocklist', json => {
|
this.on('CB:Blocklist', json => {
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ export type WAConnectOptions = {
|
|||||||
queryChatsTillReceived?: boolean
|
queryChatsTillReceived?: boolean
|
||||||
/** max time for the phone to respond to a query */
|
/** max time for the phone to respond to a query */
|
||||||
maxQueryResponseTime?: number
|
maxQueryResponseTime?: number
|
||||||
|
/** Log QR to terminal or not */
|
||||||
|
logQR?: boolean
|
||||||
}
|
}
|
||||||
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
||||||
export const URL_REGEX = /[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)?/gi
|
export const URL_REGEX = /[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)?/gi
|
||||||
|
|||||||
Reference in New Issue
Block a user