cidades: adicionar opcao de sair
Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo@MacBook-Air-de-Rodrigo.local>
This commit is contained in:
1 parent
2c103557d9
commit
e69349138b
1 file changed
+23
@@ -208,6 +208,10 @@ class BotHandler {
|
|||||||
await this.handleCidade(chatId, userId);
|
await this.handleCidade(chatId, userId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'sair':
|
||||||
|
await this.handleSairCidade(chatId, userId);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'ssh':
|
case 'ssh':
|
||||||
await this.handleSSH(chatId, target);
|
await this.handleSSH(chatId, target);
|
||||||
break;
|
break;
|
||||||
@@ -448,6 +452,23 @@ Digite /help para ver todos os comandos disponíveis!
|
|||||||
await this.sendSiteSelectionMenu(chatId, siteIds);
|
await this.sendSiteSelectionMenu(chatId, siteIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comando /sair - sai da cidade/provedor ativo e exibe o menu de seleção novamente
|
||||||
|
*/
|
||||||
|
async handleSairCidade(chatId, userId) {
|
||||||
|
const siteIds = sites.getUserSiteIds(userId);
|
||||||
|
|
||||||
|
if (siteIds.length <= 1) {
|
||||||
|
const site = sites.getSite(siteIds[0]) || this.getActiveSite(chatId);
|
||||||
|
await this.bot.sendMessage(chatId, `📍 Você só tem acesso a *${site.name}*, não há outra cidade para escolher.`, { parse_mode: 'Markdown' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.activeSite.delete(chatId);
|
||||||
|
await this.bot.sendMessage(chatId, '👋 Você saiu da cidade/provedor ativo.');
|
||||||
|
await this.sendSiteSelectionMenu(chatId, siteIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comando /help
|
* Comando /help
|
||||||
*/
|
*/
|
||||||
@@ -461,6 +482,8 @@ Digite /help para ver todos os comandos disponíveis!
|
|||||||
• /start - Inicia o bot
|
• /start - Inicia o bot
|
||||||
• /help - Esta ajuda
|
• /help - Esta ajuda
|
||||||
• /equipamentos - Lista equipamentos
|
• /equipamentos - Lista equipamentos
|
||||||
|
• /cidade - Trocar cidade/provedor ativo
|
||||||
|
• /sair - Sair da cidade ativa e escolher outra
|
||||||
|
|
||||||
🏢 **GESTÃO DE CLIENTES:**
|
🏢 **GESTÃO DE CLIENTES:**
|
||||||
• "buscar cliente João Silva"
|
• "buscar cliente João Silva"
|
||||||
|
|||||||
Reference in new issue
Block a user