Exemplo n.º 1
0
 def build_mod_action_embed(
     self, ctx, user: Member, reason: str, title: str
 ) -> Embed:
     embed = Embed(description=reason, color=0xCC2222)
     embed.set_author(name=title, icon_url=self.server.icon.url)
     embed.set_footer(text=ctx.author.display_name, icon_url=ctx.author.avatar.url)
     return embed
Exemplo n.º 2
0
    def get_comic(self, number):
        if number == None:
            comic = xkcd.getRandomComic()
        else:
            comic = xkcd.getComic(number)

        embed = Embed(description=comic.getAltText())
        embed.set_author(name=comic.getTitle())
        embed.set_image(url=comic.getImageLink())
        return embed
 async def _help_embed(self,
                       title: str,
                       description: Optional[str] = None,
                       mapping: Optional[str] = None,
                       command_set: Optional[Set[commands.Command]] = None,
                       set_author: bool = False) -> Embed:
     embed = Embed(title=title)
     if description:
         embed.description = description
     if set_author:
         avatar = self.context.bot.user.avatar or self.context.bot.user.default_avatar
         embed.set_author(name=self.context.bot.user.name,
                          icon_url=avatar.url)
     if command_set:
         # show help about all commands in the set
         filtered = await self.filter_commands(command_set, sort=True)
         for command in filtered:
             embed.add_field(name=self.get_command_signature(command),
                             value=command.short_doc or "...",
                             inline=False)
     elif mapping:
         # add a short description of commands in each cog
         for cog, command_set in mapping.items():
             filtered = await self.filter_commands(command_set, sort=True)
             if not filtered:
                 continue
             name = cog.qualified_name if cog else "No category"
             emoji = getattr(cog, "COG_EMOJI", None)
             cog_label = f"{emoji} {name}" if emoji else name
             # \u2002 is an en-space
             cmd_list = "\u2002".join(
                 f"`{self.context.clean_prefix}{cmd.name}`"
                 for cmd in filtered)
             value = (f"{cog.description}\n{cmd_list}"
                      if cog and cog.description else cmd_list)
             embed.add_field(name=cog_label, value=value)
     return embed
Exemplo n.º 4
0
def _testing_embed():
    embed = Embed(title="Title", url="https://cog-creators.github.io/discord-embed-sandbox/", description="Description", color=0xff0000)
    embed.set_author(name="Author name")
    embed.add_field(name="Field Name", value="Field Value", inline=False)
    embed.set_footer(text="Footer")
    return embed