コード例 #1
0
    async def wikipedia_search_command(self, ctx: commands.Context, *,
                                       search: str) -> None:
        """Sends paginated top 10 results of Wikipedia search.."""
        contents = await self.wiki_request(ctx.channel, search)

        if contents:
            embed = Embed(title="Wikipedia Search Results",
                          colour=Color.og_blurple())
            embed.set_thumbnail(url=WIKI_THUMBNAIL)
            embed.timestamp = datetime.utcnow()
            await LinePaginator.paginate(contents, ctx, embed)
        else:
            await ctx.send(
                "Sorry, we could not find a wikipedia article using that search term."
            )
コード例 #2
0
    async def info_command(self, ctx: commands.Context, emoji: Emoji) -> None:
        """Returns relevant information about a Discord Emoji."""
        emoji_information = Embed(
            title=f"Emoji Information: {emoji.name}",
            description=textwrap.dedent(f"""
                **Name:** {emoji.name}
                **Created:** {time_since(emoji.created_at.replace(tzinfo=None), precision="hours")}
                **Date:** {datetime.strftime(emoji.created_at.replace(tzinfo=None), "%d/%m/%Y")}
                **ID:** {emoji.id}
            """),
            color=Color.og_blurple(),
            url=str(emoji.url),
        ).set_thumbnail(url=emoji.url)

        await ctx.send(embed=emoji_information)