async def sharedservers(self, ctx, *, user: UserConverter): guilds = [ f"{guild.name} `{guild.id}` ({guild.member_count} members)" for guild in [ await self.bot.get_guild(int(guild)) for guild in await tools.get_user_guilds(self.bot, user) or [] ] if guild is not None ] if len(guilds) == 0: await ctx.send(ErrorEmbed("No such guild was found.")) return all_pages = [] for chunk in [guilds[i:i + 20] for i in range(0, len(guilds), 20)]: page = Embed(title="Shared Servers") for guild in chunk: if page.description == discord.Embed.Empty: page.description = guild else: page.description += f"\n{guild}" page.set_footer("Use the reactions to flip pages.") all_pages.append(page) await tools.create_paginator(self.bot, ctx, all_pages)
async def _send_guilds(self, ctx, guilds, title): if len(guilds) == 0: await ctx.send(embed=ErrorEmbed( description="No such guild was found.")) return all_pages = [] for chunk in [guilds[i:i + 20] for i in range(0, len(guilds), 20)]: page = Embed(title=title) for guild in chunk: if page.description == discord.Embed.Empty: page.description = guild else: page.description += f"\n{guild}" page.set_footer(text="Use the reactions to flip pages.") all_pages.append(page) if len(all_pages) == 1: embed = all_pages[0] embed.set_footer(text=discord.Embed.Empty) await ctx.send(embed=embed) return await tools.create_paginator(self.bot, ctx, all_pages)