【问题标题】:Disconnect user with python (discord bot)使用 python 断开用户(不和谐机器人)
【发布时间】:2020-03-28 18:19:46
【问题描述】:

我试图发出一个断开用户连接的命令,但不明白为什么它会给我这个错误:'Client' object has no attribute 'command' (这只是机器人代码的一部分)

@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】:

您忘记了@client.command 之后的()。改成@client.command()

【讨论】:

    猜你喜欢
    • 2021-05-24
    • 2021-10-30
    • 2021-05-27
    • 2021-07-15
    • 2021-12-21
    • 1970-01-01
    • 1970-01-01
    • 2019-03-12
    • 2021-03-29
    相关资源
    最近更新 更多