(message, mediaType)
| 4 | const path = require('path'); |
| 5 | |
| 6 | async function downloadMediaMessage(message, mediaType) { |
| 7 | const stream = await downloadContentFromMessage(message, mediaType); |
| 8 | let buffer = Buffer.from([]); |
| 9 | for await (const chunk of stream) { |
| 10 | buffer = Buffer.concat([buffer, chunk]); |
| 11 | } |
| 12 | const filePath = path.join(__dirname, '../temp/', `${Date.now()}.${mediaType}`); |
| 13 | fs.writeFileSync(filePath, buffer); |
| 14 | return filePath; |
| 15 | } |
| 16 | |
| 17 | async function tagCommand(sock, chatId, senderId, messageText, replyMessage, message) { |
| 18 | const { isSenderAdmin, isBotAdmin } = await isAdmin(sock, chatId, senderId); |
no outgoing calls
no test coverage detected