use of fredboat.messaging.internal.Context in project FredBoat by Frederikam.
the class NodeAdminCommand method show.
private void show(@Nonnull CommandContext context) {
String name = context.args[1];
List<LavalinkSocket> nodes = Launcher.getBotController().getAudioConnectionFacade().getLavalink().getNodes().stream().filter(ll -> ll.getName().equals(name)).collect(Collectors.toList());
if (nodes.isEmpty()) {
context.reply("No such node: " + name + ", showing a list of all nodes instead");
list(context);
return;
}
RemoteStats stats = nodes.get(0).getStats();
String out = "No stats have been received from this node! Is the node down?";
if (stats != null) {
out = TextUtils.asCodeBlock(stats.getAsJson().toString(4), "json");
}
context.reply(out);
}
Aggregations