__init__.py 文件源码

python
阅读 61 收藏 0 点赞 0 评论 0

项目:pcbot 作者: pckv 项目源码 文件源码
def format_usage(cmd: Command, server: discord.Server):
    """ Format the usage string of the given command. Places any usage
    of a sub command on a newline.

    :param cmd: Type Command.
    :param server: The server to generate the usage in.
    :return: str: formatted usage.
    """
    if cmd.hidden and cmd.parent is not None:
        return

    command_prefix = config.server_command_prefix(server)
    usage = [cmd.usage(server)]
    for sub_command in cmd.sub_commands:
        # Recursively format the usage of the next sub commands
        formatted = format_usage(sub_command, server)

        if formatted:
            usage.append(formatted)

    return "\n".join(s for s in usage if s is not None).format(pre=command_prefix) if usage else None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号