Exemplo n.º 1
0
 async def send_command_help(self, ctx: Context, command: Command):
     literal = literals('send_command_help')
     command_name = command.qualified_name
     default_signature = get_command_default_signature(command)
     footer = get_command_signature(command)
     description = ''
     if command.help is not None:
         description = command.help + '\n'
     elif command.brief is not None:
         description = command.brief + '\n'
     description += f'`{default_signature}`'
     embeds = ChainedEmbed(title=get_constant('default_prefix') + command_name, description=description)
     embeds.set_thumbnail(url=self.client.user.avatar_url)
     if not command.enabled:
         embeds.add_field(name=literal['disabled_name'], value=literal['disabled_value'])
     if isinstance(command, CustomGroup):
         embeds.add_field(name=literal['subcommand'],
                          value=f'\n{brief_group(command)}\n')
     for check in command.checks:
         data = get_check(check.name)
         if data is None:
             continue
         embeds.add_field(name=f'{data["emoji"]} {data["name"]}', value=data["description"])
     if command.cog is not None:
         category = command.cog.qualified_name
         if isinstance(command.cog, CustomCog):
             category = command.cog.emoji + ' ' + category
         footer += ' · ' + category
     embeds.set_footer(text=footer)
     for embed in embeds.to_list():
         await ctx.send(embed=embed)
Exemplo n.º 2
0
 async def send_cog_info(self, ctx: Context, cog: Cog):
     cog_name = cog.qualified_name
     if isinstance(cog, CustomCog):
         cog_name = cog.emoji + ' ' + cog_name
     brief = brief_cog(cog)
     embeds = ChainedEmbed(title=cog_name, description=brief)
     embeds.set_thumbnail(url=self.client.user.avatar_url)
     for embed in embeds.to_list():
         await ctx.send(embed=embed)
Exemplo n.º 3
0
 async def deck_list(self, ctx: Context):
     literal = literals('deck_list')
     list_embeds = ChainedEmbed(
         title=literal['title'],
         description='\n'.join([
             deck.get_brief()
             for deck in sorted(self.deck_handler.decks.values(),
                                key=lambda item: item.id)
         ]))
     list_embeds.set_thumbnail(url=self.client.user.avatar_url)
     for embed in list_embeds.to_list():
         await ctx.send(embed=embed)
Exemplo n.º 4
0
 async def search(self, ctx: Context, keyword: str, *keywords: str):
     literal = literals('search')
     keywords = list(keywords)
     keywords.append(keyword)
     description = literal['found']
     embeds = ChainedEmbed(title=literal['title'], description=description)
     embeds.set_thumbnail(url=self.client.user.avatar_url)
     found = 0
     for command in self.client.commands:
         found += check_correlation(command, keywords, embeds)
     embeds.description = description % (found, ', '.join(keywords)) if found \
         else literal['not_found'] % ', '.join(keywords)
     for embed in embeds.to_list():
         await ctx.send(embed=embed)