使用python(discord bot)断开用户连接

问题描述 投票:0回答:1

我试图创建一个断开用户连接的命令,但是不明白为什么它会给我这个错误:'客户端'对象没有属性'命令'(这只是机器人代码的一部分)

@client.command
async def leave(ctx, member : discord.Member):
    await discord.Member.disconnect()



 if msg.startswith("$kick."):
        users = message.guild.members
        count = 6
        name = ""
        while count < len(message.content):
            name = name + str(message.content[count])
            count = count + 1
        #till here we just got the name
        x = 0
        while x > id.member_count:
            if name == users[x]:
                leave('was kicked',user[x])
                break
python command client discord.py disconnect
1个回答
0
投票

您在()之后忘记了@client.command。将其更改为@client.command()

© www.soinside.com 2019 - 2024. All rights reserved.