ipoe: fix underscore

Signed-off-by: Rodrigo Martins <rodrigo@martinsevieira.adv.br>
This commit is contained in:
Rodrigo Martins committed 2026-04-05 08:36:10 -03:00
1 parent dc704d3f3c
commit f95eb37552
1 file changed
+11 -6
+11 -6
View File
@@ -8255,6 +8255,7 @@ Digite /help para ver todos os comandos disponíveis!
let message = `🔗 *Mudar para IPoE — Serviços do cliente:*\n\n`; let message = `🔗 *Mudar para IPoE — Serviços do cliente:*\n\n`;
const keyboard = []; const keyboard = [];
const esc = (v) => String(v).replace(/_/g, '\\_');
servicos.forEach((s, i) => { servicos.forEach((s, i) => {
const nome = s.descricao || s.nome || `Serviço ${i + 1}`; const nome = s.descricao || s.nome || `Serviço ${i + 1}`;
@@ -8265,7 +8266,7 @@ Digite /help para ver todos os comandos disponíveis!
const bairro = s.instalacao_bairro || ''; const bairro = s.instalacao_bairro || '';
const cidade = s.instalacao_cidade || ''; const cidade = s.instalacao_cidade || '';
message += `📦 *${i + 1}. ${nome}*\n`; message += `📦 *${i + 1}. ${esc(nome)}*\n`;
message += ` 👤 Login: \`${login}\`\n`; message += ` 👤 Login: \`${login}\`\n`;
message += ` 📟 Serial: \`${serial}\`\n`; message += ` 📟 Serial: \`${serial}\`\n`;
if (endereco) { if (endereco) {
@@ -8355,12 +8356,15 @@ Digite /help para ver todos os comandos disponíveis!
const nome = servico.descricao || servico.nome || 'N/A'; const nome = servico.descricao || servico.nome || 'N/A';
const idServico = servico.id_servico || servico.id; const idServico = servico.id_servico || servico.id;
// Escapar underscores para Telegram Markdown
const esc = (v) => String(v).replace(/_/g, '\\_');
let message = `🔗 *Confirmar mudança para IPoE*\n\n`; let message = `🔗 *Confirmar mudança para IPoE*\n\n`;
message += `📦 *Serviço:* ${nome}\n`; message += `📦 *Serviço:* ${esc(nome)}\n`;
message += `🆔 *ID Serviço:* ${idServico}\n`; message += `🆔 *ID Serviço:* ${idServico}\n`;
message += `📟 *Serial ONU:* \`${serial}\`\n`; message += `📟 *Serial ONU:* \`${serial}\`\n`;
message += `🏢 *Base/OLT:* ${baseInfo}\n`; message += `🏢 *Base/OLT:* ${esc(baseInfo)}\n`;
message += `🏷️ *Prefixo:* ${prefixo}\n\n`; message += `🏷️ *Prefixo:* ${esc(prefixo)}\n\n`;
message += `*Será configurado:*\n`; message += `*Será configurado:*\n`;
message += `🔗 Agent Circuit ID: \`${circuitId}\`\n`; message += `🔗 Agent Circuit ID: \`${circuitId}\`\n`;
message += `✅ DHCP Liberar: *Sim*\n\n`; message += `✅ DHCP Liberar: *Sim*\n\n`;
@@ -8395,10 +8399,11 @@ Digite /help para ver todos os comandos disponíveis!
const resultado = await this.topsapp.mudarParaIPoE(idCliente, idServico, location); const resultado = await this.topsapp.mudarParaIPoE(idCliente, idServico, location);
if (resultado.success) { if (resultado.success) {
const esc = (v) => String(v).replace(/_/g, '\\_');
let msg = `✅ *IPoE configurado com sucesso!*\n\n`; let msg = `✅ *IPoE configurado com sucesso!*\n\n`;
msg += `📦 Serviço: ${resultado.servico}\n`; msg += `📦 Serviço: ${esc(resultado.servico)}\n`;
msg += `📟 Serial: \`${resultado.serial}\`\n`; msg += `📟 Serial: \`${resultado.serial}\`\n`;
msg += `🏢 OLT: ${resultado.baseInfo} (${resultado.prefixo})\n`; msg += `🏢 OLT: ${esc(resultado.baseInfo)} (${esc(resultado.prefixo)})\n`;
msg += `🔗 Agent Circuit ID: \`${resultado.circuitId}\`\n`; msg += `🔗 Agent Circuit ID: \`${resultado.circuitId}\`\n`;
msg += `✅ DHCP Liberar: *Ativado*`; msg += `✅ DHCP Liberar: *Ativado*`;