【发布时间】:2021-04-26 13:18:03
【问题描述】:
我正在使用 discord.py,并希望将自定义 DM 发送给具有我希望的 ID 的自定义用户。我确实尝试了我们在 Stack Overflow 和 discord.py 上的所有方法和选项,但是,它们都没有最终起作用。我得到的结果总是无。有什么建议吗?
我尝试过的:
#1
user = await bot.get_user_info(user_id)
await user.send('hello')
#2
await client.send_message(discord.Object(id='12324234183172'), 'hello')
#3
async def send_dm(ctx, member: discord.Member, *, content):
channel = await member.create_dm()
await channel.send(content)
【问题讨论】:
-
虽然这很可能是意图或 int(id) 问题 (discordpy.readthedocs.io/en/latest/intents.html),但它与 stackoverflow.com/questions/54499864/… 重复
标签: python python-3.x discord bots discord.py