簡體   English   中英

discord.py | 我的機器人無法將 DM 發送給其他機器人

[英]discord.py | My bot cannot send DM to other bot

我想 DM 給機器人。 這是我的代碼。

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>)

我得到了這個錯誤。 “400 錯誤請求(錯誤代碼:50007):無法向該用戶發送消息”

不能 bot DM 到其他機器人?

機器人不能互相發送消息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM