mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 12:12:55 -06:00
feat: Route to send status broadcast
This commit is contained in:
parent
4bf4b4a045
commit
24712c4c2d
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@ yarn-error.log*
|
|||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
/docker-compose-data
|
/docker-compose-data
|
||||||
|
/docker-data
|
||||||
|
|
||||||
# Package
|
# Package
|
||||||
/yarn.lock
|
/yarn.lock
|
||||||
|
@ -48,6 +48,7 @@ ENV DATABASE_SAVE_DATA_CHATS=$DATABASE_SAVE_DATA_CHATS
|
|||||||
|
|
||||||
ENV REDIS_ENABLED=$REDIS_ENABLED
|
ENV REDIS_ENABLED=$REDIS_ENABLED
|
||||||
ENV REDIS_URI=$REDIS_URI
|
ENV REDIS_URI=$REDIS_URI
|
||||||
|
ENV REDIS_PREFIX_KEY=$REDIS_PREFIX_KEY
|
||||||
|
|
||||||
ENV WEBHOOK_GLOBAL_URL=$WEBHOOK_GLOBAL_URL
|
ENV WEBHOOK_GLOBAL_URL=$WEBHOOK_GLOBAL_URL
|
||||||
ENV WEBHOOK_GLOBAL_ENABLED=$WEBHOOK_GLOBAL_ENABLED
|
ENV WEBHOOK_GLOBAL_ENABLED=$WEBHOOK_GLOBAL_ENABLED
|
||||||
|
@ -40,10 +40,10 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/EvolutionAPI/evolution-api#readme",
|
"homepage": "https://github.com/EvolutionAPI/evolution-api#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@whiskeysockets/baileys": "github:EvolutionAPI/Baileys",
|
|
||||||
"@adiwajshing/keyed-db": "^0.2.4",
|
"@adiwajshing/keyed-db": "^0.2.4",
|
||||||
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
||||||
"@hapi/boom": "^10.0.1",
|
"@hapi/boom": "^10.0.1",
|
||||||
|
"@whiskeysockets/baileys": "github:EvolutionAPI/Baileys",
|
||||||
"axios": "^1.3.5",
|
"axios": "^1.3.5",
|
||||||
"class-validator": "^0.13.2",
|
"class-validator": "^0.13.2",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
@ -65,6 +65,7 @@
|
|||||||
"node-cache": "^5.1.2",
|
"node-cache": "^5.1.2",
|
||||||
"node-mime-types": "^1.1.0",
|
"node-mime-types": "^1.1.0",
|
||||||
"pino": "^8.11.0",
|
"pino": "^8.11.0",
|
||||||
|
"proxy-agent": "^6.2.1",
|
||||||
"qrcode": "^1.5.1",
|
"qrcode": "^1.5.1",
|
||||||
"qrcode-terminal": "^0.12.0",
|
"qrcode-terminal": "^0.12.0",
|
||||||
"redis": "^4.6.5",
|
"redis": "^4.6.5",
|
||||||
|
@ -119,6 +119,7 @@ import { useMultiFileAuthStateRedisDb } from '../../utils/use-multi-file-auth-st
|
|||||||
import sharp from 'sharp';
|
import sharp from 'sharp';
|
||||||
import { RedisCache } from '../../db/redis.client';
|
import { RedisCache } from '../../db/redis.client';
|
||||||
import { Log } from '../../config/env.config';
|
import { Log } from '../../config/env.config';
|
||||||
|
import ProxyAgent from 'proxy-agent';
|
||||||
|
|
||||||
export class WAStartupService {
|
export class WAStartupService {
|
||||||
constructor(
|
constructor(
|
||||||
@ -1421,16 +1422,27 @@ export class WAStartupService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (status.type === 'audio') {
|
if (status.type === 'audio') {
|
||||||
return {
|
const convert = await this.processAudio(status.content, 'status@broadcast');
|
||||||
content: {
|
if (typeof convert === 'string') {
|
||||||
audio: {
|
const audio = fs.readFileSync(convert).toString('base64');
|
||||||
url: status.content,
|
|
||||||
|
const result = {
|
||||||
|
content: {
|
||||||
|
audio: Buffer.from(audio, 'base64'),
|
||||||
|
ptt: true,
|
||||||
|
mimetype: 'audio/mp4',
|
||||||
},
|
},
|
||||||
},
|
option: {
|
||||||
option: {
|
statusJidList: status.statusJidList,
|
||||||
statusJidList: status.statusJidList,
|
},
|
||||||
},
|
};
|
||||||
};
|
|
||||||
|
fs.unlinkSync(convert);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
throw new InternalServerErrorException(convert);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new BadRequestException('Type not found');
|
throw new BadRequestException('Type not found');
|
||||||
|
Loading…
Reference in New Issue
Block a user