我想使用他们的ID将DM发送给某人,我尝试了此代码,并显示Instance of 'Client' has no 'get_user_info' member pylint(no-member)
这是代码,我将这段代码放在@client.event
上,以便在我对BOT说些话时触发
if message.content.lower() == 'dm':
user = await client.get_user_info(user_id="USER'S ID")
await client.send_message(user, "Your message")
为此我需要帮助!
答案 0 :(得分:1)
在您的on_message
if message.content.lower() == 'dm':
user = await client.fetch_user(message.author.id) #you can also just type the id
await user.send("Your message")
答案 1 :(得分:0)
非常感谢!,这段代码对我有用
if message.content.lower() == 'dm':
user = await client.fetch_user(ID goes here)
await user.send("Your message here")