def _get_info_page(self, breadcrumbs): var_names = [var.human_readable_name() for var in self._vars] start_index = (breadcrumbs.page() - 1) * InfoResult.num_on_page last_index = start_index + InfoResult.num_on_page vars_on_page = var_names[start_index:last_index] out = [] message = ResultMessage() for i, var_ in enumerate(vars_on_page): prefix = "" if self._add_reaction_selectors: prefix = ada.emoji.NUM_EMOJI[i + 1] message.reactions.append(prefix) out.append("- " + prefix + var_) if not self._add_reaction_selectors: message.reactions = [] if breadcrumbs.page() > 1: message.reactions.append(ada.emoji.PREVIOUS_PAGE) message.reactions.append(ada.emoji.INFO) if breadcrumbs.page() < self._num_pages(): message.reactions.append(ada.emoji.NEXT_PAGE) message.embed = Embed(title="Found " + str(len(self._vars)) + " matches:") message.embed.description = "\n".join(out) message.embed.set_footer(text=self._footer(breadcrumbs.page())) message.content = str(breadcrumbs) return message
def message(self, breadcrumbs): if len(self._vars) == 0: message = ResultMessage() message.embed = Embed(title="No matches found") message.content = str(breadcrumbs) return message if len(self._vars) > 1: return self._get_info_page(breadcrumbs) message = ResultMessage() message.embed = self._vars[0].embed() message.content = str(breadcrumbs) message.reactions = [ada.emoji.PREVIOUS_PAGE] return message