mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-15 19:52:54 -06:00
log verbose in file redis
This commit is contained in:
parent
a2779612be
commit
a2c125ee90
@ -1291,17 +1291,18 @@ export class WAStartupService {
|
|||||||
let outputAudio: string;
|
let outputAudio: string;
|
||||||
|
|
||||||
if (isURL(audio)) {
|
if (isURL(audio)) {
|
||||||
outputAudio = `${join(process.cwd(), 'temp', 'audio.mp4')}`;
|
|
||||||
tempAudioPath = `${join(process.cwd(), 'temp', 'audioTemp.mp3')}`;
|
|
||||||
|
|
||||||
const timestamp = new Date().getTime();
|
const timestamp = new Date().getTime();
|
||||||
|
outputAudio = `${join(process.cwd(), 'temp', `${timestamp}.mp4`)}`;
|
||||||
|
tempAudioPath = `${join(process.cwd(), 'temp', `temp-${timestamp}.mp3`)}`;
|
||||||
|
|
||||||
const url = `${audio}?timestamp=${timestamp}`;
|
const url = `${audio}?timestamp=${timestamp}`;
|
||||||
|
|
||||||
const response = await axios.get(url, { responseType: 'arraybuffer' });
|
const response = await axios.get(url, { responseType: 'arraybuffer' });
|
||||||
fs.writeFileSync(tempAudioPath, response.data);
|
fs.writeFileSync(tempAudioPath, response.data);
|
||||||
} else {
|
} else {
|
||||||
outputAudio = `${join(process.cwd(), 'temp', 'audio.mp4')}`;
|
const timestamp = new Date().getTime();
|
||||||
tempAudioPath = `${join(process.cwd(), 'temp', 'audioTemp.mp3')}`;
|
outputAudio = `${join(process.cwd(), 'temp', `${timestamp}.mp4`)}`;
|
||||||
|
tempAudioPath = `${join(process.cwd(), 'temp', `temp-${timestamp}.mp3`)}`;
|
||||||
|
|
||||||
const audioBuffer = Buffer.from(audio, 'base64');
|
const audioBuffer = Buffer.from(audio, 'base64');
|
||||||
fs.writeFileSync(tempAudioPath, audioBuffer);
|
fs.writeFileSync(tempAudioPath, audioBuffer);
|
||||||
@ -1323,7 +1324,7 @@ export class WAStartupService {
|
|||||||
const convert = await this.processAudio(data.audioMessage.audio);
|
const convert = await this.processAudio(data.audioMessage.audio);
|
||||||
if (typeof convert === 'string') {
|
if (typeof convert === 'string') {
|
||||||
const audio = fs.readFileSync(convert).toString('base64');
|
const audio = fs.readFileSync(convert).toString('base64');
|
||||||
return this.sendMessageWithTyping<AnyMessageContent>(
|
const result = this.sendMessageWithTyping<AnyMessageContent>(
|
||||||
data.number,
|
data.number,
|
||||||
{
|
{
|
||||||
audio: Buffer.from(audio, 'base64'),
|
audio: Buffer.from(audio, 'base64'),
|
||||||
@ -1332,6 +1333,10 @@ export class WAStartupService {
|
|||||||
},
|
},
|
||||||
{ presence: 'recording', delay: data?.options?.delay },
|
{ presence: 'recording', delay: data?.options?.delay },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
fs.unlinkSync(convert);
|
||||||
|
|
||||||
|
return result;
|
||||||
} else {
|
} else {
|
||||||
throw new InternalServerErrorException(convert);
|
throw new InternalServerErrorException(convert);
|
||||||
}
|
}
|
||||||
|
BIN
temp/audio.mp4
BIN
temp/audio.mp4
Binary file not shown.
Loading…
Reference in New Issue
Block a user