我需要获取用户的 PM 频道才能查看我的机器人之前发送给该用户的消息。我已经从标准频道中的命令消息中获得了他们的用户对象。
这是我迄今为止尝试过的:
@client.event
async def in_msg(msg):
user = msg.author
privateChannel = client.get_channel(user.id) # not working
if privateChannel is not None:
await doSomethingWithChannel(privateChannel, user)
else:
privateChannel = await client.start_private_message(user)
await firstMessageToUser(privateChannel, user)
但是,用户的 DM 频道似乎与他们的用户 ID 无关。我现在该怎么办?