Skip to content

Commit

Permalink
fix download
Browse files Browse the repository at this point in the history
  • Loading branch information
Nurutomo committed Oct 9, 2022
1 parent 24b3aff commit 91c2ee9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/util/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import PermissionHandler from './PermissionHandler'
const Logger = pino({ transport: { target: 'pino-pretty' }, prettyPrint: { levelFirst: true, ignore: 'hostname', translateTime: true } })
export default class Connection {
static isModule: boolean = true
static Logger = Logger

sock: ReturnType<typeof Helper>
store: ReturnType<typeof makeInMemoryStore>
Expand Down
11 changes: 9 additions & 2 deletions src/util/MessageParser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { downloadMediaMessage, extractMessageContent, getContentType, getDevice, WAMessage, WAProto, areJidsSameUser, isJidGroup } from '@adiwajshing/baileys'
import { ParsedMessage, ParserOptions, AnyWASocket } from '../types'
import Connection from './Connection'

function MessageParser(conn: AnyWASocket, m: WAMessage, options: ParserOptions = {}): ParsedMessage {
const {
Expand Down Expand Up @@ -74,7 +75,10 @@ function MessageParser(conn: AnyWASocket, m: WAMessage, options: ParserOptions =
})
}
parsed.quoted.download = (type = 'buffer', options) => {
return downloadMediaMessage(parsed.quoted.fakeObj, type, options)
return downloadMediaMessage(parsed.quoted.fakeObj, type, options, {
logger: Connection.Logger.child({ class: 'Download' }),
reuploadRequest: conn.updateMediaMessage
})
}
}
}
Expand All @@ -95,7 +99,10 @@ function MessageParser(conn: AnyWASocket, m: WAMessage, options: ParserOptions =
})
}
parsed.download = (type = 'buffer', options) => {
return downloadMediaMessage(m, type, options)
return downloadMediaMessage(m, type, options, {
logger: Connection.Logger.child({ class: 'Download' }),
reuploadRequest: conn.updateMediaMessage
})
}
return parsed
}
Expand Down

0 comments on commit 91c2ee9

Please sign in to comment.