mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
respect printQRInTerminal
This commit is contained in:
@@ -25,7 +25,8 @@ export const makeSocket = ({
|
|||||||
keepAliveIntervalMs,
|
keepAliveIntervalMs,
|
||||||
version,
|
version,
|
||||||
browser,
|
browser,
|
||||||
auth: initialAuthState
|
auth: initialAuthState,
|
||||||
|
printQRInTerminal,
|
||||||
}: SocketConfig) => {
|
}: SocketConfig) => {
|
||||||
const ws = new WebSocket(waWebSocketUrl, undefined, {
|
const ws = new WebSocket(waWebSocketUrl, undefined, {
|
||||||
origin: DEFAULT_ORIGIN,
|
origin: DEFAULT_ORIGIN,
|
||||||
@@ -400,10 +401,12 @@ export const makeSocket = ({
|
|||||||
// QR gen
|
// QR gen
|
||||||
ws.on('CB:iq,type:set,pair-device', async (stanza: BinaryNode) => {
|
ws.on('CB:iq,type:set,pair-device', async (stanza: BinaryNode) => {
|
||||||
const postQR = async() => {
|
const postQR = async() => {
|
||||||
const QR = await import('qrcode-terminal').catch(err => {
|
if(printQRInTerminal) {
|
||||||
logger.error('add `qrcode-terminal` as a dependency to auto-print QR')
|
const QR = await import('qrcode-terminal').catch(err => {
|
||||||
})
|
logger.error('add `qrcode-terminal` as a dependency to auto-print QR')
|
||||||
QR?.generate(qr, { small: true })
|
})
|
||||||
|
QR?.generate(qr, { small: true })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const refs = ((stanza.content[0] as BinaryNode).content as BinaryNode[]).map(n => n.content as string)
|
const refs = ((stanza.content[0] as BinaryNode).content as BinaryNode[]).map(n => n.content as string)
|
||||||
|
|||||||
Reference in New Issue
Block a user