perf: 修改 emitter 发文本消息名字

dev/supplier-email-drawer
Jimmy 9 months ago
parent dacb49f273
commit adf35291e2

@ -41,7 +41,7 @@ exports.sendText = async ctx => {
// return 'Message sent successfully'; // { wsToSend, ret: 'Message sent successfully' };
// });
//wsToSend.sendTextMessage(to, content, actionId);
waEmitter.emit('request.' + from + '.send.message', {to, content, externalId: actionId});
waEmitter.emit('request.' + from + '.send.text', {to, content, externalId: actionId});
return 'Message sent successfully'; // { wsToSend, ret: 'Message sent successfully' };
} catch (error) {
console.error('Error sending message:', error);

@ -296,7 +296,7 @@ const createWhatsApp = async phone => {
status: 'open', whatsAppNo, channelId,
eventSource: serverConfig.name + '.connection.update.open',
});
waEmitter.on('request.' + whatsAppNo + '.send.message', event => {
waEmitter.on('request.' + whatsAppNo + '.send.text', event => {
const {to: number, externalId, content} = event;
console.info('request.' + whatsAppNo + '.send.message:', event)
// const jid = formatPhoneNumber(event.to);
@ -321,7 +321,7 @@ const createWhatsApp = async phone => {
//sendTextMessage(number, content, externalId);
});
waEmitter.on('req.' + whatsAppNo + '.send.image', event => {
waEmitter.on('request.' + whatsAppNo + '.send.image', event => {
const {to: number, externalId, content} = event;
const jid = formatPhoneNumber(event.to);
waSocket.sendMessage(

Loading…
Cancel
Save