Пример #1
0
def _format_converters(converters):
    if all(
            inspect.isclass(c) and issubclass(c, discord.abc.GuildChannel)
            for c in converters):
        return 'channel'

    return human_join(map(_format_converter, converters), final='or')
Пример #2
0
def _format_missing_required_arg(ctx, param):
    required, _ = _split_params(ctx.command)
    missing = list(itertools.dropwhile(lambda p: p != param, required))
    names = human_join(f'`{p.name}`' for p in missing)

    # TODO: Specify the args more descriptively.
    return (
        f"Hey hey, you're missing {names}.\n\n"
        f'Usage: `{ctx.clean_prefix}{ctx.command.signature}`\n'
    )
Пример #3
0
def _format_missing_required_arg(ctx, param):
    required, optional = _split_params(ctx.command)
    missing = list(itertools.dropwhile(lambda p: p != param, required))
    names = human_join(f'`{p.name}`' for p in missing)
    example = ' '.join(
        _parameter_examples(missing + _random_slice(optional), ctx))

    # TODO: Specify the args more descriptively.
    return (f"Hey hey, you're missing {names}.\n\n"
            f'Usage: `{ctx.clean_prefix}{ctx.command.signature}`\n'
            f'Example: {ctx.message.clean_content} **{example}** \n')
Пример #4
0
    async def kiss(self, ctx: commands.Context,
                   members: commands.Greedy[discord.Member]):
        self.valid_mentions(ctx, members)
        image = await ctx.loop.run_in_executor(None, nekos.img, 'kiss')

        cuteheart = ctx.constants.cuteheart_emoji
        all_members = human_join([member.name for member in members],
                                 final='e')

        await ctx.send(
            title=f'{cuteheart} {ctx.author.name} beijou {all_members}!',
            image=image)
Пример #5
0
def _format_bot_missing_perms(ctx, missing_perms):
    action = _missing_perm_actions.get(str(ctx.command))
    if not action:
        actions = (_DEFAULT_MISSING_PERMS_ACTIONS.get(p, p.replace('_', ' '))
                   for p in missing_perms)
        action = human_join(actions, final='or')

    nice_perms = (perm.replace('_', ' ').replace('guild', 'server').title()
                  for perm in missing_perms)

    return (f"Hey hey, I don't have permissions to {action}. "
            f'Please check if I have {human_join(nice_perms)}.')