fix
parent
68d0fb2ced
commit
a648865083
|
@ -24,6 +24,7 @@ public class CpuTemp extends CommandTemplate {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String executeCommandSpecificHost(String serverName) {
|
public String executeCommandSpecificHost(String serverName) {
|
||||||
|
try {
|
||||||
Optional<SshServer> server = sshService.getAllSshServers()
|
Optional<SshServer> server = sshService.getAllSshServers()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(x -> x.getName().equals(serverName))
|
.filter(x -> x.getName().equals(serverName))
|
||||||
|
@ -39,5 +40,10 @@ public class CpuTemp extends CommandTemplate {
|
||||||
log.error("Ошибка при выполнении команды 'CPUtemp'. Искомый сервер ({}) не найден", serverName);
|
log.error("Ошибка при выполнении команды 'CPUtemp'. Искомый сервер ({}) не найден", serverName);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
log.error("Ошибка при выполнении команды 'CPUtemp'" ,e.getMessage());
|
||||||
|
return "Сервер " + serverName + " не поддерживает команду 'CPUtemp'";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,10 +45,9 @@ public class TelegramBotKeyboard implements UiFormer {
|
||||||
private ArrayList<KeyboardRow> formKeyboard(User user) {
|
private ArrayList<KeyboardRow> formKeyboard(User user) {
|
||||||
Role role = user.getRole();
|
Role role = user.getRole();
|
||||||
Map<String, CommandTemplate> commands = applicationContext.getBeansOfType(CommandTemplate.class);
|
Map<String, CommandTemplate> commands = applicationContext.getBeansOfType(CommandTemplate.class);
|
||||||
if (List.of(ADMIN, USER).contains(role)) {
|
commands.remove("firstUseCommand");
|
||||||
commands.remove("/start");
|
commands.remove("switchToMainMenu");
|
||||||
commands.remove("Not found");
|
|
||||||
}
|
|
||||||
int buttonOnLine = 3;
|
int buttonOnLine = 3;
|
||||||
|
|
||||||
ArrayList<KeyboardRow> keyboardRows = new ArrayList<>();
|
ArrayList<KeyboardRow> keyboardRows = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue