genieacs: fix offset
Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
1 parent
6e2473719d
commit
c003631efc
1 file changed
+23
-19
+23
-19
@@ -6915,7 +6915,13 @@ Digite /help para ver todos os comandos disponíveis!
|
||||
return;
|
||||
}
|
||||
|
||||
await this.bot.sendMessage(chatId, `🔍 Consultando dispositivo \`${termo}\` no GenieACS...`, { parse_mode: 'Markdown' });
|
||||
// Escapa caracteres especiais do Markdown V1 em valores dinâmicos
|
||||
const esc = (v) => {
|
||||
if (v === null || v === undefined || v === '') return 'N/A';
|
||||
return String(v).replace(/[_*`\[]/g, '\\$&');
|
||||
};
|
||||
|
||||
await this.bot.sendMessage(chatId, `🔍 Consultando dispositivo \`${esc(termo)}\` no GenieACS...`, { parse_mode: 'Markdown' });
|
||||
|
||||
try {
|
||||
const resultado = await this.genieacs.buscarRoteador(termo);
|
||||
@@ -6923,39 +6929,37 @@ Digite /help para ver todos os comandos disponíveis!
|
||||
if (!resultado.success) {
|
||||
await this.bot.sendMessage(chatId,
|
||||
`❌ *Dispositivo não encontrado*\n\n` +
|
||||
`🔍 Busca: \`${termo}\`\n` +
|
||||
`⚠️ ${resultado.error}`,
|
||||
`🔍 Busca: \`${esc(termo)}\`\n` +
|
||||
`⚠️ ${esc(resultado.error)}`,
|
||||
{ parse_mode: 'Markdown' }
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const d = resultado.device;
|
||||
const na = (v) => (v !== null && v !== undefined && v !== '') ? String(v) : 'N/A';
|
||||
|
||||
const tagLabel = d.tags && d.tags.length > 0 ? d.tags.join(', ') : 'N/A';
|
||||
const tagLabel = d.tags && d.tags.length > 0 ? d.tags.map(esc).join(', ') : 'N/A';
|
||||
const buscadoPor = resultado.searchedBy === 'tag' ? 'TAG' : 'Serial';
|
||||
|
||||
const msg =
|
||||
`📡 *Informações do Roteador*\n` +
|
||||
`📌 Instância: ${resultado.instance}\n` +
|
||||
`📌 Instância: ${esc(resultado.instance)}\n` +
|
||||
`🔎 Encontrado por: ${buscadoPor}\n\n` +
|
||||
`🖥️ *Dispositivo*\n` +
|
||||
`├ Nome: ${na(d.productClass)}\n` +
|
||||
`├ Fabricante: ${na(d.manufacturer)}\n` +
|
||||
`├ OUI: ${na(d.oui)}\n` +
|
||||
`├ Serial: \`${na(d.serial)}\`\n` +
|
||||
`├ Nome: ${esc(d.productClass)}\n` +
|
||||
`├ Fabricante: ${esc(d.manufacturer)}\n` +
|
||||
`├ OUI: ${esc(d.oui)}\n` +
|
||||
`├ Serial: \`${esc(d.serial)}\`\n` +
|
||||
`├ TAG (TopSapp): \`${tagLabel}\`\n` +
|
||||
`├ HW: ${na(d.hardwareVersion)}\n` +
|
||||
`└ SW: ${na(d.softwareVersion)}\n\n` +
|
||||
`├ HW: ${esc(d.hardwareVersion)}\n` +
|
||||
`└ SW: ${esc(d.softwareVersion)}\n\n` +
|
||||
`📶 *Wi-Fi 2.4 GHz*\n` +
|
||||
`├ SSID: ${na(d.ssid24)}\n` +
|
||||
`├ Canal: ${na(d.channel24)}\n` +
|
||||
`└ Auto-Canal: ${d.autoChannel24}\n\n` +
|
||||
`├ SSID: ${esc(d.ssid24)}\n` +
|
||||
`├ Canal: ${esc(d.channel24)}\n` +
|
||||
`└ Auto-Canal: ${esc(d.autoChannel24)}\n\n` +
|
||||
`📶 *Wi-Fi 5 GHz*\n` +
|
||||
`├ SSID: ${na(d.ssid5)}\n` +
|
||||
`├ Canal: ${na(d.channel5)}\n` +
|
||||
`└ Auto-Canal: ${d.autoChannel5}`;
|
||||
`├ SSID: ${esc(d.ssid5)}\n` +
|
||||
`├ Canal: ${esc(d.channel5)}\n` +
|
||||
`└ Auto-Canal: ${esc(d.autoChannel5)}`;
|
||||
|
||||
await this.bot.sendMessage(chatId, msg, { parse_mode: 'Markdown' });
|
||||
|
||||
|
||||
Reference in new issue
Block a user