__init__.py 文件源码

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

项目:pcbot 作者: pckv 项目源码 文件源码
def execute(cmd, message: discord.Message, *args, **kwargs):
    """ Execute a command specified by name, alias or command object.
    This is really only useful as a shortcut for other commands.

    :param cmd: either plugins.Command or str
    :param message: required message object in order to execute a command
    :param args, kwargs: any arguments passed into the command.

    :raises: NameError when command does not exist.
    """
    # Get the command object if the given command represents a name
    if type(cmd) is not Command:
        cmd = get_command(cmd, config.server_case_sensitive_commands(message.server))

    try:
        await cmd.function(message, *args, **kwargs)
    except AttributeError:
        raise NameError("{} is not a command".format(cmd))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号