[英]discord.py | My bot cannot send DM to other bot
I'd like to DM to a bot.我想 DM 给机器人。 This is my code.
这是我的代码。
import discord
intents = discord.Intents.default()
intents.messages = True
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f'We have logged in as {client.user}')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello!')
user = await client.fetch_user(<BotID>)
print(user.name)
try:
await user.send('👀')
except Exception as e:
print(e)
client.run(<TOKEN>)
I got this error.我得到了这个错误。 "400 Bad Request (error code: 50007): Cannot send messages to this user"
“400 错误请求(错误代码:50007):无法向该用户发送消息”
Can't bot DM to other bot?不能 bot DM 到其他机器人?
Bots cannot send messages to each other机器人不能互相发送消息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.