if (parameters.isEmpty()) {
return state
}
- val index = Ints.tryParse(parameters[0])
- if (index != null && index < state.lastResults.size) {
- core.fetch(state.lastResults[index].bot(), state.lastResults[index].pack())
- }
+ parameters
+ .mapNotNull { Ints.tryParse(it) }
+ .filter { it < state.lastResults.size }
+ .map { state.lastResults[it] }
+ .forEach { core.fetch(it.bot(), it.pack()) }
return state
}