refactor(chatbot): streamline media message handling across chatbot services

- Removed redundant instance name references in EvolutionStartupService to enhance data consistency.
- Updated media message processing in various chatbot services to utilize base64 and mediaUrl more effectively, ensuring better handling of image messages.
- Improved overall code readability and maintainability by simplifying media handling logic.
This commit is contained in:
Davidson Gomes
2025-09-18 17:46:47 -03:00
parent 5f44da61fb
commit 407d254cf7
7 changed files with 215 additions and 96 deletions

View File

@@ -331,7 +331,6 @@ export class EvolutionStartupService extends ChannelStartupService {
messageTimestamp: Math.round(new Date().getTime() / 1000),
webhookUrl,
source: 'unknown',
instanceName: this.instance.name,
instanceId: this.instanceId,
};
} else if (message?.mediaType === 'video') {
@@ -346,7 +345,6 @@ export class EvolutionStartupService extends ChannelStartupService {
messageTimestamp: Math.round(new Date().getTime() / 1000),
webhookUrl,
source: 'unknown',
instanceName: this.instance.name,
instanceId: this.instanceId,
};
} else if (message?.mediaType === 'audio') {
@@ -361,7 +359,6 @@ export class EvolutionStartupService extends ChannelStartupService {
messageTimestamp: Math.round(new Date().getTime() / 1000),
webhookUrl,
source: 'unknown',
instanceName: this.instance.name,
instanceId: this.instanceId,
};
@@ -383,7 +380,6 @@ export class EvolutionStartupService extends ChannelStartupService {
messageTimestamp: Math.round(new Date().getTime() / 1000),
webhookUrl,
source: 'unknown',
instanceName: this.instance.name,
instanceId: this.instanceId,
};
} else if (message.buttonMessage) {
@@ -400,7 +396,6 @@ export class EvolutionStartupService extends ChannelStartupService {
messageTimestamp: Math.round(new Date().getTime() / 1000),
webhookUrl,
source: 'unknown',
instanceName: this.instance.name,
instanceId: this.instanceId,
};
} else if (message.listMessage) {
@@ -414,7 +409,6 @@ export class EvolutionStartupService extends ChannelStartupService {
messageTimestamp: Math.round(new Date().getTime() / 1000),
webhookUrl,
source: 'unknown',
instanceName: this.instance.name,
instanceId: this.instanceId,
};
} else {
@@ -428,7 +422,6 @@ export class EvolutionStartupService extends ChannelStartupService {
messageTimestamp: Math.round(new Date().getTime() / 1000),
webhookUrl,
source: 'unknown',
instanceName: this.instance.name,
instanceId: this.instanceId,
};
}