예제 #1
0
    async def guild_emojis(self, ctx, *, guild: utils.GuildConverter = None):
        if not guild:
            guild = ctx.guild

        chunks = [
            e async for e in utils.pager(
                sorted(list(guild.emojis), key=lambda _: _.name), 8)
        ]

        if not chunks:
            return await ctx.send('This guild has no custom emojis.')

        pagey = utils.EmojiPaginator(title=f'Emojis | {ctx.guild.name}',
                                     chunks=chunks)
        self.bot.loop.create_task(pagey.paginate(ctx))
예제 #2
0
    async def emojis_(self, ctx, *, name: str = None):
        """Display all emojis I can see in a paginated embed.

        Aliases
        ---------
            emotes

        Sub-Commands
        --------------
            guild

        Examples
        ----------
        <prefix>emojis
        <prefix>emojis guild

            {ctx.prefix}emojis
            {ctx.prefix}emojis guild
        """
        if name:
            emojis = [e for e in self.bot.emojis if name in e.name]
            if not emojis:
                return await ctx.send(
                    f'Could not find any emojis with search term: `{name}`')

            chunks = [
                e async for e in utils.pager(
                    sorted(emojis, key=lambda _: _.name), 8)
            ]
        else:
            chunks = [
                e async for e in utils.pager(
                    sorted(self.bot.emojis, key=lambda _: _.name), 8)
            ]

        pagey = utils.EmojiPaginator(title='Emojis', chunks=chunks)
        self.bot.loop.create_task(pagey.paginate(ctx))