Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
属性错误:';客户';对象没有属性';发送消息';(不协调机器人python)_Python_Bots_Discord - Fatal编程技术网

属性错误:';客户';对象没有属性';发送消息';(不协调机器人python)

属性错误:';客户';对象没有属性';发送消息';(不协调机器人python),python,bots,discord,Python,Bots,Discord,python上的Im设置discord welcome bot,错误如下: 文件“welcome bot.py”,第27行,在on_member_join中 等待客户端发送消息(成员,newUserMessage) AttributeError:“客户端”对象没有“发送消息”属性 导入不一致 导入异步 client=discord.client() @客户端事件 _ready()上的异步定义: 打印('登录为') 打印(client.user.name) 打印(client.user.id) 打

python上的Im设置discord welcome bot,错误如下:

文件“welcome bot.py”,第27行,在on_member_join中 等待客户端发送消息(成员,newUserMessage) AttributeError:“客户端”对象没有“发送消息”属性

导入不一致
导入异步
client=discord.client()
@客户端事件
_ready()上的异步定义:
打印('登录为')
打印(client.user.name)
打印(client.user.id)
打印('----')
newUserMessage=“”
是
那个
作品
"""
@客户端事件
成员加入时的异步定义(成员):
打印(“确认名为“+member.name+”的成员已加入”)
等待客户端发送消息(成员,newUserMessage)
打印(“发送消息到”+成员名称)```
不包含名为“发送消息”的函数,您可以在该函数中对用户进行PM/DM

相反,您可以从加入的成员获取属性,并在该通道中发送消息:

joinedUserDM = member.dm_channel

if joinedUserDM is None:
    await member.create_dm()
    joinedUserDM = member.dm_channel

joinedUserDM.send("message to send to the joined user's private inbox")
不包含名为
send_message
的函数,您可以在该函数中对用户进行PM/DM

相反,您可以从加入的成员获取属性,并在该通道中发送消息:

joinedUserDM = member.dm_channel

if joinedUserDM is None:
    await member.create_dm()
    joinedUserDM = member.dm_channel

joinedUserDM.send("message to send to the joined user's private inbox")

嗯,嗯。。。就是这样:类
Client
的实例没有此属性。你应该查阅这个库的文档来找出这个类提供了哪些方法。。。就是这样:类
Client
的实例没有此属性。您应该查阅此库的文档,以了解此类提供了哪些方法。